Skip to content

Merge branch 'master' of github.com:FNNDSC/aiochris #74

Merge branch 'master' of github.com:FNNDSC/aiochris

Merge branch 'master' of github.com:FNNDSC/aiochris #74

Workflow file for this run

name: Test
on:
push:
branches: [ master ]
paths:
- '.github/workflows/test.yml'
- '**.py'
pull_request:
jobs:
test:
name: Tests
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: [ '3.11', '3.12' ]
steps:
- uses: actions/checkout@v4
- name: Install rye
uses: eifinger/setup-rye@d4c3ac7b15d8bf2e0b45e2d257c6b5cdbebc3643 # v4.2.1
with:
version: '0.36.0'
enable-cache: true
cache-prefix: 'python-v${{ matrix.python-version }}'
- name: Set Python version
run: rye pin --no-update-requires-python '${{ matrix.python-version }}'
- run: rye sync
- name: Start miniChRIS
uses: FNNDSC/miniChRIS-docker@master
- name: Test
id: test
continue-on-error: true # we want to upload coverage, even on failure
run: |
# retry tests: they might fail because of CUBE concurrency problems
for attempt in {1..5}; do
echo " +---------------------+ "
echo " | ATTEMPT $attempt | "
echo " +---------------------+ "
rye run pytest --cov=aiochris --cov-report=xml
if [ "$?" = 0 ]; then
if [ "$attempt" != "1" ]; then
echo "::warning ::Tests took $attempt attempts."
fi
exit 0
fi
done
exit 1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
env_vars: 'python-${{ matrix.python-version }}'
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}