Skip to content

Commit c62b00d

Browse files
committed
test: generate the test set dynamically
Generate the test matrix using the last two stable tags automatically, this way we only have to update the LTS list manually. Signed-off-by: Fabio Baltieri <[email protected]>
1 parent e5be50a commit c62b00d

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

.github/workflows/test.yaml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,33 @@ concurrency:
99
cancel-in-progress: true
1010

1111
jobs:
12+
generate-matrix:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
matrix: ${{ steps.set-matrix.outputs.matrix }}
16+
steps:
17+
- name: Generate dynamic matrix data
18+
id: set-matrix
19+
run: |
20+
OS='"ubuntu-24.04", "ubuntu-24.04-arm", "macos-13", "macos-14", "macos-15", "windows-2022"'
21+
RELEASE='"v3.7.0", "main"'
22+
23+
last_releases=$( git ls-remote --tags https://github.com/zephyrproject-rtos/zephyr.git 'v*' | grep -E 'refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$' | cut -d/ -f3 | tail -n2 )
24+
for r in $last_releases; do
25+
RELEASE="$RELEASE, \"$r\""
26+
echo $RELEASE
27+
done
28+
29+
MATRIX_JSON="{\"os\": [$OS], \"release\": [$RELEASE]}"
30+
echo $MATRIX_JSON
31+
32+
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
33+
1234
build:
35+
needs: generate-matrix
1336
strategy:
1437
fail-fast: false
15-
matrix:
16-
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-13, macos-14, macos-15, windows-2022]
17-
release: [v3.7.0, v4.1.0, v4.2.0, main]
38+
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
1839
runs-on: ${{ matrix.os }}
1940
steps:
2041
- name: Checkout

0 commit comments

Comments
 (0)