17
17
runs-on : ${{ matrix.os }}-latest
18
18
name : >-
19
19
e2e: 🐍${{ matrix.python }} @ ${{ matrix.os }}
20
+ needs :
21
+ - build
20
22
strategy :
21
23
matrix :
22
24
os : [macOS, Ubuntu]
@@ -25,40 +27,118 @@ jobs:
25
27
fail-fast : false
26
28
steps :
27
29
- uses : actions/checkout@v2
30
+ - name : Make the env clean of non-test files
31
+ run : |
32
+ shopt -s extglob
33
+ mv -v tests/integration/main.sh integration-test.sh
34
+ rm -rf !integration-test.sh
35
+ shell : bash
28
36
- name : Setup Python
29
37
uses : actions/setup-python@v2
30
38
with :
31
39
python-version : ${{ matrix.python }}
40
+ - name : Download all the dists
41
+ uses : actions/download-artifact@v2
42
+ with :
43
+ name : python-package-distributions
44
+ path : dist/
32
45
- name : Integration testing
33
46
run : |
34
- pip install -U pip
35
- pip install .
47
+ pip install dist/proxy.py-*-py3-none-any.whl
36
48
proxy \
37
49
--hostname 127.0.0.1 \
38
50
--enable-web-server \
39
51
--pid-file proxy.pid \
40
52
--log-file proxy.log \
41
53
&
42
- ./tests/integration/main.sh
54
+ ./integration-test.sh
55
+
56
+ build :
57
+ name : build-dists
58
+
59
+ runs-on : Ubuntu-latest
60
+
61
+ env :
62
+ PY_COLORS : 1
63
+ TOX_PARALLEL_NO_SPINNER : 1
64
+ TOXENV : cleanup-dists,build-dists
65
+
66
+ steps :
67
+ - name : Switch to using Python v3.10
68
+ uses : actions/setup-python@v2
69
+ with :
70
+ python-version : ' 3.10'
71
+ - name : >-
72
+ Calculate Python interpreter version hash value
73
+ for use in the cache key
74
+ id: calc-cache-key-py
75
+ run: |
76
+ from hashlib import sha512
77
+ from sys import version
78
+
79
+ hash = sha512(version.encode()).hexdigest()
80
+ print(f'::set-output name=py-hash-key::{hash}')
81
+ shell: python
82
+ - name : Get pip cache dir
83
+ id : pip-cache
84
+ run : >-
85
+ echo "::set-output name=dir::$(pip cache dir)"
86
+ - name : Set up pip cache
87
+
88
+ with :
89
+ path : ${{ steps.pip-cache.outputs.dir }}
90
+ key : >-
91
+ ${{ runner.os }}-pip-${{
92
+ steps.calc-cache-key-py.outputs.py-hash-key }}-${{
93
+ hashFiles('tox.ini') }}
94
+ restore-keys : |
95
+ ${{ runner.os }}-pip-${{
96
+ steps.calc-cache-key-py.outputs.py-hash-key
97
+ }}-
98
+ ${{ runner.os }}-pip-
99
+ - name : Install tox
100
+ run : >-
101
+ python -m
102
+ pip install
103
+ --user
104
+ tox
105
+
106
+ - name : Grab the source from Git
107
+ uses : actions/checkout@v2
108
+
109
+ - name : Pre-populate the tox env
110
+ run : >-
111
+ python -m
112
+ tox
113
+ --parallel auto
114
+ --parallel-live
115
+ --skip-missing-interpreters false
116
+ --notest
117
+ - name : Build dists
118
+ run : >-
119
+ python -m
120
+ tox
121
+ --parallel auto
122
+ --parallel-live
123
+ --skip-missing-interpreters false
124
+ - name : Store the distribution packages
125
+ uses : actions/upload-artifact@v2
126
+ with :
127
+ name : python-package-distributions
128
+ path : dist
129
+ retention-days : 30 # Defaults to 90
43
130
44
131
lint :
45
- name : >-
46
- ${{
47
- toJSON(matrix.custom_job_name)
48
- && matrix.custom_job_name
49
- || matrix.toxenv
50
- }}
132
+ name : ${{ matrix.toxenv }}
133
+ needs :
134
+ - build
51
135
52
136
runs-on : Ubuntu-latest
53
137
strategy :
54
138
matrix :
55
139
toxenv :
56
140
- lint
57
- custom_job_name :
58
- - ' '
59
- include :
60
- - custom_job_name : build-dists
61
- toxenv : cleanup-dists,build-dists,metadata-validation
141
+ - metadata-validation
62
142
fail-fast : false
63
143
64
144
env :
@@ -109,6 +189,19 @@ jobs:
109
189
- name : Grab the source from Git
110
190
uses : actions/checkout@v2
111
191
192
+ - name : Make the env clean of non-test files
193
+ if : matrix.toxenv == 'metadata-validation'
194
+ run : |
195
+ shopt -s extglob
196
+ rm -rf !tox.ini
197
+ shell : bash
198
+ - name : Download all the dists
199
+ if : matrix.toxenv == 'metadata-validation'
200
+ uses : actions/download-artifact@v2
201
+ with :
202
+ name : python-package-distributions
203
+ path : dist/
204
+
112
205
- name : >-
113
206
Pre-populate tox envs: `${{ env.TOXENV }}`
114
207
run: >-
@@ -129,6 +222,8 @@ jobs:
129
222
130
223
test :
131
224
name : 🐍${{ matrix.python }} @ ${{ matrix.os }}
225
+ needs :
226
+ - build
132
227
133
228
runs-on : ${{ matrix.os }}-latest
134
229
strategy :
@@ -198,21 +293,30 @@ jobs:
198
293
- name : Grab the source from Git
199
294
uses : actions/checkout@v2
200
295
296
+ - name : Download all the dists
297
+ uses : actions/download-artifact@v2
298
+ with :
299
+ name : python-package-distributions
300
+ path : dist/
301
+
201
302
- name : Pre-populate the testing env
202
303
run : >-
203
304
python -m
204
305
tox
205
306
--parallel auto
206
307
--parallel-live
207
308
--skip-missing-interpreters false
309
+ --installpkg dist/proxy.py-*-py3-none-any.whl
208
310
--notest
311
+ shell : bash
209
312
- name : Run the testing
210
313
run : >-
211
314
python -m
212
315
tox
213
316
--parallel auto
214
317
--parallel-live
215
318
--skip-missing-interpreters false
319
+ --skip-pkg-install
216
320
- name : Upload coverage to Codecov
217
321
uses : codecov/codecov-action@v2
218
322
with :
0 commit comments