Skip to content

Commit 675b415

Browse files
committed
#1: add jq workflow matrix filter examples
1 parent ed8a55b commit 675b415

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/build-and-test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,20 @@ jobs:
2323
name: Get matrix
2424
runs-on: ubuntu-latest
2525
steps:
26+
# Note: Filtering the test environments
27+
# A jq query can be used to filter the matrix of test environments
28+
# - All (default): `matrix=$(cat github.json | jq '.matrix')`
29+
# - CLang only: `matrix=$(cat github.json | jq '.matrix | map(select(.label | contains("clang")))')`
30+
# - gcc>=11: `matrix=$(cat github.json | jq '.matrix | map(select(.name | test("gcc-[1-9][1-9]+")))')`
31+
# - gcc>=11|clang>=14 `matrix=$(cat github.json | jq '.matrix | map(select(.name | test("gcc-[1-9][1-9]+-|clang-[1-9][2-9]+")))')`
2632
- name: Get matrix
2733
id: get-matrix
2834
run: |
2935
wget https://raw.githubusercontent.com/${{ env.CI_REPO }}/refs/heads/${{ env.CI_BRANCH }}/ci/shared/matrix/github.json
3036
matrix=$(cat github.json | jq '.matrix')
3137
echo "runner=$(echo $matrix)" >> $GITHUB_OUTPUT
38+
39+
3240
outputs:
3341
matrix: ${{ steps.get-matrix.outputs.runner }}
3442

0 commit comments

Comments
 (0)