Skip to content

Commit de2e8e2

Browse files
committed
Setup a dynamic list of supported os for testing
1 parent 3d24cfc commit de2e8e2

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

.github/workflows/ci-scripts-build.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,43 @@ on:
1212
push:
1313
paths:
1414
- client/**
15+
- .github/workflows/ci-scripts-build.yml
1516
pull_request:
1617
paths:
1718
- client/**
19+
- .github/workflows/ci-scripts-build.yml
1820

1921
env:
2022
SETUP_PATH: .ci-local:.ci
2123
EPICS_TEST_IMPRECISE_TIMING: YES
2224

2325
jobs:
26+
prepare_matrix:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
matrix: ${{ steps.set_matrix.outputs.matrix }}
30+
steps:
31+
- name: Checkout runner-images repository
32+
uses: actions/checkout@v4
33+
with:
34+
repository: 'actions/runner-images'
35+
path: 'runner-images'
36+
37+
- name: Generate matrix of supported images
38+
id: set_matrix
39+
run: |
40+
# This script will find all the JSON files for Linux, Windows, and macOS images,
41+
# extract the 'imageName' field, and create a JSON array.
42+
# We are targeting the image definitions that contain version numbers, and creating
43+
# separate lists for each OS.
44+
images=$(find runner-images/images -name "*.json" -type f -exec grep -l '"imageName":' {} + | xargs -I {} grep -o '"imageName": "[^"]*' {} | sed 's/"imageName": "//' | grep -E 'ubuntu-2[2-9]\.04|windows-202[2-9]|macos-1[3-9]')
45+
linux_images=$(echo "$images" | grep "ubuntu" | jq -R . | jq -s .)
46+
macos_images=$(echo "$images" | grep "macos" | jq -R . | jq -s .)
47+
windows_images=$(echo "$images" | grep "windows" | jq -R . | jq -s .)
48+
echo "matrix={\"linux\":${linux_images}, \"macos\":${macos_images}, \"windows\":${windows_images}}" >> $GITHUB_OUTPUT
2449
2550
build-linux:
51+
needs: prepare_matrix
2652
defaults:
2753
run:
2854
working-directory: client
@@ -34,7 +60,7 @@ jobs:
3460
strategy:
3561
fail-fast: false
3662
matrix:
37-
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04]
63+
os: ${{ fromJSON(needs.prepare_matrix.outputs.matrix).linux }}
3864
cmp: [gcc, clang]
3965
configuration: [default, static, debug, static-debug]
4066
steps:
@@ -51,6 +77,7 @@ jobs:
5177
run: python .ci/cue.py test-results
5278

5379
build-macos:
80+
needs: prepare_matrix
5481
defaults:
5582
run:
5683
working-directory: client
@@ -62,7 +89,7 @@ jobs:
6289
strategy:
6390
fail-fast: false
6491
matrix:
65-
os: [macos-14, macos-13]
92+
os: ${{ fromJSON(needs.prepare_matrix.outputs.matrix).macos }}
6693
cmp: [clang]
6794
configuration: [default, debug]
6895
steps:
@@ -90,7 +117,7 @@ jobs:
90117
strategy:
91118
fail-fast: false
92119
matrix:
93-
os: [windows-2022, windows-2019]
120+
os: ${{ fromJSON(needs.prepare_matrix.outputs.matrix).windows }}
94121
cmp: [gcc, vs2022, vs2019]
95122
configuration: [default, static, debug, static-debug]
96123
exclude:

0 commit comments

Comments
 (0)