Skip to content

Commit 5b97ab0

Browse files
authored
Merge pull request #241 from ruby-go-gem/matrix_json
Extract CI matrix values to matrix.json
2 parents 4197f9d + feb07e3 commit 5b97ab0

File tree

4 files changed

+73
-31
lines changed

4 files changed

+73
-31
lines changed

.github/workflows/build.yml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,38 @@ env:
2323
TEST_GEM_DIR: ruby/testdata/example/
2424

2525
jobs:
26+
generate-matrix:
27+
runs-on: ubuntu-latest
28+
29+
outputs:
30+
matrix: ${{ steps.set-matrix.outputs.matrix }}
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- id: set-matrix
36+
run: echo "matrix=$(cat matrix.json | jq -c)" >> $GITHUB_OUTPUT
37+
working-directory: .github/workflows/
38+
2639
test:
27-
name: "test (Go ${{ matrix.golang }}, Ruby ${{ matrix.ruby }})"
40+
name: "test (Go ${{ matrix.go }}, Ruby ${{ matrix.ruby }})"
41+
42+
needs:
43+
- generate-matrix
2844

2945
runs-on: ubuntu-latest
3046

3147
strategy:
3248
fail-fast: false
3349

34-
matrix:
35-
golang:
36-
# TODO: Enable after repo is published
37-
# - "1.22"
38-
- "1.23"
39-
ruby:
40-
- "3.3"
50+
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
4151

4252
steps:
4353
- uses: actions/checkout@v4
4454

4555
- uses: actions/setup-go@v5
4656
with:
47-
go-version: ${{ matrix.golang }}
57+
go-version: ${{ matrix.go }}
4858

4959
- uses: ruby/setup-ruby@v1
5060
with:
@@ -89,14 +99,16 @@ jobs:
8999
go-lint:
90100
name: "go-lint (Ruby ${{ matrix.ruby }})"
91101

102+
needs:
103+
- generate-matrix
104+
92105
runs-on: ubuntu-latest
93106

94107
strategy:
95108
fail-fast: false
96109

97110
matrix:
98-
ruby:
99-
- "3.3"
111+
ruby: ${{ fromJSON(needs.generate-matrix.outputs.matrix).ruby }}
100112

101113
steps:
102114
- uses: actions/checkout@v4
@@ -184,14 +196,16 @@ jobs:
184196
go_gem:
185197
name: "go_gem (Ruby ${{ matrix.ruby }})"
186198

199+
needs:
200+
- generate-matrix
201+
187202
runs-on: ubuntu-latest
188203

189204
strategy:
190205
fail-fast: false
191206

192207
matrix:
193-
ruby:
194-
- "3.3"
208+
ruby: ${{ fromJSON(needs.generate-matrix.outputs.matrix).ruby }}
195209

196210
steps:
197211
- uses: actions/checkout@v4

.github/workflows/matrix.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"go": [
3+
"1.23"
4+
],
5+
"ruby": [
6+
"3.3"
7+
]
8+
}

.github/workflows/patch_for_go_gem.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,38 @@ defaults:
2020
working-directory: _tools/patch_for_go_gem/
2121

2222
jobs:
23+
generate-matrix:
24+
runs-on: ubuntu-latest
25+
26+
outputs:
27+
matrix: ${{ steps.set-matrix.outputs.matrix }}
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- id: set-matrix
33+
run: echo "matrix=$(cat matrix.json | jq -c)" >> $GITHUB_OUTPUT
34+
working-directory: .github/workflows/
35+
2336
test:
24-
name: "test (Go ${{ matrix.golang }}, Ruby ${{ matrix.ruby }})"
37+
name: "test (Go ${{ matrix.go }}, Ruby ${{ matrix.ruby }})"
38+
39+
needs:
40+
- generate-matrix
2541

2642
runs-on: ubuntu-latest
2743

2844
strategy:
2945
fail-fast: false
3046

31-
matrix:
32-
golang:
33-
# TODO: Enable after repo is published
34-
# - "1.22"
35-
- "1.23"
36-
ruby:
37-
- "3.3"
47+
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
3848

3949
steps:
4050
- uses: actions/checkout@v4
4151

4252
- uses: actions/setup-go@v5
4353
with:
44-
go-version: ${{ matrix.golang }}
54+
go-version: ${{ matrix.go }}
4555

4656
- uses: ruby/setup-ruby@v1
4757
with:

.github/workflows/ruby_h_to_go.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,38 @@ defaults:
2020
working-directory: _tools/ruby_h_to_go/
2121

2222
jobs:
23+
generate-matrix:
24+
runs-on: ubuntu-latest
25+
26+
outputs:
27+
matrix: ${{ steps.set-matrix.outputs.matrix }}
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- id: set-matrix
33+
run: echo "matrix=$(cat matrix.json | jq -c)" >> $GITHUB_OUTPUT
34+
working-directory: .github/workflows/
35+
2336
test:
24-
name: "test (Go ${{ matrix.golang }}, Ruby ${{ matrix.ruby }})"
37+
name: "test (Go ${{ matrix.go }}, Ruby ${{ matrix.ruby }})"
38+
39+
needs:
40+
- generate-matrix
2541

2642
runs-on: ubuntu-latest
2743

2844
strategy:
2945
fail-fast: false
3046

31-
matrix:
32-
golang:
33-
# TODO: Enable after repo is published
34-
# - "1.22"
35-
- "1.23"
36-
ruby:
37-
- "3.3"
47+
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
3848

3949
steps:
4050
- uses: actions/checkout@v4
4151

4252
- uses: actions/setup-go@v5
4353
with:
44-
go-version: ${{ matrix.golang }}
54+
go-version: ${{ matrix.go }}
4555

4656
- uses: ruby/setup-ruby@v1
4757
with:

0 commit comments

Comments
 (0)