-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (50 loc) · 1.62 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Test
on:
push:
branches: [ master ]
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 }}