@@ -2,7 +2,7 @@ name: linux
22
33on :
44 push :
5- branches : [ main ]
5+ branches : [main]
66 pull_request :
77
88concurrency :
@@ -12,6 +12,8 @@ concurrency:
1212env :
1313 FORCE_COLOR : 1
1414
15+ permissions : {}
16+
1517jobs :
1618 crate-build :
1719 needs :
2830 sudo apt install -y --no-install-recommends libssl-dev pkg-config
2931
3032 - uses : actions/checkout@v4
33+ with :
34+ persist-credentials : false
3135
3236 - name : Emit rustc version
3337 run : |
@@ -64,14 +68,16 @@ jobs:
6468 packages : write
6569 steps :
6670 - uses : actions/checkout@v4
71+ with :
72+ persist-credentials : false
6773
6874 - name : Install Python
6975 uses : actions/setup-python@v5
7076 with :
71- python-version : ' 3.11'
77+ python-version : " 3.11"
7278
7379 - name : Set up Docker Buildx
74- uses : docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
80+ uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
7581
7682 - name : Login to GitHub Container Registry
7783 uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
9096
9197 - name : Build Image
9298 id : build-image
93- uses : docker/build-push-action@v5
99+ uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
94100 with :
95101 context : .
96102 file : build/${{ matrix.name }}.Dockerfile
@@ -110,8 +116,12 @@ jobs:
110116
111117 - name : Compress Image
112118 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 }
114120 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 }}
115125
116126 - name : Upload Docker Image
117127 uses : actions/upload-artifact@v4
@@ -120,6 +130,7 @@ jobs:
120130 path : build/image-*
121131
122132 generate-matrix :
133+ name : Generate build matrix
123134 runs-on : ubuntu-latest
124135 outputs :
125136 python-build-matrix-0 : ${{ steps.set-matrix.outputs.python-build-matrix-0 }}
@@ -130,16 +141,19 @@ jobs:
130141 steps :
131142 - uses : actions/checkout@v4
132143 with :
133- fetch-depth : 0 # fetch history for subsequent `git diff`
144+ fetch-depth : 0
145+ persist-credentials : false
134146
135147 - name : Set up Python
136148 uses : astral-sh/setup-uv@v4
137149
138150 - name : Get pull request labels
139151 id : get-labels
152+ env :
153+ PULL_REQUEST_LABELS : ${{ toJson(github.event.pull_request.labels.*.name) }}
140154 run : |
141155 # 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(",")')
143157 echo "labels=$LABELS" >> $GITHUB_OUTPUT
144158
145159 - name : Check if the `pythonbuild` crate changed
@@ -159,7 +173,7 @@ jobs:
159173 run : |
160174 uv run ci-matrix.py \
161175 --platform linux \
162- --labels '${{ steps.get-labels.outputs.labels }}' \
176+ --labels "${STEPS_GET_LABELS_OUTPUTS_LABELS}" \
163177 --max-shards 2 \
164178 ${{ (steps.check-pythonbuild.outputs.changed == 'true' || github.ref == 'refs/heads/main') && '--force-crate-build' || '' }} \
165179 > matrix.json
@@ -179,6 +193,8 @@ jobs:
179193 # Build matrix is empty
180194 echo "any_builds=false" >> $GITHUB_OUTPUT
181195 fi
196+ env :
197+ STEPS_GET_LABELS_OUTPUTS_LABELS : ${{ steps.get-labels.outputs.labels }}
182198
183199 build-0 :
184200 needs :
@@ -198,11 +214,12 @@ jobs:
198214 - uses : actions/checkout@v4
199215 with :
200216 fetch-depth : 0
217+ persist-credentials : false
201218
202219 - name : Install Python
203220 uses : actions/setup-python@v5
204221 with :
205- python-version : ' 3.11'
222+ python-version : " 3.11"
206223
207224 - name : Download pythonbuild
208225 uses : actions/download-artifact@v4
@@ -247,7 +264,11 @@ jobs:
247264 # Touch mtimes of all images so they are newer than autogenerated files above.
248265 touch build/image-*
249266
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 }}
251272
252273 - name : Generate attestations
253274 uses : actions/attest-build-provenance@v2
@@ -267,8 +288,8 @@ jobs:
267288 run : |
268289 chmod +x build/pythonbuild
269290
270- if [ "${{ matrix.run } }" == "true" ]; then
271- if [ "${{ matrix.libc } }" == "musl" ]; then
291+ if [ "${MATRIX_RUN }" == "true" ]; then
292+ if [ "${MATRIX_LIBC }" == "musl" ]; then
272293 sudo apt install musl-dev
273294
274295 # GitHub's setup-python action sets `LD_LIBRARY_PATH` which overrides `RPATH`
@@ -279,6 +300,9 @@ jobs:
279300 fi
280301
281302 build/pythonbuild validate-distribution ${EXTRA_ARGS} dist/*.tar.zst
303+ env :
304+ MATRIX_RUN : ${{ matrix.run }}
305+ MATRIX_LIBC : ${{ matrix.libc }}
282306
283307 build-1 :
284308 needs :
@@ -298,11 +322,12 @@ jobs:
298322 - uses : actions/checkout@v4
299323 with :
300324 fetch-depth : 0
325+ persist-credentials : false
301326
302327 - name : Install Python
303328 uses : actions/setup-python@v5
304329 with :
305- python-version : ' 3.11'
330+ python-version : " 3.11"
306331
307332 - name : Download pythonbuild
308333 uses : actions/download-artifact@v4
@@ -347,7 +372,11 @@ jobs:
347372 # Touch mtimes of all images so they are newer than autogenerated files above.
348373 touch build/image-*
349374
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 }}
351380
352381 - name : Generate attestations
353382 uses : actions/attest-build-provenance@v2
@@ -367,8 +396,8 @@ jobs:
367396 run : |
368397 chmod +x build/pythonbuild
369398
370- if [ "${{ matrix.run } }" == "true" ]; then
371- if [ "${{ matrix.libc } }" == "musl" ]; then
399+ if [ "${MATRIX_RUN }" == "true" ]; then
400+ if [ "${MATRIX_LIBC }" == "musl" ]; then
372401 sudo apt install musl-dev
373402
374403 # GitHub's setup-python action sets `LD_LIBRARY_PATH` which overrides `RPATH`
@@ -379,3 +408,6 @@ jobs:
379408 fi
380409
381410 build/pythonbuild validate-distribution ${EXTRA_ARGS} dist/*.tar.zst
411+ env :
412+ MATRIX_RUN : ${{ matrix.run }}
413+ MATRIX_LIBC : ${{ matrix.libc }}
0 commit comments