Skip to content

Commit 96d70c8

Browse files
committed
ci(health-check): lift build-type matrix from reusable to callers
The reusable now takes build-type, platform and runner as inputs. Each caller (health-check on main/schedule and health-check-pr on PRs) declares its own matrix and maps the values into the call. This lets callers tailor the matrix independently and follows the pattern used in autoware_universe's build-and-test-packages-above-differential. Note: this changes the required status check name from 'health-check / docker-build (main)' to 'health-check (main) / docker-build'. Branch protection must be updated to require the new name. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
1 parent f9b338c commit 96d70c8

3 files changed

Lines changed: 53 additions & 20 deletions

File tree

.github/workflows/health-check-pr.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,24 @@ jobs:
4444
health-check:
4545
if: ${{ always() }}
4646
needs: [changed-files, require-label]
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
build-type: [main, nightly, main-arm64]
51+
include:
52+
- build-type: main
53+
platform: amd64
54+
runner: "['ubuntu-24.04']"
55+
- build-type: nightly
56+
platform: amd64
57+
runner: "['ubuntu-24.04']"
58+
- build-type: main-arm64
59+
platform: arm64
60+
runner: "['ubuntu-24.04-arm']"
4761
uses: ./.github/workflows/health-check-reusable.yaml
4862
with:
63+
build-type: ${{ matrix.build-type }}
64+
platform: ${{ matrix.platform }}
65+
runner: ${{ matrix.runner }}
4966
run-condition: ${{ needs.changed-files.outputs.should-run == 'true' && needs.require-label.outputs.result == 'true' }}
5067
secrets: inherit

.github/workflows/health-check-reusable.yaml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ name: health-check-reusable
2424
on:
2525
workflow_call:
2626
inputs:
27+
build-type:
28+
description: Build-type label (e.g. main, nightly, main-arm64); drives caching lineage and conditional steps
29+
type: string
30+
required: true
31+
platform:
32+
description: Target platform (amd64 or arm64)
33+
type: string
34+
required: true
35+
runner:
36+
description: JSON array string for runs-on, e.g. "['ubuntu-24.04']"
37+
type: string
38+
required: true
2739
ros-distro:
2840
description: ROS distribution
2941
type: string
@@ -40,28 +52,14 @@ on:
4052
jobs:
4153
docker-build:
4254
if: ${{ inputs.run-condition }}
43-
strategy:
44-
fail-fast: false
45-
matrix:
46-
build-type: [main, nightly, main-arm64]
47-
include:
48-
- build-type: main
49-
platform: amd64
50-
runner: "['ubuntu-24.04']"
51-
- build-type: nightly
52-
platform: amd64
53-
runner: "['ubuntu-24.04']"
54-
- build-type: main-arm64
55-
platform: arm64
56-
runner: "['ubuntu-24.04-arm']"
57-
runs-on: ${{ fromJson(matrix.runner) }}
55+
runs-on: ${{ fromJson(inputs.runner) }}
5856
permissions:
5957
contents: read
6058
packages: write
6159
actions: write
6260
env:
63-
CACHE_KEY_PREFIX: buildkit-mounts-health-check-${{ matrix.build-type }}-${{ inputs.ros-distro }}-${{ matrix.platform }}-
64-
CACHE_REF_PREFIX: ghcr.io/${{ github.repository }}-buildcache:health-check-${{ matrix.build-type }}-${{ inputs.ros-distro }}-${{ matrix.platform }}
61+
CACHE_KEY_PREFIX: buildkit-mounts-health-check-${{ inputs.build-type }}-${{ inputs.ros-distro }}-${{ inputs.platform }}-
62+
CACHE_REF_PREFIX: ghcr.io/${{ github.repository }}-buildcache:health-check-${{ inputs.build-type }}-${{ inputs.ros-distro }}-${{ inputs.platform }}
6563
IS_MAIN_PUSH: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
6664
steps:
6765
- name: 🔧 Change permission of workspace
@@ -89,11 +87,11 @@ jobs:
8987
echo "::endgroup::"
9088
9189
- name: 🧹 Free disk space
92-
if: matrix.build-type != 'main'
90+
if: inputs.build-type != 'main'
9391
uses: ./.github/actions/free-disk-space
9492

9593
- name: 💾 Create additional swap
96-
if: matrix.platform == 'arm64'
94+
if: inputs.platform == 'arm64'
9795
run: |
9896
sudo fallocate -l 8G /mnt/swapfile
9997
sudo chmod 600 /mnt/swapfile
@@ -108,7 +106,7 @@ jobs:
108106
vcs import --shallow src < repositories/autoware.repos
109107
110108
- name: 📦 Overlay nightly repos
111-
if: matrix.build-type == 'nightly'
109+
if: inputs.build-type == 'nightly'
112110
run: |
113111
vcs import --shallow --force src < repositories/autoware-nightly.repos
114112

.github/workflows/health-check.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,23 @@ concurrency:
1414

1515
jobs:
1616
health-check:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
build-type: [main, nightly, main-arm64]
21+
include:
22+
- build-type: main
23+
platform: amd64
24+
runner: "['ubuntu-24.04']"
25+
- build-type: nightly
26+
platform: amd64
27+
runner: "['ubuntu-24.04']"
28+
- build-type: main-arm64
29+
platform: arm64
30+
runner: "['ubuntu-24.04-arm']"
1731
uses: ./.github/workflows/health-check-reusable.yaml
32+
with:
33+
build-type: ${{ matrix.build-type }}
34+
platform: ${{ matrix.platform }}
35+
runner: ${{ matrix.runner }}
1836
secrets: inherit

0 commit comments

Comments
 (0)