-
Notifications
You must be signed in to change notification settings - Fork 23
67 lines (56 loc) · 1.48 KB
/
unit_tests.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
## Disclaimer - This GitHub Actions workflow runs all the unit tests for the project.
# Name the workflow
name: unit_testing
# Define when it runs
on:
push:
paths:
- 'narps_open/**'
- 'setup.py'
- 'setup.cfg'
- 'pytest.ini'
- 'tests/conftest.py'
pull_request:
paths:
- 'narps_open/**'
- 'setup.py'
- 'setup.cfg'
- 'pytest.ini'
- 'tests/conftest.py'
# Jobs that define the workflow
jobs:
# Name of the job running unit tests
pytest:
# Define the runner for this job
runs-on: ubuntu-latest
# Steps that define the job
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[tests]
- name: Launch tests with pytest & get code coverage
run: |
coverage run -m pytest --junit-xml=pytest_report.xml -m "not pipeline_test"
coverage report
coverage xml
- name: Archive pytest results
uses: actions/upload-artifact@v3
with:
name: unit_tests-reports
path: |
pytest_report.xml
coverage.xml
retention-days: 15