Skip to content

Commit

Permalink
Only run the image builds if we are doing Linux Python builds
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Dec 18, 2024
1 parent 6b4d414 commit 90a0146
Showing 1 changed file with 40 additions and 15 deletions.
55 changes: 40 additions & 15 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,11 @@ jobs:
path: target/release/pythonbuild

image:
needs:
- generate-matrix
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.image_matrix) }}
fail-fast: false
matrix:
image:
- build
- build.cross
- gcc
- xcb
- xcb.cross
runs-on: depot-ubuntu-22.04
permissions:
packages: write
Expand Down Expand Up @@ -121,7 +117,7 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: astral-sh/setup-uv@v4

Expand All @@ -131,22 +127,51 @@ jobs:
# Convert GitHub labels array to comma-separated string
LABELS=$(echo '${{ toJson(github.event.pull_request.labels.*.name) }}' | jq -r 'join(",")')
echo "labels=$LABELS" >> $GITHUB_OUTPUT
- name: Generate build matrix
- name: Generate matrix
id: set-matrix
run: |
uv run ci-matrix.py --platform linux --labels "${{ steps.get-labels.outputs.labels }}" > matrix.json && echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT
# Display the matrix for debugging too
cat matrix.json | jq
# Generate the build matrix
uv run ci-matrix.py --platform linux --labels "${{ steps.get-labels.outputs.labels }}" > build_matrix.json
# Display the build matrix for debugging
echo "Build matrix:"
cat build_matrix.json | jq
# Check if build matrix is empty and generate image matrix accordingly
if jq -e '.include | length > 0' build_matrix.json > /dev/null; then
# Build matrix has entries, generate the image matrix
jq -n '{
"include": [
{"image": "build"},
{"image": "build.cross"},
{"image": "gcc"},
{"image": "xcb"},
{"image": "xcb.cross"}
]
}' > image_matrix.json
else
# Build matrix is empty, create empty image matrix
jq -n '{"include": []}' > image_matrix.json
fi
# Display the image matrix for debugging
echo "Image matrix:"
cat image_matrix.json | jq
# Set both matrices as outputs
echo "build_matrix=$(cat build_matrix.json)" >> $GITHUB_OUTPUT
echo "image_matrix=$(jq -c '.' image_matrix.json)" >> $GITHUB_OUTPUT
build:
needs:
- generate-matrix
- pythonbuild
- image
runs-on: depot-ubuntu-22.04
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
matrix: ${{ fromJson(needs.generate-matrix.outputs.build_matrix) }}
fail-fast: false
name: ${{ matrix.target_triple }} / ${{ matrix.python }} / ${{ matrix.build_options }}
steps:
Expand Down

0 comments on commit 90a0146

Please sign in to comment.