-
Notifications
You must be signed in to change notification settings - Fork 22
112 lines (96 loc) · 3.48 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Unit Testing
on:
pull_request:
types: [opened, edited, reopened, closed, synchronize]
paths:
- '**.py'
branches:
- 'development'
# push:
# paths-ignore:
# - '.github/**'
workflow_dispatch:
permissions:
contents: write
checks: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-22.04
name: Unit test
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- 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: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: ${{ always() }}
with:
files: |
tests/junit/test-results.xml
# - name: Publish Coverage Results
# uses: orgoro/[email protected]
# with:
# coverageFile: tests/coverage/coverage.xml
# - name: Pytest coverage comment
# uses: MishaKav/pytest-coverage-comment@main
# if: ${{ always() }}
# with:
# #pytest-coverage-path: tests/coverage/coverage.lcov
# pytest-xml-coverage-path: tests/coverage/coverage.xml
# #title: My Coverage Report Title
# #badge-title: My Badge Coverage Title
# #hide-badge: false
# #hide-report: false
# create-new-comment: false
# hide-comment: false
# report-only-changed-files: true
# remove-link-from-badge: false
# #unique-id-for-comment: python3.8
# junitxml-path: tests/junit/test-results.xml
# junitxml-title: Test Results
- name: Upload pytest junit results
uses: actions/upload-artifact@v4
with:
name: results-junit
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@v4
with:
name: results-report
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@v4
with:
name: coverage-report
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@v4
with:
name: coverage-lcov
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@v4
with:
name: coverage-xml
path: tests/coverage/coverage.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}