Skip to content

Commit 0fd0402

Browse files
committed
ci: consolidate runner selection
1 parent 4c4130c commit 0fd0402

File tree

6 files changed

+13
-23
lines changed

6 files changed

+13
-23
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions: {}
1414

1515
jobs:
1616
build-push-test:
17-
name: 🛠️ Build → Push → Test (🍨 ${{ matrix.flavor }})
17+
name: Build → Push → Test (🍨 ${{ matrix.flavor }})
1818
strategy:
1919
matrix:
2020
flavor: [cpp, rust]

.github/workflows/wc-build-push-test.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,19 @@ on:
2222
type: string
2323
default: "ghcr.io"
2424
build-test-runner-labels:
25-
description: >-
26-
JSON object passed to fromJson to become the build matrix. Example:
27-
'["ubuntu-latest", "ubuntu-24.04-arm"]'
25+
description: 'JSON array used for build matrix (e.g. ["ubuntu-latest", "ubuntu-24.04-arm"]). Must be valid JSON.'
2826
required: false
2927
type: string
3028
default: '["ubuntu-latest", "ubuntu-24.04-arm"]'
3129
runner-labels:
3230
description: >-
33-
Single runner label OR JSON array of runner labels for non-build jobs.
31+
JSON array of runner labels for non-build jobs.
3432
Examples:
35-
ubuntu-latest
3633
'["ubuntu-latest"]'
3734
'["self-hosted", "linux", "x86_64"]'
38-
Provide a valid JSON array (starting with '[') to use multiple labels; any other value is treated as a single label string.
3935
required: false
4036
type: string
41-
default: ubuntu-latest
37+
default: '["ubuntu-latest"]'
4238
integration-test-file:
4339
description: "Path to the BATS test file to run for integration tests"
4440
required: false
@@ -96,7 +92,7 @@ jobs:
9692
if: ${{ inputs.integration-test-file }}
9793
strategy:
9894
matrix:
99-
runner: ${{ (startsWith(inputs.build-test-runner-labels, '[') && endsWith(inputs.build-test-runner-labels, ']')) && fromJson(inputs.build-test-runner-labels) || inputs.build-test-runner-labels }}
95+
runner: ${{ fromJson(inputs.build-test-runner-labels) }}
10096
needs: build-push
10197
uses: ./.github/workflows/wc-integration-test.yml
10298
permissions:

.github/workflows/wc-build-push.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ jobs:
5757
runner-labels: ${{ inputs.runner-labels }}
5858

5959
build-push:
60-
name: ${{ matrix.runner }}
60+
name: Build (${{ matrix.runner }})
6161
strategy:
6262
matrix:
63-
runner: ${{ (startsWith(inputs.build-test-runner-labels, '[') && endsWith(inputs.build-test-runner-labels, ']')) && fromJson(inputs.build-test-runner-labels) || inputs.build-test-runner-labels }}
63+
runner: ${{ fromJson(inputs.build-test-runner-labels) }}
6464
runs-on: ${{ matrix.runner }}
6565
needs: sanitize-image-name
6666
permissions:
@@ -137,9 +137,7 @@ jobs:
137137

138138
merge-image:
139139
name: 🔗 Merge Image
140-
# Support either a plain single label (e.g. ubuntu-latest) OR a JSON array of labels.
141-
# If the input starts & ends with brackets we attempt JSON parsing; otherwise we pass the raw string.
142-
runs-on: ${{ (startsWith(inputs.runner-labels, '[') && endsWith(inputs.runner-labels, ']')) && fromJson(inputs.runner-labels) || inputs.runner-labels }}
140+
runs-on: ${{ fromJson(inputs.runner-labels) }}
143141
needs:
144142
- build-push
145143
- sanitize-image-name
@@ -159,9 +157,6 @@ jobs:
159157
with:
160158
disable-sudo: true
161159
egress-policy: audit
162-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
163-
with:
164-
persist-credentials: false
165160
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
166161
with:
167162
path: ${{ runner.temp }}/digests

.github/workflows/wc-dependency-review.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ on:
55
workflow_call:
66
inputs:
77
runner-labels:
8-
description: "Runner to use for the job, will be passed to `runs-on`"
8+
description: "JSON array of runner labels (default [\"ubuntu-latest\"]). Must be valid JSON."
99
required: false
1010
type: string
11-
default: ubuntu-latest
11+
default: '["ubuntu-latest"]'
1212

1313
permissions: {}
1414

1515
jobs:
1616
dependency-review:
1717
name: Review
18-
runs-on: ${{ (startsWith(inputs.runner-labels, '[') && endsWith(inputs.runner-labels, ']')) && fromJson(inputs.runner-labels) || inputs.runner-labels }}
18+
runs-on: ${{ fromJson(inputs.runner-labels) }}
1919
permissions:
2020
contents: read
2121
pull-requests: write

.github/workflows/wc-integration-test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ on:
1717
required: true
1818
type: string
1919
runner-labels:
20-
description: "Runner to use for the job, will be passed to `runs-on`"
2120
required: true
2221
type: string
2322
registry:
@@ -36,7 +35,7 @@ permissions: {}
3635
jobs:
3736
run-test:
3837
name: 🧪 Integration Test
39-
runs-on: ${{ (startsWith(inputs.runner-labels, '[') && endsWith(inputs.runner-labels, ']')) && fromJson(inputs.runner-labels) || inputs.runner-labels }}
38+
runs-on: ${{ fromJson(inputs.runner-labels) }}
4039
container:
4140
image: ${{ inputs.fully-qualified-image-name }}@${{ inputs.image-digest }}
4241
credentials:

.github/workflows/wc-sanitize-image-name.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ permissions: {}
2929
jobs:
3030
sanitize:
3131
name: Sanitize Image Name
32-
runs-on: ${{ (startsWith(inputs.runner-labels, '[') && endsWith(inputs.runner-labels, ']')) && fromJson(inputs.runner-labels) || inputs.runner-labels }}
32+
runs-on: ${{ fromJson(inputs.runner-labels) }}
3333
outputs:
3434
image-basename: ${{ steps.sanitize-image-name.outputs.sanitized-basename }}
3535
image-name: ${{ steps.sanitize-image-name.outputs.sanitized-image-name }}

0 commit comments

Comments
 (0)