Skip to content

Commit fde94c5

Browse files
committed
CI: Generate matrix dynamically
1 parent dd535a2 commit fde94c5

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

.github/workflows/test.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,29 @@ 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:
19-
include:
20-
- ruby: "2.7"
21-
- ruby: "3.0"
22-
- ruby: "3.1"
23-
- ruby: "3.2"
36+
ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
2437
steps:
2538
- uses: actions/checkout@v4
2639
- name: Install Ruby ${{ matrix.ruby }}
@@ -32,10 +45,16 @@ jobs:
3245
run: bundle exec rake rubocop
3346
- name: Build the gem
3447
run: gem build --strict --verbose *.gemspec
48+
3549
tests:
50+
if: always()
3651
needs:
52+
- rubocop_and_matrix
3753
- test
38-
runs-on: ubuntu-latest
54+
runs-on: ubuntu-24.04
3955
name: Test suite
4056
steps:
41-
- run: echo Test suite completed
57+
- name: Decide whether the needed jobs succeeded or failed
58+
uses: re-actors/alls-green@release/v1
59+
with:
60+
jobs: ${{ toJSON(needs) }}

0 commit comments

Comments
 (0)