-
-
Notifications
You must be signed in to change notification settings - Fork 261
406 lines (406 loc) · 15.2 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
name: CI
on: [push, pull_request]
defaults:
run:
shell: bash
env:
_PEX_TEST_PYENV_ROOT: .pyenv_test
# We use this to skip exposing same-versioned Pythons present on Linux hosts. These otherwise can
# collide when attempting to load libpython<major>.<minor><flags>.so and lead to mysterious errors
# importing builtins like `fcntl` as outlined in https://github.com/pantsbuild/pex/issues/1391.
_PEX_TEST_PYENV_VERSIONS: "2.7 3.7 3.10"
concurrency:
group: CI-${{ github.ref }}
# Queue on all branches and tags, but only cancel overlapping PR burns.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' || !startsWith(github.ref, 'refs/tags/') }}
jobs:
org-check:
name: Check GitHub Organization
if: github.repository_owner == 'pantsbuild'
runs-on: ubuntu-22.04
steps:
- name: Noop
run: "true"
checks:
name: TOXENV=format-check,typecheck,vendor-check,package -- --additional-format sdist --additional-format wheel
needs: org-check
runs-on: ubuntu-22.04
steps:
- name: Checkout Pex
uses: actions/checkout@v3
with:
# We need branches and tags since package leans on `git describe`. Passing 0 gets us
# complete history.
fetch-depth: 0
- name: Setup Python 3.8
uses: actions/setup-python@v4
with:
# We need to keep Python 3.8 for consistent vendoring with tox.
python-version: "3.8"
- name: Check Formatting, Types, Vendoring and Packaging
uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
tox-env: format-check,typecheck,vendor-check,package -- --additional-format sdist --additional-format wheel
cpython-unit-tests:
name: (${{ matrix.os }}) Pip ${{ matrix.pip-version }} TOXENV=py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}
needs: org-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-12
python-version: [ 3, 11 ]
pip-version: 20
tox-env-python: python
- os: ubuntu-22.04
python-version: [ 3, 11 ]
pip-version: 20
tox-env-python: python
- os: ubuntu-22.04
python-version: [ 3, 11 ]
pip-version: 22_3_1
tox-env-python: python
- os: ubuntu-22.04
python-version: [ 3, 11 ]
pip-version: 23_1_2
tox-env-python: python
- os: macos-12
python-version: [ 3, 12, "0-beta.4" ]
pip-version: 23_2
tox-env-python: python3.11
- os: ubuntu-22.04
python-version: [ 3, 12, "0-beta.4" ]
pip-version: 23_2
tox-env-python: python3.11
steps:
- name: Calculate Pythons to Expose
id: calculate-pythons-to-expose
run: |
skip=""
if [[ "$(uname -s)" == "Linux" ]]; then
skip="${{ env._PEX_TEST_PYENV_VERSIONS }}"
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
- name: Checkout Pex
uses: actions/checkout@v3
- name: Setup Python ${{ join(matrix.python-version, '.') }}
uses: actions/setup-python@v4
with:
python-version: "${{ join(matrix.python-version, '.') }}"
- name: Expose Pythons
uses: pantsbuild/actions/expose-pythons@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
skip: "${{ steps.calculate-pythons-to-expose.outputs.skip }}"
- name: Cache Pyenv Interpreters
uses: actions/cache@v3
with:
path: ${{ env._PEX_TEST_PYENV_ROOT }}
key: ${{ matrix.os }}-${{ runner.arch }}-pyenv-root-v1
- name: Run Unit Tests
uses: pantsbuild/actions/run-tox@addae8ed8cce2b0a359f447d1bb2ec69ff18f9ca
with:
python: ${{ matrix.tox-env-python }}
tox-env: py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}-pip${{ matrix.pip-version }}
cpython-unit-tests-legacy:
name: (${{ matrix.os }}) Pip ${{ matrix.pip-version }} TOXENV=py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}
needs: org-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-12
python-version: [ 2, 7, 18 ]
pip-version: 20
- os: ubuntu-22.04
python-version: [ 2, 7, 18 ]
pip-version: 20
# Ubuntu 20.04 is required to avoid inscrutable errors with Python 3.5 trying to use
# python3.10 libpython.so.
- os: ubuntu-20.04
python-version: [ 3, 5, 10 ]
pip-version: 20
steps:
- name: Calculate Pythons to Expose
id: calculate-pythons-to-expose
run: |
skip=""
if [[ "$(uname -s)" == "Linux" ]]; then
skip="${{ env._PEX_TEST_PYENV_VERSIONS }}"
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
- name: Checkout Pex
uses: actions/checkout@v3
- name: Setup Python ${{ join(matrix.python-version, '.') }}
uses: pantsbuild/actions/pyenv@1356087bfd1be04670c2ffde4ba94a9c6898ecd7
with:
python-version: "${{ join(matrix.python-version, '.') }}"
- name: Expose Pythons
uses: pantsbuild/actions/expose-pythons@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
skip: "${{ steps.calculate-pythons-to-expose.outputs.skip }}"
- name: Cache Pyenv Interpreters
uses: actions/cache@v3
with:
path: ${{ env._PEX_TEST_PYENV_ROOT }}
key: ${{ matrix.os }}-${{ runner.arch }}-pyenv-root-v1
- name: Run Unit Tests
run: |
pip install -U tox
tox -e py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}-pip${{ matrix.pip-version }}
pypy-unit-tests:
name: (PyPy ${{ join(matrix.pypy-version, '.') }}) Pip ${{ matrix.pip-version }} TOXENV=pypy${{ join(matrix.pypy-version, '') }}
needs: org-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# N.B.: We need 20.04 for PyPy 2.7 tool cache support.
- os: ubuntu-20.04
pypy-version: [ 2, 7 ]
pip-version: 20
- os: ubuntu-22.04
pypy-version: [ 3, 9 ]
pip-version: 20
- os: ubuntu-22.04
pypy-version: [ 3, 9 ]
pip-version: 22_3_1
- os: ubuntu-22.04
pypy-version: [ 3, 9 ]
pip-version: 23_1_2
steps:
- name: Calculate Pythons to Expose
id: calculate-pythons-to-expose
run: |
skip=""
if [[ "$(uname -s)" == "Linux" ]]; then
skip="${{ env._PEX_TEST_PYENV_VERSIONS }}"
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
- name: Checkout Pex
uses: actions/checkout@v3
- name: Setup PyPy ${{ join(matrix.pypy-version, '.') }}
uses: actions/setup-python@v4
with:
python-version: "pypy-${{ join(matrix.pypy-version, '.') }}"
- name: Expose Pythons
uses: pantsbuild/actions/expose-pythons@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
skip: "${{ steps.calculate-pythons-to-expose.outputs.skip }}"
- name: Cache Pyenv Interpreters
uses: actions/cache@v3
with:
path: ${{ env._PEX_TEST_PYENV_ROOT }}
key: ${{ matrix.os }}-${{ runner.arch }}-pyenv-root-v1
- name: Run Unit Tests
uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
tox-env: pypy${{ join(matrix.pypy-version, '') }}-pip${{ matrix.pip-version }}
cpython-integration-tests:
name: (${{ matrix.os }}) Pip ${{ matrix.pip-version }} TOXENV=py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}-integration
needs: org-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-12
python-version: [ 3, 11 ]
pip-version: 20
tox-env-python: python
- os: ubuntu-22.04
python-version: [ 3, 11 ]
pip-version: 20
tox-env-python: python
- os: ubuntu-22.04
python-version: [ 3, 11 ]
pip-version: 22_3_1
tox-env-python: python
- os: ubuntu-22.04
python-version: [ 3, 11 ]
pip-version: 23_1_2
tox-env-python: python
- os: macos-12
python-version: [ 3, 12, "0-beta.4" ]
pip-version: 23_2
tox-env-python: python3.11
- os: ubuntu-22.04
python-version: [ 3, 12, "0-beta.4" ]
pip-version: 23_2
tox-env-python: python3.11
steps:
- name: Calculate Pythons to Expose
id: calculate-pythons-to-expose
run: |
skip=""
if [[ "$(uname -s)" == "Linux" ]]; then
skip="${{ env._PEX_TEST_PYENV_VERSIONS }}"
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
- name: Checkout Pex
uses: actions/checkout@v3
with:
# We need branches and tags for some ITs.
fetch-depth: 0
- name: Setup Python ${{ join(matrix.python-version, '.') }}
uses: actions/setup-python@v4
with:
python-version: "${{ join(matrix.python-version, '.') }}"
- name: Expose Pythons
uses: pantsbuild/actions/expose-pythons@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
skip: "${{ steps.calculate-pythons-to-expose.outputs.skip }}"
- name: Cache Pyenv Interpreters
uses: actions/cache@v3
with:
path: ${{ env._PEX_TEST_PYENV_ROOT }}
key: ${{ matrix.os }}-${{ runner.arch }}-pyenv-root-v1
- name: Setup SSH Agent
uses: webfactory/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
if: env.SSH_PRIVATE_KEY != ''
with:
ssh-private-key: ${{ env.SSH_PRIVATE_KEY }}
- name: Run Integration Tests
uses: pantsbuild/actions/run-tox@addae8ed8cce2b0a359f447d1bb2ec69ff18f9ca
with:
python: ${{ matrix.tox-env-python }}
tox-env: py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}-pip${{ matrix.pip-version }}-integration
cpython-integration-tests-legacy:
name: (${{ matrix.os }}) Pip ${{ matrix.pip-version }} TOXENV=py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}-integration
needs: org-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-12
python-version: [ 2, 7, 18 ]
pip-version: 20
- os: ubuntu-22.04
python-version: [ 2, 7, 18 ]
pip-version: 20
- os: ubuntu-22.04
python-version: [ 3, 7, 17 ]
pip-version: 22_3_1
- os: ubuntu-22.04
python-version: [ 3, 7, 17 ]
pip-version: 23_1_2
steps:
- name: Calculate Pythons to Expose
id: calculate-pythons-to-expose
run: |
skip=""
if [[ "$(uname -s)" == "Linux" ]]; then
skip="${{ env._PEX_TEST_PYENV_VERSIONS }}"
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
- name: Checkout Pex
uses: actions/checkout@v3
with:
# We need branches and tags for some ITs.
fetch-depth: 0
- name: Setup Python ${{ join(matrix.python-version, '.') }}
uses: pantsbuild/actions/pyenv@1356087bfd1be04670c2ffde4ba94a9c6898ecd7
with:
python-version: "${{ join(matrix.python-version, '.') }}"
- name: Expose Pythons
uses: pantsbuild/actions/expose-pythons@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
skip: "${{ steps.calculate-pythons-to-expose.outputs.skip }}"
- name: Cache Pyenv Interpreters
uses: actions/cache@v3
with:
path: ${{ env._PEX_TEST_PYENV_ROOT }}
key: ${{ matrix.os }}-${{ runner.arch }}-pyenv-root-v1
- name: Setup SSH Agent
uses: webfactory/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
if: env.SSH_PRIVATE_KEY != ''
with:
ssh-private-key: ${{ env.SSH_PRIVATE_KEY }}
- name: Run Integration Tests
run: |
pip install -U tox
tox -e py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}-pip${{ matrix.pip-version }}-integration
pypy-integration-tests:
name: (PyPy ${{ join(matrix.pypy-version, '.') }}) Pip ${{ matrix.pip-version }} TOXENV=pypy${{ join(matrix.pypy-version, '') }}-integration
needs: org-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# N.B.: We need 20.04 for PyPy 2.7 tool cache support.
- os: ubuntu-20.04
pypy-version: [ 2, 7 ]
pip-version: 20
- os: ubuntu-22.04
pypy-version: [ 3, 9 ]
pip-version: 20
- os: ubuntu-22.04
pypy-version: [ 3, 9 ]
pip-version: 22_3_1
- os: ubuntu-22.04
pypy-version: [ 3, 9 ]
pip-version: 23_1_2
steps:
- name: Calculate Pythons to Expose
id: calculate-pythons-to-expose
run: |
skip=""
if [[ "$(uname -s)" == "Linux" ]]; then
skip="${{ env._PEX_TEST_PYENV_VERSIONS }}"
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
- name: Checkout Pex
uses: actions/checkout@v3
with:
# We need branches and tags for some ITs.
fetch-depth: 0
- name: Setup PyPy ${{ join(matrix.pypy-version, '.') }}
uses: actions/setup-python@v4
with:
python-version: "pypy-${{ join(matrix.pypy-version, '.') }}"
- name: Expose Pythons
uses: pantsbuild/actions/expose-pythons@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
skip: "${{ steps.calculate-pythons-to-expose.outputs.skip }}"
- name: Install Packages
run: |
# This is needed for `test_requirement_file_from_url` for building `lxml`.
sudo apt install --yes libxslt-dev
- name: Cache Pyenv Interpreters
uses: actions/cache@v3
with:
path: ${{ env._PEX_TEST_PYENV_ROOT }}
key: ${{ matrix.os }}-${{ runner.arch }}-pyenv-root-v1
- name: Setup SSH Agent
uses: webfactory/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
if: env.SSH_PRIVATE_KEY != ''
with:
ssh-private-key: ${{ env.SSH_PRIVATE_KEY }}
- name: Run Integration Tests
uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
tox-env: pypy${{ join(matrix.pypy-version, '') }}-pip${{ matrix.pip-version }}-integration
final-status:
name: Gather Final Status
needs:
- checks
- cpython-unit-tests
- cpython-unit-tests-legacy
- pypy-unit-tests
- cpython-integration-tests
- cpython-integration-tests-legacy
- pypy-integration-tests
runs-on: ubuntu-22.04
steps:
- name: Check Non-Success
if: |
contains(needs.*.result, 'cancelled') ||
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'skipped')
run: "false"
- name: Success
run: "true"