Skip to content

Commit 91f69c2

Browse files
committed
CI: Generate matrix dynamically
1 parent 97f08b5 commit 91f69c2

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

.github/workflows/test.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,30 @@ permissions:
1111
contents: read
1212

1313
jobs:
14+
rubocop_and_matrix:
15+
runs-on: ubuntu-24.04
16+
outputs:
17+
ruby: ${{ steps.ruby.outputs.versions }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Install Ruby ${{ matrix.ruby }}
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: "3.4"
24+
bundler-cache: true
25+
- name: Run Rubocop
26+
run: bundle exec rake rubocop
27+
- id: ruby
28+
uses: voxpupuli/ruby-version@v1
29+
1430
test:
15-
runs-on: ubuntu-latest
31+
runs-on: ubuntu-24.04
32+
needs: rubocop_and_matrix
1633
strategy:
1734
fail-fast: false
1835
matrix:
1936
include:
20-
- ruby: "3.2"
37+
ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
2138
steps:
2239
- uses: actions/checkout@v4
2340
- name: Install Ruby ${{ matrix.ruby }}
@@ -29,10 +46,16 @@ jobs:
2946
run: bundle exec rake rubocop
3047
- name: Build the gem
3148
run: gem build --strict --verbose *.gemspec
49+
3250
tests:
51+
if: always()
3352
needs:
53+
- rubocop_and_matrix
3454
- test
35-
runs-on: ubuntu-latest
55+
runs-on: ubuntu-24.04
3656
name: Test suite
3757
steps:
38-
- run: echo Test suite completed
58+
- name: Decide whether the needed jobs succeeded or failed
59+
uses: re-actors/alls-green@release/v1
60+
with:
61+
jobs: ${{ toJSON(needs) }}

0 commit comments

Comments
 (0)