-
Notifications
You must be signed in to change notification settings - Fork 0
235 lines (192 loc) · 5.98 KB
/
ci.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
---
name: Checks
env:
DEFAULT_PYTHON: 3.8
PACKAGES_PATH: .dwas/cache/package/
COVERAGE_FILES_PATH: .dwas/cache/pytest-*/reports/coverage
JUNIT_REPORT_PATH: _artifacts/junit/
TERM: "xterm-256color"
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
# Use the concurrency feature to ensure we don't run redundant workflows
#
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
session:
- black
- docformatter
- isort
- mypy
- pylint
- unimport
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: pip
# FIXME: we should take dwas from pypi once it's published
- name: Install dwas
run: python -m pip install .
- name: ${{ matrix.session }}
run: dwas --verbose --only ${{ matrix.session }}
package:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: pip
# FIXME: we should take dwas from pypi once it's published
- name: Install dwas
run: python -m pip install .
- name: package
run: dwas --verbose --only package
- name: Save packaged dist
uses: actions/upload-artifact@v4
with:
name: dist
path: ${{ env.PACKAGES_PATH }}/*
retention-days: 7
test:
runs-on: ${{ matrix.os }}
needs: package
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy3.8"
include:
- os: macos-latest
python: "3.8"
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
# FIXME: we should take dwas from pypi once it's published
- name: Install dwas
run: python -m pip install .
- name: Download packaged dist
uses: actions/download-artifact@v4
with:
name: dist
path: ${{ env.PACKAGES_PATH }}
- name: pytest[${{ matrix.python }}]
run: dwas --verbose --only pytest[${{ matrix.python }}] -- --junitxml=${{ env.JUNIT_REPORT_PATH }}/junit-${{ matrix.os}}-${{ matrix.python }}.xml --override-ini junit_suite_name="${{ matrix.os }}-${{ matrix.python }}" ${{ !startsWith(matrix.python, 'pypy') && '--numprocesses 2' || '' }}
- name: Move the coverage to another place to avoid conflicts
if: runner.os != 'Linux'
run: mv .dwas/cache/pytest-* .dwas/cache/pytest-${{ matrix.os }}
- name: Save coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-files-pytest-${{ matrix.os }}-${{ matrix.python }}
path: ${{ env.COVERAGE_FILES_PATH }}
retention-days: 7
- name: Save junit report
uses: actions/upload-artifact@v4
with:
name: junit-${{ matrix.os }}-${{ matrix.python }}
path: ${{ env.JUNIT_REPORT_PATH }}/junit-${{ matrix.os }}-${{ matrix.python }}.xml
retention-days: 7
coverage:
runs-on: ubuntu-latest
needs: test
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: pip
# FIXME: we should take dwas from pypi once it's published
- name: Install dwas
run: python -m pip install .
- name: Download generated coverage files
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: coverage-*
path: .dwas/cache
- name: Generate coverage report
run: dwas --verbose --only coverage
- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
files: ./_artifacts/coverage/coverage.xml
fail_ci_if_error: true
verbose: true
- name: Save coverage report
uses: actions/upload-artifact@v4
with:
name: coverage [html]
path: _artifacts/coverage/html
retention-days: 7
test-report:
runs-on: ubuntu-latest
needs: test
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install package dependencies
run: pip install tabulate
- name: Download junit reports
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: junit-*
path: reports/
- name: Generate summary
run: python .github/scripts/summary.py reports/*.xml > "${GITHUB_STEP_SUMMARY}"
twine:
runs-on: ubuntu-latest
needs: package
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: pip
- name: Download packaged dist
uses: actions/download-artifact@v4
with:
name: dist
path: ${{ env.PACKAGES_PATH }}
# FIXME: we should take dwas from pypi once it's published
- name: Install dwas
run: python -m pip install .
- name: Validate packages with twine
run: dwas --verbose --only twine:check