Autoupdate pre-commit hooks (#1220) #2280
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: "0 4 * * *" | |
env: | |
FORCE_COLOR: 1 | |
jobs: | |
pytest: | |
name: Unit tests | |
strategy: | |
matrix: | |
os: [ | |
ubuntu-latest, | |
macos-latest, | |
windows-latest, | |
] | |
python: [ | |
'3.8', | |
'3.9', | |
'3.10', | |
'3.11', | |
'3.12', | |
] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
env: | |
OS: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "pyproject.toml" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Python | |
run: uv python install ${{ matrix.python }} | |
- name: Install tox | |
run: uv tool install tox --with tox-uv | |
- name: Add local bin to path on Windows | |
if: runner.os == 'Windows' | |
run: echo "C:/Users/runneradmin/.local/bin" >> $GITHUB_PATH | |
shell: bash | |
- name: Setup test suite | |
run: tox run -v --notest --skip-missing-interpreters false -e ${{ matrix.python }} | |
# Run all tests on schedule, but only non-slow tests on push | |
- name: Run pytest | |
run: | | |
if [ "${{ github.event_name }}" == "schedule" ]; then | |
tox -e pytest | |
else | |
tox -e pytest -- -m "not slow" | |
fi | |
shell: bash # this wouldn't work on Powershell | |
- name: Upload coverage reports to Codecov | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python == '3.12' }} | |
uses: codecov/codecov-action@v4.5.0 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
cli: | |
name: CLI smoke tests | |
runs-on: ubuntu-latest | |
env: | |
PYTHON_VERSION: '3.12' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "pyproject.toml" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Python | |
run: uv python install ${{ env.PYTHON_VERSION }} | |
- name: Install CLI tools | |
run: uv tool install "torchio@." | |
- name: Test transforms CLI tool | |
run: tiotr --help | |
- name: Test info CLI tool | |
run: tiohd --help |