-
Notifications
You must be signed in to change notification settings - Fork 22
76 lines (62 loc) · 2.43 KB
/
unit-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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Unit Testing
on:
pull_request:
types: [opened, edited, reopened]
push:
jobs:
build:
strategy:
fail-fast: false
matrix:
osver: [ "ubuntu-20.04", "ubuntu-22.04" ]
runs-on: ${{ matrix.osver }}
name: Unit test on ${{ matrix.osver }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
pip install -r tests/requirements.txt
- name: Test with pytest
run: |
pytest tests --junitxml=tests/junit/test-results.xml \
--cov-config=tests/.coveragerc --cov=sarracenia --cov-report=html --cov-report=lcov --cov-report=xml \
--html=tests/report.html --self-contained-html
- name: Upload pytest junit results
uses: actions/upload-artifact@v3
with:
name: results-junit-${{ matrix.osver }}
path: tests/junit/test-results.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Upload pytest HTML report
uses: actions/upload-artifact@v3
with:
name: results-report-${{ matrix.osver }}
path: tests/report.html
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Upload code coverage report (HTML)
uses: actions/upload-artifact@v3
with:
name: coverage-report-${{ matrix.osver }}
path: tests/coverage/html_report
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Upload code coverage report (LCOV)
uses: actions/upload-artifact@v3
with:
name: coverage-lcov-${{ matrix.osver }}
path: tests/coverage/coverage.lcov
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Upload code coverage report (XML)
uses: actions/upload-artifact@v3
with:
name: coverage-xml-${{ matrix.osver }}
path: tests/coverage/coverage.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}