@@ -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,14 +172,88 @@ jobs:
163172 pythonbuild:
164173 - "src/*.rs"
165174
166- build :
175+ build-0 :
176+ needs :
177+ - generate-matrix
178+ - pythonbuild
179+ - image
180+ runs-on : ${{ matrix.runner }}
181+ strategy :
182+ matrix : ${{ fromJson(needs.generate-matrix.outputs.matrix-0) }}
183+ fail-fast : false
184+ name : ${{ matrix.target_triple }} / ${{ matrix.python }} / ${{ matrix.build_options }}
185+ steps :
186+ - uses : actions/checkout@v4
187+ with :
188+ fetch-depth : 0
189+
190+ - name : Install Python
191+ uses : actions/setup-python@v5
192+ with :
193+ python-version : ' 3.11'
194+
195+ - name : Download pythonbuild
196+ uses : actions/download-artifact@v4
197+ with :
198+ name : pythonbuild
199+ path : build
200+
201+ - name : Download images
202+ uses : actions/download-artifact@v4
203+ with :
204+ pattern : image-*
205+ path : build
206+ merge-multiple : true
207+
208+ - name : Load Docker Images
209+ run : |
210+ for f in build/image-*.tar.zst; do
211+ echo "decompressing $f"
212+ zstd -d --rm ${f}
213+ done
214+
215+ for f in build/image-*.tar; do
216+ echo "loading $f"
217+ docker load --input $f
218+ done
219+
220+ - name : Build
221+ if : ${{ ! matrix.dry-run }}
222+ run : |
223+ # Do empty target so all generated files are touched.
224+ ./build-linux.py --make-target empty
225+
226+ # Touch mtimes of all images so they are newer than autogenerated files above.
227+ touch build/image-*
228+
229+ ./build-linux.py --target-triple ${{ matrix.target_triple }} --python cpython-${{ matrix.python }} --options ${{ matrix.build_options }}
230+
231+ - name : Validate Distribution
232+ if : ${{ ! matrix.dry-run }}
233+ run : |
234+ chmod +x build/pythonbuild
235+
236+ if [ "${{ matrix.run }}" == "true" ]; then
237+ EXTRA_ARGS="--run"
238+ fi
239+
240+ build/pythonbuild validate-distribution ${EXTRA_ARGS} dist/*.tar.zst
241+
242+ - name : Upload Distribution
243+ if : ${{ ! matrix.dry-run }}
244+ uses : actions/upload-artifact@v4
245+ with :
246+ name : cpython-${{ matrix.python }}-${{ matrix.target_triple }}-${{ matrix.build_options }}
247+ path : dist/*
248+
249+ build-1 :
167250 needs :
168251 - generate-matrix
169252 - pythonbuild
170253 - image
171254 runs-on : ${{ matrix.runner }}
172255 strategy :
173- matrix : ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
256+ matrix : ${{ fromJson(needs.generate-matrix.outputs.matrix-1 ) }}
174257 fail-fast : false
175258 name : ${{ matrix.target_triple }} / ${{ matrix.python }} / ${{ matrix.build_options }}
176259 steps :
0 commit comments