Build Main #374
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: Build Main | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
schedule: | |
# <minute [0,59]> <hour [0,23]> <day of the month [1,31]> <month of the year [1,12]> <day of the week [0,6]> | |
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07 | |
# Run every Monday at 18:00:00 UTC (Monday at 10:00:00 PST) | |
- cron: "0 18 * * 1" | |
jobs: | |
test-core-lib: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.9, '3.10', 3.11] | |
os: [ | |
ubuntu-latest, | |
windows-latest, | |
macos-latest, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[test] | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: aicsimageio/tests/resources | |
key: ${{ hashFiles('scripts/TEST_RESOURCES_HASH.txt') }} | |
- name: Download Test Resources | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
python scripts/download_test_resources.py --debug | |
- name: Run tests with Tox | |
# Run tox using the version of Python in `PATH` | |
run: tox -e py | |
- name: Upload codecov | |
uses: codecov/codecov-action@v3 | |
test-readers: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.9, '3.10', 3.11] | |
os: [ | |
ubuntu-20.04, | |
windows-latest, | |
macos-11, | |
] | |
tox-env: [ | |
bioformats, | |
czi, | |
base-imageio, | |
dv, | |
lif, | |
nd2, | |
sldy, | |
bfio, | |
omezarr, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "11" | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[test] | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: aicsimageio/tests/resources | |
key: ${{ hashFiles('scripts/TEST_RESOURCES_HASH.txt') }} | |
- name: Download Test Resources | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
python scripts/download_test_resources.py --debug | |
- name: Run tests with Tox | |
# Run tox using the version of Python in `PATH` | |
run: tox -e ${{ matrix.tox-env }} | |
- name: Upload codecov | |
uses: codecov/codecov-action@v2 | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[test] | |
- name: Lint | |
run: tox -e lint | |
publish: | |
if: "contains(github.event.head_commit.message, 'Bump version')" | |
needs: [test-core-lib, test-readers, lint] | |
runs-on: ubuntu-latest | |
# Specifying a GitHub environment is optional, but strongly encouraged | |
environment: release | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel | |
- name: Build Package | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |