Fix #531
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test (PyPI) | |
on: | |
push: | |
branches: | |
- pypi | |
schedule: | |
- cron: "0 18 * * 1,3,5" | |
jobs: | |
test: | |
name: Test PyPI (${{ matrix.os }}, py${{ matrix.python-version }}, tf${{ matrix.tensorflow }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs | |
os: [macos-latest] # macos-latest is arm64-based | |
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | |
tensorflow: [1, 2] | |
include: | |
# always set 'package-extras' conditional on tensorflow version | |
- tensorflow: 1 | |
package-extras: 'test,tf1' | |
- tensorflow: 2 | |
package-extras: 'test' | |
# test bioimage.io export with python 3.7 and tensorflow 1 | |
- python-version: '3.7' | |
tensorflow: 1 | |
package-extras: 'test,tf1,bioimageio' | |
# install edt with numpy>=1.20 when testing with python 3.9 | |
- python-version: '3.9' | |
deps-extra: 'edt "numpy>=1.20"' | |
# add extra run to test latest tensorflow with legacy keras | |
- os: ubuntu-20.04 | |
python-version: '>=3.12 <3.13' # intentionally be different than '3.12' to cause an additional combination | |
tensorflow: 2 | |
package-extras: 'test' | |
deps-extra: 'tf_keras' | |
exec-extra: 'echo "TF_USE_LEGACY_KERAS=1" >> $GITHUB_ENV' | |
# cases for using x86_64-based runner (macos-13) | |
- os: macos-13 | |
python-version: '3.6' # no arm64 wheels | |
tensorflow: 1 | |
- os: macos-13 | |
python-version: '3.6' # no arm64 wheels | |
tensorflow: 2 | |
- os: macos-13 | |
python-version: '3.7' # no arm64 wheels | |
tensorflow: 1 | |
- os: macos-13 | |
python-version: '3.7' # no arm64 wheels | |
tensorflow: 2 | |
- os: macos-13 | |
python-version: '>=3.12 <3.13' # intentionally be different than '3.12' to cause an additional combination | |
tensorflow: 2 | |
package-extras: 'test' | |
exclude: | |
# https://www.tensorflow.org/install/source#tested_build_configurations | |
- python-version: '3.8' | |
tensorflow: 1 | |
- python-version: '3.9' | |
tensorflow: 1 | |
- python-version: '3.10' | |
tensorflow: 1 | |
- python-version: '3.11' | |
tensorflow: 1 | |
- python-version: '3.12' | |
tensorflow: 1 | |
- os: windows-latest | |
tensorflow: 1 | |
steps: | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip, wheel, setuptools | |
run: python -m pip install --upgrade pip wheel setuptools | |
- name: Install TensorFlow | |
run: pip install "tensorflow==${{ matrix.tensorflow }}.*" | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install extra dependencies (if any) | |
if: ${{ matrix.deps-extra }} | |
run: pip install ${{ matrix.deps-extra }} | |
- name: Install package from source (just to test wheel building) - Linux | |
if: startsWith(matrix.os, 'ubuntu') | |
run: pip install --no-binary stardist "stardist[${{ matrix.package-extras }}]" | |
- name: Install package from source (just to test wheel building) - Windows | |
if: startsWith(matrix.os, 'windows') | |
run: pip install --no-binary stardist "stardist[${{ matrix.package-extras }}]" | |
env: # cf. https://github.com/pypa/pip/issues/11231 | |
TEMP: "/tmp" # notes: | |
TMPDIR: "/tmp" # - /tmp should already exist on runner image | |
TMP: "/tmp" # - set all temp-related env variables (had issues with when omitting some) | |
# - name: Install package from source (just to test wheel building) - macOS | |
# if: startsWith(matrix.os, 'macos') | |
# run: ... | |
- name: Install package from wheel | |
shell: bash | |
run: | | |
[[ -z $(pip list | grep stardist) ]] && pip uninstall -y stardist | |
pip install --no-cache-dir --only-binary stardist "stardist[${{ matrix.package-extras }}]>0" | |
- name: Run extra commands (if any) | |
if: ${{ matrix.exec-extra }} | |
run: ${{ matrix.exec-extra }} | |
shell: bash | |
- name: Disable PytestReturnNotNoneWarning (Python 3.7+) | |
if: matrix.python-version != 3.6 | |
run: echo "PYTEST_ADDOPTS='-W ignore::pytest.PytestReturnNotNoneWarning'" >> $GITHUB_ENV | |
shell: bash | |
- name: Run tests | |
run: pytest -m "not gpu" |