Skip to content

Commit c9ef8a9

Browse files
authored
use yaml anchor to de-dupe linux action (#986)
1 parent c9c40c5 commit c9ef8a9

File tree

1 file changed

+2
-94
lines changed

1 file changed

+2
-94
lines changed

.github/workflows/linux.yml

Lines changed: 2 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ jobs:
218218
matrix: ${{ fromJson(needs.generate-matrix.outputs.python-build-matrix-0) }}
219219
fail-fast: false
220220
name: ${{ matrix.target_triple }} / ${{ matrix.python }} / ${{ matrix.build_options }}
221-
steps:
221+
steps: &build_steps
222222
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
223223
with:
224224
fetch-depth: 0
@@ -326,96 +326,4 @@ jobs:
326326
matrix: ${{ fromJson(needs.generate-matrix.outputs.python-build-matrix-1) }}
327327
fail-fast: false
328328
name: ${{ matrix.target_triple }} / ${{ matrix.python }} / ${{ matrix.build_options }}
329-
steps:
330-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
331-
with:
332-
fetch-depth: 0
333-
persist-credentials: false
334-
335-
- name: Set up uv
336-
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
337-
with:
338-
enable-cache: false
339-
340-
- name: Download pythonbuild
341-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
342-
with:
343-
name: ${{ matrix.crate_artifact_name }}
344-
path: build
345-
346-
- name: Download images
347-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
348-
with:
349-
pattern: image-*
350-
path: build
351-
merge-multiple: true
352-
353-
- name: Cache downloads
354-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
355-
with:
356-
path: build/downloads
357-
key: ${{ matrix.target_triple }}-${{ hashFiles('pythonbuild/downloads.py')}}
358-
restore-keys: |
359-
${{ matrix.target_triple }}-${{ hashFiles('pythonbuild/downloads.py')}}
360-
${{ matrix.target_triple }}-
361-
362-
- name: Load Docker Images
363-
run: |
364-
for f in build/image-*.tar.zst; do
365-
echo "decompressing $f"
366-
zstd -d --rm ${f}
367-
done
368-
369-
for f in build/image-*.tar; do
370-
echo "loading $f"
371-
docker load --input $f
372-
done
373-
374-
- name: Build
375-
if: ${{ ! matrix.dry-run }}
376-
run: |
377-
# Do empty target so all generated files are touched.
378-
./build.py --make-target empty
379-
380-
# Touch mtimes of all images so they are newer than autogenerated files above.
381-
touch build/image-*
382-
383-
./build.py --target-triple ${MATRIX_TARGET_TRIPLE} --python cpython-${MATRIX_PYTHON} --options ${MATRIX_BUILD_OPTIONS}
384-
env:
385-
MATRIX_TARGET_TRIPLE: ${{ matrix.target_triple }}
386-
MATRIX_PYTHON: ${{ matrix.python }}
387-
MATRIX_BUILD_OPTIONS: ${{ matrix.build_options }}
388-
389-
- name: Generate attestations
390-
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
391-
if: ${{ github.ref == 'refs/heads/main' }}
392-
with:
393-
subject-path: dist/*
394-
395-
- name: Upload Distribution
396-
if: ${{ ! matrix.dry-run }}
397-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
398-
with:
399-
name: cpython-${{ matrix.python }}-${{ matrix.target_triple }}-${{ matrix.build_options }}
400-
path: dist/*
401-
402-
- name: Validate Distribution
403-
if: ${{ ! matrix.dry-run }}
404-
run: |
405-
chmod +x build/pythonbuild
406-
407-
if [ "${MATRIX_RUN}" == "true" ]; then
408-
if [ "${MATRIX_LIBC}" == "musl" ]; then
409-
sudo apt install musl-dev
410-
411-
# GitHub's setup-python action sets `LD_LIBRARY_PATH` which overrides `RPATH`
412-
# as used in the musl builds.
413-
unset LD_LIBRARY_PATH
414-
fi
415-
EXTRA_ARGS="--run"
416-
fi
417-
418-
build/pythonbuild validate-distribution ${EXTRA_ARGS} dist/*.tar.zst
419-
env:
420-
MATRIX_RUN: ${{ matrix.run }}
421-
MATRIX_LIBC: ${{ matrix.libc }}
329+
steps: *build_steps

0 commit comments

Comments
 (0)