-
-
Notifications
You must be signed in to change notification settings - Fork 205
313 lines (275 loc) · 12.5 KB
/
ci.yaml
File metadata and controls
313 lines (275 loc) · 12.5 KB
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
name: CI
on:
pull_request:
workflow_call:
inputs:
build-number:
description: "The build number to add to the built package"
default: "custom"
type: "string"
outputs:
PYTHON_VER:
description: "The Python major.minor version."
value: ${{ jobs.config.outputs.PYTHON_VER }}
PYTHON_VERSION:
description: "The full Python version."
value: ${{ jobs.config.outputs.PYTHON_VERSION }}
BZIP2_VERSION:
description: "The BZip2 version used for the build."
value: ${{ jobs.config.outputs.BZIP2_VERSION }}
LIBFFI_VERSION:
description: "The libFFI version used for the build."
value: ${{ jobs.config.outputs.LIBFFI_VERSION }}
MPDECIMAL_VERSION:
description: "The mpdecimal version used for the build."
value: ${{ jobs.config.outputs.MPDECIMAL_VERSION }}
OPENSSL_VERSION:
description: "The OpenSSL version used for the build."
value: ${{ jobs.config.outputs.OPENSSL_VERSION }}
XZ_VERSION:
description: "The XZ version used for the build."
value: ${{ jobs.config.outputs.XZ_VERSION }}
ZSTD_VERSION:
description: "The Zstandard version used for the build."
value: ${{ jobs.config.outputs.ZSTD_VERSION }}
env:
FORCE_COLOR: "1"
defaults:
run:
shell: bash
# Cancel active CI runs for a PR before starting another run
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
config:
runs-on: macOS-latest
outputs:
PYTHON_VER: ${{ steps.extract.outputs.PYTHON_VER }}
PYTHON_VERSION: ${{ steps.extract.outputs.PYTHON_VERSION }}
BUILD_NUMBER: ${{ steps.extract.outputs.BUILD_NUMBER }}
BZIP2_VERSION: ${{ steps.extract.outputs.BZIP2_VERSION }}
LIBFFI_VERSION: ${{ steps.extract.outputs.LIBFFI_VERSION }}
MPDECIMAL_VERSION: ${{ steps.extract.outputs.MPDECIMAL_VERSION }}
OPENSSL_VERSION: ${{ steps.extract.outputs.OPENSSL_VERSION }}
XZ_VERSION: ${{ steps.extract.outputs.XZ_VERSION }}
ZSTD_VERSION: ${{ steps.extract.outputs.ZSTD_VERSION }}
steps:
- uses: actions/checkout@v6
- name: Extract config variables
id: extract
run: |
PYTHON_VER=$(make config | grep "PYTHON_VER=" | cut -d "=" -f 2)
PYTHON_VERSION=$(make config | grep "PYTHON_VERSION=" | cut -d "=" -f 2)
BZIP2_VERSION=$(make config | grep "BZIP2_VERSION=" | cut -d "=" -f 2)
LIBFFI_VERSION=$(make config | grep "LIBFFI_VERSION=" | cut -d "=" -f 2)
MPDECIMAL_VERSION=$(make config | grep "MPDECIMAL_VERSION=" | cut -d "=" -f 2)
OPENSSL_VERSION=$(make config | grep "OPENSSL_VERSION=" | cut -d "=" -f 2)
XZ_VERSION=$(make config | grep "XZ_VERSION=" | cut -d "=" -f 2)
ZSTD_VERSION=$(make config | grep "ZSTD_VERSION=" | cut -d "=" -f 2)
if [ -z "${{ inputs.build-number }}" ]; then
BUILD_NUMBER=custom
else
BUILD_NUMBER=${{ inputs.build-number }}
fi
echo "PYTHON_VER=${PYTHON_VER}" | tee -a ${GITHUB_OUTPUT}
echo "PYTHON_VERSION=${PYTHON_VERSION}" | tee -a ${GITHUB_OUTPUT}
echo "BUILD_NUMBER=${BUILD_NUMBER}" | tee -a ${GITHUB_OUTPUT}
echo "BZIP2_VERSION=${BZIP2_VERSION}" | tee -a ${GITHUB_OUTPUT}
echo "LIBFFI_VERSION=${LIBFFI_VERSION}" | tee -a ${GITHUB_OUTPUT}
echo "MPDECIMAL_VERSION=${MPDECIMAL_VERSION}" | tee -a ${GITHUB_OUTPUT}
echo "OPENSSL_VERSION=${OPENSSL_VERSION}" | tee -a ${GITHUB_OUTPUT}
echo "XZ_VERSION=${XZ_VERSION}" | tee -a ${GITHUB_OUTPUT}
echo "ZSTD_VERSION=${ZSTD_VERSION}" | tee -a ${GITHUB_OUTPUT}
build:
runs-on: macOS-15
needs: [ config ]
strategy:
fail-fast: false
matrix:
platform: ['macOS', 'iOS', 'tvOS', 'watchOS', 'visionOS']
steps:
- uses: actions/checkout@v6
- name: Set up Xcode
# GitHub recommends explicitly selecting the desired Xcode version:
# https://github.com/actions/runner-images/issues/12541#issuecomment-3083850140
# This became a necessity as a result of
# https://github.com/actions/runner-images/issues/12541 and
# https://github.com/actions/runner-images/issues/12751.
run: |
sudo xcode-select --switch /Applications/Xcode_16.4.app
- name: Set up Python
uses: actions/setup-python@v6.2.0
with:
# Appending -dev ensures that we can always build the dev release.
# It's a no-op for versions that have been published.
python-version: ${{ needs.config.outputs.PYTHON_VER }}-dev
# Ensure that we *always* use the latest build, not a cached version.
# It's an edge case, but when a new alpha is released, we need to use it ASAP.
check-latest: true
- name: Build ${{ matrix.platform }}
run: |
# Do the build for the requested platform.
make ${{ matrix.platform }} BUILD_NUMBER=${{ needs.config.outputs.BUILD_NUMBER }}
- name: Upload build artefacts
uses: actions/upload-artifact@v7.0.0
with:
name: Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
path: dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
briefcase-testbed:
name: Briefcase testbed (${{ matrix.platform }})
runs-on: macOS-15
needs: [ config, build ]
strategy:
fail-fast: false
matrix:
platform: ["macOS", "iOS"]
include:
- briefcase-run-args:
- platform: iOS
briefcase-run-args: ' -d "iPhone 16e::iOS 18.5"'
steps:
- uses: actions/checkout@v6
- name: Set up Xcode
# GitHub recommends explicitly selecting the desired Xcode version:
# https://github.com/actions/runner-images/issues/12541#issuecomment-3083850140
# This became a necessity as a result of
# https://github.com/actions/runner-images/issues/12541 and
# https://github.com/actions/runner-images/issues/12751.
run: |
sudo xcode-select --switch /Applications/Xcode_16.4.app
- name: Get build artifact
uses: actions/download-artifact@v8.0.0
with:
pattern: Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
path: dist
merge-multiple: true
- name: Set up Python
uses: actions/setup-python@v6.2.0
with:
# Appending -dev ensures that we can always build the dev release.
# It's a no-op for versions that have been published.
python-version: ${{ needs.config.outputs.PYTHON_VER }}-dev
# Ensure that we *always* use the latest build, not a cached version.
# It's an edge case, but when a new alpha is released, we need to use it ASAP.
check-latest: true
- uses: actions/checkout@v6
with:
repository: beeware/Python-support-testbed
path: Python-support-testbed
- name: Install dependencies
run: |
# Use the development version of Briefcase
python -m pip install git+https://github.com/beeware/briefcase.git
- name: Run support testbed check
timeout-minutes: 15
working-directory: Python-support-testbed
run: briefcase run ${{ matrix.platform }} Xcode --test ${{ matrix.briefcase-run-args }} -C support_package=\'../dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz\'
cpython-testbed:
name: CPython testbed (${{ matrix.platform }})
runs-on: macOS-15
needs: [ config, build ]
strategy:
fail-fast: false
matrix:
platform: ["iOS", "tvOS", "visionOS"]
include:
- platform: "iOS"
testbed-args: '--simulator "iPhone 16e,arch=arm64,OS=18.5"'
- platform: "visionOS"
testbed-args: '--simulator "Apple Vision Pro,arch=arm64,OS=2.5"'
steps:
- uses: actions/checkout@v6
- name: Get build artifact
uses: actions/download-artifact@v8.0.0
with:
pattern: Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
path: dist
merge-multiple: true
- name: Set up Xcode
# GitHub recommends explicitly selecting the desired Xcode version:
# https://github.com/actions/runner-images/issues/12541#issuecomment-3083850140
# This became a necessity as a result of
# https://github.com/actions/runner-images/issues/12541 and
# https://github.com/actions/runner-images/issues/12751.
run: |
sudo xcode-select --switch /Applications/Xcode_16.4.app
- name: Set up Python
uses: actions/setup-python@v6.2.0
with:
# Appending -dev ensures that we can always build the dev release.
# It's a no-op for versions that have been published.
python-version: ${{ needs.config.outputs.PYTHON_VER }}-dev
# Ensure that we *always* use the latest build, not a cached version.
# It's an edge case, but when a new alpha is released, we need to use it ASAP.
check-latest: true
- name: Unpack support package
run: |
mkdir -p support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}
cd support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}
tar zxvf ../../../dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
- name: Run CPython testbed
timeout-minutes: 15
working-directory: support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}
run: |
# Run a representative subset of CPython core tests:
# - test_builtin as a test of core language tools
# - test_grammar as a test of core language features
# - test_os as a test of system library calls
# - test_bz2 as a simple test of third party libraries
# - test_ctypes as a test of FFI
python -m testbed run --verbose ${{ matrix.testbed-args }} -- test --single-process --rerun -W test_builtin test_grammar test_os test_bz2 test_ctypes
crossenv-test:
name: Cross-platform env test (${{ matrix.multiarch }})
runs-on: macOS-latest
needs: [ config, build ]
strategy:
fail-fast: false
matrix:
include:
- platform: iOS
slice: ios-arm64_x86_64-simulator
multiarch: arm64-iphonesimulator
- platform: iOS
slice: ios-arm64_x86_64-simulator
multiarch: x86_64-iphonesimulator
- platform: iOS
slice: ios-arm64
multiarch: arm64-iphoneos
steps:
- uses: actions/checkout@v6
- name: Get build artifact
uses: actions/download-artifact@v8.0.0
with:
pattern: Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
path: dist
merge-multiple: true
- name: Set up Python
uses: actions/setup-python@v6.2.0
with:
# Appending -dev ensures that we can always build the dev release.
# It's a no-op for versions that have been published.
python-version: ${{ needs.config.outputs.PYTHON_VER }}-dev
# Ensure that we *always* use the latest build, not a cached version.
# It's an edge case, but when a new alpha is released, we need to use it ASAP.
check-latest: true
- name: Unpack support package
run: |
mkdir -p support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}
cd support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}
tar zxvf ../../../dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
- name: Run cross-platform environment test
env:
PYTHON_CROSS_PLATFORM: ${{ matrix.platform }}
PYTHON_CROSS_SLICE: ${{ matrix.slice }}
PYTHON_CROSS_MULTIARCH: ${{ matrix.multiarch }}
run: |
# Create and activate a native virtual environment
python${{ needs.config.outputs.PYTHON_VER }} -m venv cross-venv
source cross-venv/bin/activate
# Install pytest
python -m pip install pytest
# Convert venv into cross-venv
python support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}/Python.xcframework/${{ matrix.slice }}/platform-config/${{ matrix.multiarch }}/make_cross_venv.py cross-venv
# Run the test suite
python -m pytest tests