forked from python-hyper/hyperlink
-
Notifications
You must be signed in to change notification settings - Fork 0
238 lines (167 loc) Β· 4.98 KB
/
cicd.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
236
237
238
# Docs:
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions
name: CI/CD
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
info:
name: Workflow information
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Print GitHub Context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "${GITHUB_CONTEXT}";
- name: Print Job Context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "${JOB_CONTEXT}";
- name: Print Steps Context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "${STEPS_CONTEXT}";
- name: Print Runner Context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "${RUNNER_CONTEXT}";
- name: Print Strategy Context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "${STRATEGY_CONTEXT}";
- name: Print Matrix Context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "${MATRIX_CONTEXT}";
flake8:
name: Flake8 (linter)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: "3.9"
- name: Install Tox
run: pip install tox;
- name: Run Flake8
run: tox -e flake8;
black:
name: Black (linter)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: "3.9"
- name: Install Tox
run: pip install tox;
- name: Run Black
run: tox -e black;
mypy:
name: Mypy (static type checker)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: "3.9"
- name: Install Tox
run: pip install tox;
- name: Run Mypy
run: tox -e mypy;
docs:
name: Build documentation
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: "3.9"
- name: Install Tox
run: pip install tox;
- name: Build documentation
run: tox -e docs;
packaging:
name: Packaging
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: "3.9"
- name: Install Tox
run: pip install tox;
- name: Check packaging
run: tox -e packaging;
unit:
name: Unit Tests using Python ${{ matrix.python }} on Ubuntu
needs: [flake8, black, mypy, docs, packaging]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
python: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "pypy2", "pypy3"]
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install Tox
run: pip install tox;
- name: Run unit tests
shell: bash
# This hairy shell code is here to map the Python versions
# specified above to the equivalents used in Tox environments.
run: |
set -eux
py="${{ matrix.python }}";
if [[ $py =~ pypy ]]; then # PyPy
py_test="${py}";
else # CPython
py_test="py${py/./}"; # Add "py" prefix, remove "."
fi;
env_test="test-${py_test}-coverage_xml";
echo "Test environment: ${env_test}";
tox -e "${env_test}";
tar cvzf pytest-logs.tgz ".tox/${env_test}/log";
- name: Upload pytest log artifact
if: failure()
uses: actions/upload-artifact@v1
with:
name: pytest-logs
path: pytest-logs.tgz
# Use the latest supported Python version for combining coverage to
# prevent parsing errors in older versions when looking at modern code.
- uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v1"
with:
env_vars: GITHUB_REF,GITHUB_COMMIT,GITHUB_USER,GITHUB_WORKFLOW
fail_ci_if_error: true
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_COMMIT: ${{ github.sha }}
GITHUB_USER: ${{ github.actor }}
GITHUB_WORKFLOW: ${{ github.workflow }}