@@ -2,7 +2,7 @@ name: linux
2
2
3
3
on :
4
4
push :
5
- branches : [ main ]
5
+ branches : [main]
6
6
pull_request :
7
7
8
8
concurrency :
@@ -12,6 +12,8 @@ concurrency:
12
12
env :
13
13
FORCE_COLOR : 1
14
14
15
+ permissions : {}
16
+
15
17
jobs :
16
18
crate-build :
17
19
needs :
28
30
sudo apt install -y --no-install-recommends libssl-dev pkg-config
29
31
30
32
- uses : actions/checkout@v4
33
+ with :
34
+ persist-credentials : false
31
35
32
36
- name : Emit rustc version
33
37
run : |
@@ -64,11 +68,13 @@ jobs:
64
68
packages : write
65
69
steps :
66
70
- uses : actions/checkout@v4
71
+ with :
72
+ persist-credentials : false
67
73
68
74
- name : Install Python
69
75
uses : actions/setup-python@v5
70
76
with :
71
- python-version : ' 3.11'
77
+ python-version : " 3.11"
72
78
73
79
- name : Set up Docker Buildx
74
80
uses : docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
90
96
91
97
- name : Build Image
92
98
id : build-image
93
- uses : docker/build-push-action@v5
99
+ uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
94
100
with :
95
101
context : .
96
102
file : build/${{ matrix.name }}.Dockerfile
@@ -110,8 +116,12 @@ jobs:
110
116
111
117
- name : Compress Image
112
118
run : |
113
- echo ${{ steps.build-image.outputs.imageid }} > build/image-${{ matrix.name }} .linux_${{ matrix.arch } }
119
+ echo ${STEPS_BUILD_IMAGE_OUTPUTS_IMAGEID} > build/image-${MATRIX_NAME} .linux_${MATRIX_ARCH }
114
120
zstd -v -T0 -6 --rm build/image-*.tar
121
+ env :
122
+ STEPS_BUILD_IMAGE_OUTPUTS_IMAGEID : ${{ steps.build-image.outputs.imageid }}
123
+ MATRIX_NAME : ${{ matrix.name }}
124
+ MATRIX_ARCH : ${{ matrix.arch }}
115
125
116
126
- name : Upload Docker Image
117
127
uses : actions/upload-artifact@v4
@@ -120,6 +130,7 @@ jobs:
120
130
path : build/image-*
121
131
122
132
generate-matrix :
133
+ name : Generate build matrix
123
134
runs-on : ubuntu-latest
124
135
outputs :
125
136
python-build-matrix-0 : ${{ steps.set-matrix.outputs.python-build-matrix-0 }}
@@ -130,16 +141,19 @@ jobs:
130
141
steps :
131
142
- uses : actions/checkout@v4
132
143
with :
133
- fetch-depth : 0 # fetch history for subsequent `git diff`
144
+ fetch-depth : 0
145
+ persist-credentials : false
134
146
135
147
- name : Set up Python
136
148
uses : astral-sh/setup-uv@v4
137
149
138
150
- name : Get pull request labels
139
151
id : get-labels
152
+ env :
153
+ PULL_REQUEST_LABELS : ${{ toJson(github.event.pull_request.labels.*.name) }}
140
154
run : |
141
155
# Convert GitHub labels array to comma-separated string
142
- LABELS=$(echo '${{ toJson(github.event.pull_request.labels.*.name) }}' | jq -r 'join(",")')
156
+ LABELS=$(echo "${PULL_REQUEST_LABELS}" | jq -r 'join(",")')
143
157
echo "labels=$LABELS" >> $GITHUB_OUTPUT
144
158
145
159
- name : Check if the `pythonbuild` crate changed
@@ -159,7 +173,7 @@ jobs:
159
173
run : |
160
174
uv run ci-matrix.py \
161
175
--platform linux \
162
- --labels '${{ steps.get-labels.outputs.labels } }' \
176
+ --labels '${STEPS_GET_LABELS_OUTPUTS_LABELS }' \
163
177
--max-shards 2 \
164
178
${{ (steps.check-pythonbuild.outputs.changed == 'true' || github.ref == 'refs/heads/main') && '--force-crate-build' || '' }} \
165
179
> matrix.json
@@ -179,6 +193,8 @@ jobs:
179
193
# Build matrix is empty
180
194
echo "any_builds=false" >> $GITHUB_OUTPUT
181
195
fi
196
+ env :
197
+ STEPS_GET_LABELS_OUTPUTS_LABELS : ${{ steps.get-labels.outputs.labels }}
182
198
183
199
build-0 :
184
200
needs :
@@ -198,11 +214,12 @@ jobs:
198
214
- uses : actions/checkout@v4
199
215
with :
200
216
fetch-depth : 0
217
+ persist-credentials : false
201
218
202
219
- name : Install Python
203
220
uses : actions/setup-python@v5
204
221
with :
205
- python-version : ' 3.11'
222
+ python-version : " 3.11"
206
223
207
224
- name : Download pythonbuild
208
225
uses : actions/download-artifact@v4
@@ -247,7 +264,11 @@ jobs:
247
264
# Touch mtimes of all images so they are newer than autogenerated files above.
248
265
touch build/image-*
249
266
250
- ./build-linux.py --target-triple ${{ matrix.target_triple }} --python cpython-${{ matrix.python }} --options ${{ matrix.build_options }}
267
+ ./build-linux.py --target-triple ${MATRIX_TARGET_TRIPLE} --python cpython-${MATRIX_PYTHON} --options ${MATRIX_BUILD_OPTIONS}
268
+ env :
269
+ MATRIX_TARGET_TRIPLE : ${{ matrix.target_triple }}
270
+ MATRIX_PYTHON : ${{ matrix.python }}
271
+ MATRIX_BUILD_OPTIONS : ${{ matrix.build_options }}
251
272
252
273
- name : Generate attestations
253
274
uses : actions/attest-build-provenance@v2
@@ -267,8 +288,8 @@ jobs:
267
288
run : |
268
289
chmod +x build/pythonbuild
269
290
270
- if [ "${{ matrix.run } }" == "true" ]; then
271
- if [ "${{ matrix.libc } }" == "musl" ]; then
291
+ if [ "${MATRIX_RUN }" == "true" ]; then
292
+ if [ "${MATRIX_LIBC }" == "musl" ]; then
272
293
sudo apt install musl-dev
273
294
274
295
# GitHub's setup-python action sets `LD_LIBRARY_PATH` which overrides `RPATH`
@@ -279,6 +300,9 @@ jobs:
279
300
fi
280
301
281
302
build/pythonbuild validate-distribution ${EXTRA_ARGS} dist/*.tar.zst
303
+ env :
304
+ MATRIX_RUN : ${{ matrix.run }}
305
+ MATRIX_LIBC : ${{ matrix.libc }}
282
306
283
307
build-1 :
284
308
needs :
@@ -298,11 +322,12 @@ jobs:
298
322
- uses : actions/checkout@v4
299
323
with :
300
324
fetch-depth : 0
325
+ persist-credentials : false
301
326
302
327
- name : Install Python
303
328
uses : actions/setup-python@v5
304
329
with :
305
- python-version : ' 3.11'
330
+ python-version : " 3.11"
306
331
307
332
- name : Download pythonbuild
308
333
uses : actions/download-artifact@v4
@@ -347,7 +372,11 @@ jobs:
347
372
# Touch mtimes of all images so they are newer than autogenerated files above.
348
373
touch build/image-*
349
374
350
- ./build-linux.py --target-triple ${{ matrix.target_triple }} --python cpython-${{ matrix.python }} --options ${{ matrix.build_options }}
375
+ ./build-linux.py --target-triple ${MATRIX_TARGET_TRIPLE} --python cpython-${MATRIX_PYTHON} --options ${MATRIX_BUILD_OPTIONS}
376
+ env :
377
+ MATRIX_TARGET_TRIPLE : ${{ matrix.target_triple }}
378
+ MATRIX_PYTHON : ${{ matrix.python }}
379
+ MATRIX_BUILD_OPTIONS : ${{ matrix.build_options }}
351
380
352
381
- name : Generate attestations
353
382
uses : actions/attest-build-provenance@v2
@@ -367,8 +396,8 @@ jobs:
367
396
run : |
368
397
chmod +x build/pythonbuild
369
398
370
- if [ "${{ matrix.run } }" == "true" ]; then
371
- if [ "${{ matrix.libc } }" == "musl" ]; then
399
+ if [ "${MATRIX_RUN }" == "true" ]; then
400
+ if [ "${MATRIX_LIBC }" == "musl" ]; then
372
401
sudo apt install musl-dev
373
402
374
403
# GitHub's setup-python action sets `LD_LIBRARY_PATH` which overrides `RPATH`
@@ -379,3 +408,6 @@ jobs:
379
408
fi
380
409
381
410
build/pythonbuild validate-distribution ${EXTRA_ARGS} dist/*.tar.zst
411
+ env :
412
+ MATRIX_RUN : ${{ matrix.run }}
413
+ MATRIX_LIBC : ${{ matrix.libc }}
0 commit comments