@@ -125,7 +125,8 @@ jobs:
125125 generate-matrix :
126126 runs-on : ubuntu-latest
127127 outputs :
128- matrix : ${{ steps.set-matrix.outputs.matrix }}
128+ matrix-0 : ${{ steps.set-matrix.outputs.matrix-0 }}
129+ matrix-1 : ${{ steps.set-matrix.outputs.matrix-1 }}
129130 any_builds : ${{ steps.set-matrix.outputs.any_builds }}
130131 pythonbuild_changed : ${{ steps.changed.outputs.pythonbuild_any_changed }}
131132 steps :
@@ -144,11 +145,19 @@ jobs:
144145 - name : Generate build matrix
145146 id : set-matrix
146147 run : |
147- uv run ci-matrix.py --platform linux --labels '${{ steps.get-labels.outputs.labels }}' > matrix.json && echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT
148+ uv run ci-matrix.py \
149+ --platform linux \
150+ --labels '${{ steps.get-labels.outputs.labels }}' \
151+ --max-shards 2 \
152+ > matrix.json
153+
154+ echo "matrix-0=$(jq -c '.["0"]' matrix.json)" >> $GITHUB_OUTPUT
155+ echo "matrix-1=$(jq -c '.["1"]' matrix.json)" >> $GITHUB_OUTPUT
156+
148157 # Display the matrix for debugging too
149158 cat matrix.json | jq
150159
151- if jq -e '.include | length > 0' matrix.json > /dev/null; then
160+ if jq -e '.["0"]. include | length > 0' matrix.json > /dev/null; then
152161 # Build matrix has entries
153162 echo "any_builds=true" >> $GITHUB_OUTPUT
154163 else
@@ -163,7 +172,7 @@ jobs:
163172 pythonbuild:
164173 - "src/*.rs"
165174
166- build :
175+ build-0 :
167176 needs :
168177 - generate-matrix
169178 - pythonbuild
@@ -174,7 +183,81 @@ jobs:
174183 attestations : write
175184 runs-on : ${{ matrix.runner }}
176185 strategy :
177- matrix : ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
186+ matrix : ${{ fromJson(needs.generate-matrix.outputs.matrix-0) }}
187+ fail-fast : false
188+ name : ${{ matrix.target_triple }} / ${{ matrix.python }} / ${{ matrix.build_options }}
189+ steps :
190+ - uses : actions/checkout@v4
191+ with :
192+ fetch-depth : 0
193+
194+ - name : Install Python
195+ uses : actions/setup-python@v5
196+ with :
197+ python-version : ' 3.11'
198+
199+ - name : Download pythonbuild
200+ uses : actions/download-artifact@v4
201+ with :
202+ name : pythonbuild
203+ path : build
204+
205+ - name : Download images
206+ uses : actions/download-artifact@v4
207+ with :
208+ pattern : image-*
209+ path : build
210+ merge-multiple : true
211+
212+ - name : Load Docker Images
213+ run : |
214+ for f in build/image-*.tar.zst; do
215+ echo "decompressing $f"
216+ zstd -d --rm ${f}
217+ done
218+
219+ for f in build/image-*.tar; do
220+ echo "loading $f"
221+ docker load --input $f
222+ done
223+
224+ - name : Build
225+ if : ${{ ! matrix.dry-run }}
226+ run : |
227+ # Do empty target so all generated files are touched.
228+ ./build-linux.py --make-target empty
229+
230+ # Touch mtimes of all images so they are newer than autogenerated files above.
231+ touch build/image-*
232+
233+ ./build-linux.py --target-triple ${{ matrix.target_triple }} --python cpython-${{ matrix.python }} --options ${{ matrix.build_options }}
234+
235+ - name : Validate Distribution
236+ if : ${{ ! matrix.dry-run }}
237+ run : |
238+ chmod +x build/pythonbuild
239+
240+ if [ "${{ matrix.run }}" == "true" ]; then
241+ EXTRA_ARGS="--run"
242+ fi
243+
244+ build/pythonbuild validate-distribution ${EXTRA_ARGS} dist/*.tar.zst
245+
246+ - name : Upload Distribution
247+ if : ${{ ! matrix.dry-run }}
248+ uses : actions/upload-artifact@v4
249+ with :
250+ name : cpython-${{ matrix.python }}-${{ matrix.target_triple }}-${{ matrix.build_options }}
251+ path : dist/*
252+
253+ build-1 :
254+ needs :
255+ - generate-matrix
256+ - pythonbuild
257+ - image
258+ runs-on : ${{ matrix.runner }}
259+ strategy :
260+ matrix : ${{ fromJson(needs.generate-matrix.outputs.matrix-1) }}
178261 fail-fast : false
179262 name : ${{ matrix.target_triple }} / ${{ matrix.python }} / ${{ matrix.build_options }}
180263 steps :
0 commit comments