-
Notifications
You must be signed in to change notification settings - Fork 8
104 lines (87 loc) · 2.65 KB
/
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
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
name: Tests
on:
push: null
pull_request: null
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10' ]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox==3.28.0 tox-gh-actions
- name: Run tox
run: |
python -m tox -- --junit-xml pytest.xml
- name: Upload result_images from graphics tests
if: failure()
uses: actions/upload-artifact@v2
with:
name: Result images
path: result_images
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: Test results (Python ${{ matrix.python-version }})
path: pytest.xml
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox==3.28.0 tox-gh-actions
- name: Run tox flake8
run: |
python -m tox -e flake8
publish-test-results:
name: "Publish test results"
needs: tests
runs-on: ubuntu-latest
# the build-and-test job might be skipped, we don't need to run this job then
if: (success() || failure()) && github.event_name == 'pull_request'
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: artifacts/**/pytest.xml
coverage:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox==3.28.0 tox-gh-actions
- name: Run tox coverage env
run: |
python -m tox -e coverage > pytest-coverage.txt
- name: Comment coverage
uses: coroo/pytest-coverage-commentator@v1.0.2
with:
pytest-coverage: pytest-coverage.txt
# We want to execute this step even if the previous one had failed.
if: always()