Skip to content

Commit bd0e892

Browse files
committed
ci: use explicit list parameters in job matrix
I think this syntax is cleaner. As part of this, we dropped some Python 3.10 builds because those are alpha at the moment and I don't think they are too important.
1 parent e7b5dd0 commit bd0e892

File tree

2 files changed

+205
-112
lines changed

2 files changed

+205
-112
lines changed

.github/workflows/apple.yml

Lines changed: 67 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -116,45 +116,72 @@ jobs:
116116
strategy:
117117
fail-fast: false
118118
matrix:
119-
triple:
120-
- 'aarch64-apple-darwin'
121-
- 'aarch64-apple-ios'
122-
- 'x86_64-apple-darwin'
123-
- 'x86_64-apple-ios'
124-
py:
125-
- 'cpython-3.8'
126-
- 'cpython-3.9'
127-
optimizations:
128-
- 'debug'
129-
- 'noopt'
130-
- 'lto'
131-
- 'pgo'
132-
- 'pgo+lto'
133-
exclude:
134-
# Cross-compiling only supported by CPython 3.9+.
135-
- triple: 'aarch64-apple-darwin'
119+
build:
120+
# macOS on Apple hardware. Can't do PGO because GitHub Apple hardware
121+
# is Intel. Can't do Python 3.8 because we don't support cross-compiling
122+
# until 3.9.
123+
- target_triple: 'aarch64-apple-darwin'
124+
py: 'cpython-3.9'
125+
optimizations: 'debug'
126+
- target_triple: 'aarch64-apple-darwin'
127+
py: 'cpython-3.9'
128+
optimizations: 'noopt'
129+
- target_triple: 'aarch64-apple-darwin'
130+
py: 'cpython-3.9'
131+
optimizations: 'lto'
132+
133+
# macOS on Intel hardware. This is pretty straightforward. We exclude
134+
# noopt because it doesn't provide any compelling advantages over PGO
135+
# or LTO builds.
136+
- target_triple: 'x86_64-apple-darwin'
136137
py: 'cpython-3.8'
137-
- triple: 'aarch64-apple-ios'
138+
optimizations: 'debug'
139+
- target_triple: 'x86_64-apple-darwin'
138140
py: 'cpython-3.8'
139-
- triple: 'x86_64-apple-ios'
141+
optimizations: 'lto'
142+
- target_triple: 'x86_64-apple-darwin'
140143
py: 'cpython-3.8'
141-
# PGO doesn't work when cross-compiling. Goal with following
142-
# rules is to disable PGO when cross-compiling and disable noopt
143-
# for host builds (since PGO is superior).
144-
- triple: 'aarch64-apple-darwin'
145144
optimizations: 'pgo'
146-
- triple: 'aarch64-apple-darwin'
145+
- target_triple: 'x86_64-apple-darwin'
146+
py: 'cpython-3.8'
147147
optimizations: 'pgo+lto'
148-
- triple: 'aarch64-apple-ios'
148+
149+
- target_triple: 'x86_64-apple-darwin'
150+
py: 'cpython-3.9'
151+
optimizations: 'debug'
152+
- target_triple: 'x86_64-apple-darwin'
153+
py: 'cpython-3.9'
154+
optimizations: 'lto'
155+
- target_triple: 'x86_64-apple-darwin'
156+
py: 'cpython-3.9'
149157
optimizations: 'pgo'
150-
- triple: 'aarch64-apple-ios'
158+
- target_triple: 'x86_64-apple-darwin'
159+
py: 'cpython-3.9'
151160
optimizations: 'pgo+lto'
152-
- triple: 'x86_64-apple-darwin'
161+
162+
# iOS targeting mobile hardware. Can't do PGO during cross-compiles.
163+
# Can't cross-compile until Python 3.9.
164+
- target_triple: 'aarch64-apple-ios'
165+
py: 'cpython-3.9'
166+
optimizations: 'debug'
167+
- target_triple: 'aarch64-apple-ios'
168+
py: 'cpython-3.9'
153169
optimizations: 'noopt'
154-
- triple: 'x86_64-apple-ios'
155-
optimizations: 'pgo'
156-
- triple: 'x86_64-apple-ios'
157-
optimizations: 'pgo+lto'
170+
- target_triple: 'aarch64-apple-ios'
171+
py: 'cpython-3.9'
172+
optimizations: 'lto'
173+
174+
# iOS targeting simulator. Can't do PGO during cross-compiles.
175+
# Can't cross-compile until Python 3.9.
176+
- target_triple: 'x86_64-apple-ios'
177+
py: 'cpython-3.9'
178+
optimizations: 'debug'
179+
- target_triple: 'x86_64-apple-ios'
180+
py: 'cpython-3.9'
181+
optimizations: 'noopt'
182+
- target_triple: 'x86_64-apple-ios'
183+
py: 'cpython-3.9'
184+
optimizations: 'lto'
158185
needs:
159186
- pythonbuild
160187
- toolchain
@@ -193,33 +220,33 @@ jobs:
193220
#
194221
# We work around this by using the 10.15 SDK from Xcode 11.3.1, which doesn't
195222
# have the bug.
196-
if [ "${{ matrix.py }}" = "cpython-3.8" ]; then
223+
if [ "${{ matrix.build.py }}" = "cpython-3.8" ]; then
197224
export APPLE_SDK_PATH=/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
198225
export APPLE_HOST_SDK_PATH=/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
199226
else
200227
export APPLE_HOST_SDK_PATH=/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk
201228
202-
if [ "${{ matrix.triple }}" = "aarch64-apple-darwin" ]; then
229+
if [ "${{ matrix.build.target_triple }}" = "aarch64-apple-darwin" ]; then
203230
export APPLE_SDK_PATH=/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk
204-
elif [ "${{ matrix.triple }}" = "aarch64-apple-ios" ]; then
231+
elif [ "${{ matrix.build.target_triple }}" = "aarch64-apple-ios" ]; then
205232
export APPLE_SDK_PATH=/Applications/Xcode_12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk
206-
elif [ "${{ matrix.triple }}" = "x86_64-apple-darwin" ]; then
233+
elif [ "${{ matrix.build.target_triple }}" = "x86_64-apple-darwin" ]; then
207234
export APPLE_SDK_PATH=/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk
208-
elif [ "${{ matrix.triple }}" = "x86_64-apple-ios" ]; then
235+
elif [ "${{ matrix.build.target_triple }}" = "x86_64-apple-ios" ]; then
209236
export APPLE_SDK_PATH=/Applications/Xcode_12.4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk
210237
else
211-
echo "unhandled target triple: ${{ matrix.triple }}"
238+
echo "unhandled target triple: ${{ matrix.build.target_triple }}"
212239
exit 1
213240
fi
214241
fi
215242
216-
./build-macos.py --skip-toolchain --target-triple ${{ matrix.triple }} --python ${{ matrix.py }} --optimizations ${{ matrix.optimizations }}
243+
./build-macos.py --skip-toolchain --target-triple ${{ matrix.build.target_triple }} --python ${{ matrix.build.py }} --optimizations ${{ matrix.build.optimizations }}
217244
218245
- name: Validate Distribution
219246
run: |
220247
chmod +x build/pythonbuild
221248
222-
if [ "${{matrix.triple }}" = "x86_64-apple-darwin" ]; then
249+
if [ "${{matrix.build.target_triple }}" = "x86_64-apple-darwin" ]; then
223250
EXTRA_ARGS="--run"
224251
fi
225252
@@ -228,5 +255,5 @@ jobs:
228255
- name: Upload Distributions
229256
uses: actions/upload-artifact@v2
230257
with:
231-
name: ${{ matrix.py }}-${{ matrix.triple }}
258+
name: ${{ matrix.build.py }}-${{ matrix.build.target_triple }}
232259
path: dist/*

.github/workflows/linux.yml

Lines changed: 138 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -122,88 +122,154 @@ jobs:
122122
strategy:
123123
fail-fast: false
124124
matrix:
125-
triple:
126-
- 'aarch64-unknown-linux-gnu'
127-
- 'armv7-unknown-linux-gnueabi'
128-
- 'armv7-unknown-linux-gnueabihf'
129-
- 'i686-unknown-linux-gnu'
130-
- 'mips-unknown-linux-gnu'
131-
- 'mipsel-unknown-linux-gnu'
132-
- 's390x-unknown-linux-gnu'
133-
- 'x86_64-unknown-linux-gnu'
134-
- 'x86_64-unknown-linux-musl'
135-
py:
136-
- 'cpython-3.8'
137-
- 'cpython-3.9'
138-
- 'cpython-3.10'
139-
optimizations:
140-
- 'debug'
141-
- 'noopt'
142-
- 'lto'
143-
- 'pgo'
144-
- 'pgo+lto'
145-
exclude:
146-
# Only CPython 3.9 supported for many cross build targets.
147-
- triple: 'aarch64-unknown-linux-gnu'
148-
py: 'cpython-3.8'
149-
- triple: 'aarch64-unknown-linux-gnu'
150-
py: 'cpython-3.10'
151-
- triple: 'armv7-unknown-linux-gnueabi'
152-
py: 'cpython-3.8'
153-
- triple: 'armv7-unknown-linux-gnueabi'
154-
py: 'cpython-3.10'
155-
- triple: 'armv7-unknown-linux-gnueabihf'
156-
py: 'cpython-3.8'
157-
- triple: 'armv7-unknown-linux-gnueabihf'
158-
py: 'cpython-3.10'
159-
- triple: 'mips-unknown-linux-gnu'
125+
build:
126+
# Cross-compiles can't do PGO and require Python 3.9.
127+
- target_triple: 'aarch64-unknown-linux-gnu'
128+
py: 'cpython-3.9'
129+
optimizations: 'debug'
130+
- target_triple: 'aarch64-unknown-linux-gnu'
131+
py: 'cpython-3.9'
132+
optimizations: 'noopt'
133+
- target_triple: 'aarch64-unknown-linux-gnu'
134+
py: 'cpython-3.9'
135+
optimizations: 'lto'
136+
137+
# Cross-compiles can't do PGO and require Python 3.9.
138+
- target_triple: 'armv7-unknown-linux-gnueabi'
139+
py: 'cpython-3.9'
140+
optimizations: 'debug'
141+
- target_triple: 'armv7-unknown-linux-gnueabi'
142+
py: 'cpython-3.9'
143+
optimizations: 'noopt'
144+
- target_triple: 'armv7-unknown-linux-gnueabi'
145+
py: 'cpython-3.9'
146+
optimizations: 'lto'
147+
148+
# Cross-compiles can't do PGO and require Python 3.9.
149+
- target_triple: 'armv7-unknown-linux-gnueabihf'
150+
py: 'cpython-3.9'
151+
optimizations: 'debug'
152+
- target_triple: 'armv7-unknown-linux-gnueabihf'
153+
py: 'cpython-3.9'
154+
optimizations: 'noopt'
155+
- target_triple: 'armv7-unknown-linux-gnueabihf'
156+
py: 'cpython-3.9'
157+
optimizations: 'lto'
158+
159+
# We don't publish noopt builds when PGO is available.
160+
- target_triple: 'i686-unknown-linux-gnu'
160161
py: 'cpython-3.8'
161-
- triple: 'mips-unknown-linux-gnu'
162-
py: 'cpython-3.10'
163-
- triple: 'mipsel-unknown-linux-gnu'
162+
optimizations: 'debug'
163+
- target_triple: 'i686-unknown-linux-gnu'
164164
py: 'cpython-3.8'
165-
- triple: 'mipsel-unknown-linux-gnu'
166-
py: 'cpython-3.10'
167-
- triple: 's390x-unknown-linux-gnu'
165+
optimizations: 'lto'
166+
- target_triple: 'i686-unknown-linux-gnu'
168167
py: 'cpython-3.8'
169-
- triple: 's390x-unknown-linux-gnu'
170-
py: 'cpython-3.10'
171-
# We don't publish noopt builds for GNU Linux when PGO is available.
172-
- triple: 'i686-unknown-linux-gnu'
173-
optimizations: 'noopt'
174-
- triple: 'x86_64-unknown-linux-gnu'
175-
optimizations: 'noopt'
176-
# PGO doesn't work with musl libc.
177-
- triple: 'x86_64-unknown-linux-musl'
178168
optimizations: 'pgo'
179-
- triple: 'x86_64-unknown-linux-musl'
180-
optimizations: 'pgo+lto'
181-
# PGO doesn't work with cross builds.
182-
- triple: 'aarch64-unknown-linux-gnu'
183-
optimizations: 'pgo'
184-
- triple: 'aarch64-unknown-linux-gnu'
185-
optimizations: 'pgo+lto'
186-
- triple: 'armv7-unknown-linux-gnueabi'
187-
optimizations: 'pgo'
188-
- triple: 'armv7-unknown-linux-gnueabi'
169+
- target_triple: 'i686-unknown-linux-gnu'
170+
py: 'cpython-3.8'
189171
optimizations: 'pgo+lto'
190-
- triple: 'armv7-unknown-linux-gnueabihf'
172+
- target_triple: 'i686-unknown-linux-gnu'
173+
py: 'cpython-3.9'
174+
optimizations: 'debug'
175+
- target_triple: 'i686-unknown-linux-gnu'
176+
py: 'cpython-3.9'
177+
optimizations: 'lto'
178+
- target_triple: 'i686-unknown-linux-gnu'
179+
py: 'cpython-3.9'
191180
optimizations: 'pgo'
192-
- triple: 'armv7-unknown-linux-gnueabihf'
181+
- target_triple: 'i686-unknown-linux-gnu'
182+
py: 'cpython-3.9'
193183
optimizations: 'pgo+lto'
194-
- triple: 'mips-unknown-linux-gnu'
184+
185+
# Cross-compiles can't do PGO and require Python 3.9.
186+
- target_triple: 'mips-unknown-linux-gnu'
187+
py: 'cpython-3.9'
188+
optimizations: 'debug'
189+
- target_triple: 'mips-unknown-linux-gnu'
190+
py: 'cpython-3.9'
191+
optimizations: 'noopt'
192+
- target_triple: 'mips-unknown-linux-gnu'
193+
py: 'cpython-3.9'
194+
optimizations: 'lto'
195+
196+
# Cross-compiles can't do PGO and require Python 3.9.
197+
- target_triple: 'mipsel-unknown-linux-gnu'
198+
py: 'cpython-3.9'
199+
optimizations: 'debug'
200+
- target_triple: 'mipsel-unknown-linux-gnu'
201+
py: 'cpython-3.9'
202+
optimizations: 'noopt'
203+
- target_triple: 'mipsel-unknown-linux-gnu'
204+
py: 'cpython-3.9'
205+
optimizations: 'lto'
206+
207+
# Cross-compiles can't do PGO and require Python 3.9.
208+
- target_triple: 's390x-unknown-linux-gnu'
209+
py: 'cpython-3.9'
210+
optimizations: 'debug'
211+
- target_triple: 's390x-unknown-linux-gnu'
212+
py: 'cpython-3.9'
213+
optimizations: 'noopt'
214+
- target_triple: 's390x-unknown-linux-gnu'
215+
py: 'cpython-3.9'
216+
optimizations: 'lto'
217+
218+
# We don't publish noopt builds when PGO is available.
219+
- target_triple: 'x86_64-unknown-linux-gnu'
220+
py: 'cpython-3.8'
221+
optimizations: 'debug'
222+
- target_triple: 'x86_64-unknown-linux-gnu'
223+
py: 'cpython-3.8'
224+
optimizations: 'lto'
225+
- target_triple: 'x86_64-unknown-linux-gnu'
226+
py: 'cpython-3.8'
195227
optimizations: 'pgo'
196-
- triple: 'mips-unknown-linux-gnu'
228+
- target_triple: 'x86_64-unknown-linux-gnu'
229+
py: 'cpython-3.8'
197230
optimizations: 'pgo+lto'
198-
- triple: 'mipsel-unknown-linux-gnu'
231+
- target_triple: 'x86_64-unknown-linux-gnu'
232+
233+
py: 'cpython-3.9'
234+
optimizations: 'debug'
235+
- target_triple: 'x86_64-unknown-linux-gnu'
236+
py: 'cpython-3.9'
237+
optimizations: 'lto'
238+
- target_triple: 'x86_64-unknown-linux-gnu'
239+
py: 'cpython-3.9'
199240
optimizations: 'pgo'
200-
- triple: 'mipsel-unknown-linux-gnu'
241+
- target_triple: 'x86_64-unknown-linux-gnu'
242+
py: 'cpython-3.9'
201243
optimizations: 'pgo+lto'
202-
- triple: 's390x-unknown-linux-gnu'
203-
optimizations: 'pgo'
204-
- triple: 's390x-unknown-linux-gnu'
244+
245+
# Python 3.10 is just spot coverage for now.
246+
- target_triple: 'x86_64-unknown-linux-gnu'
247+
py: 'cpython-3.10'
248+
optimizations: 'debug'
249+
- target_triple: 'x86_64-unknown-linux-gnu'
250+
py: 'cpython-3.10'
205251
optimizations: 'pgo+lto'
206252

253+
# musl doesn't support PGO.
254+
- target_triple: 'x86_64-unknown-linux-musl'
255+
py: 'cpython-3.8'
256+
optimizations: 'debug'
257+
- target_triple: 'x86_64-unknown-linux-musl'
258+
py: 'cpython-3.8'
259+
optimizations: 'noopt'
260+
- target_triple: 'x86_64-unknown-linux-musl'
261+
py: 'cpython-3.8'
262+
optimizations: 'lto'
263+
- target_triple: 'x86_64-unknown-linux-musl'
264+
265+
py: 'cpython-3.9'
266+
optimizations: 'debug'
267+
- target_triple: 'x86_64-unknown-linux-musl'
268+
py: 'cpython-3.9'
269+
optimizations: 'noopt'
270+
- target_triple: 'x86_64-unknown-linux-musl'
271+
py: 'cpython-3.9'
272+
optimizations: 'lto'
207273
needs:
208274
- pythonbuild
209275
- toolchain
@@ -232,13 +298,13 @@ jobs:
232298

233299
- name: Build
234300
run: |
235-
if [ "${{ matrix.triple }}" = "x86_64-unknown-linux-musl" ]; then
301+
if [ "${{ matrix.build.target_triple }}" = "x86_64-unknown-linux-musl" ]; then
236302
EXTRA_ARGS=--libressl
237303
else
238304
EXTRA_ARGS=
239305
fi
240306
241-
./build-linux.py --skip-toolchain --target-triple ${{ matrix.triple }} --python ${{ matrix.py }} --optimizations ${{ matrix.optimizations }} ${EXTRA_ARGS}
307+
./build-linux.py --skip-toolchain --target-triple ${{ matrix.build.target_triple }} --python ${{ matrix.build.py }} --optimizations ${{ matrix.build.optimizations }} ${EXTRA_ARGS}
242308
243309
- name: Validate Distribution
244310
run: |
@@ -248,5 +314,5 @@ jobs:
248314
- name: Upload Distribution
249315
uses: actions/upload-artifact@v2
250316
with:
251-
name: ${{ matrix.py }}-${{ matrix.triple }}
317+
name: ${{ matrix.build.py }}-${{ matrix.build.target_triple }}
252318
path: dist/*

0 commit comments

Comments
 (0)