Skip to content

Commit 1cb3a3a

Browse files
committed
try using arrays in workflow expression for matrix
1 parent d8205a6 commit 1cb3a3a

File tree

4 files changed

+61
-74
lines changed

4 files changed

+61
-74
lines changed

.github/workflows/examples.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,29 @@ jobs:
6565
strategy:
6666
fail-fast: false
6767
matrix:
68-
include:
69-
# Always run: Latest versions (fast feedback on PRs)
70-
- ruby-version: '3.4'
71-
dependency-level: 'latest'
72-
# Master and workflow_dispatch: Minimum supported versions (full coverage)
73-
- ruby-version: '3.2'
74-
dependency-level: 'minimum'
75-
exclude:
76-
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch/force_run/full-ci label)
77-
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && inputs.force_run != true && needs.detect-changes.outputs.has_full_ci_label != 'true' && '3.2' || '' }}
78-
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && inputs.force_run != true && needs.detect-changes.outputs.has_full_ci_label != 'true' && 'minimum' || '' }}
68+
dependency-level: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && ['minimum'] || ['latest', 'minimum']}}
7969
env:
8070
SKIP_YARN_COREPACK_CHECK: 0
8171
BUNDLE_FROZEN: ${{ matrix.dependency-level == 'minimum' && 'false' || 'true' }}
8272
runs-on: ubuntu-22.04
8373
steps:
74+
- name: Translate matrix for Ruby and Node versions
75+
id: translate-matrix
76+
run: |
77+
if [ "${{ matrix.dependency-level }}" == "latest" ]; then
78+
echo "ruby-version=3.4" >> "$GITHUB_OUTPUT"
79+
echo "node-version=22" >> "$GITHUB_OUTPUT"
80+
else
81+
echo "ruby-version=3.2" >> "$GITHUB_OUTPUT"
82+
echo "node-version=20" >> "$GITHUB_OUTPUT"
83+
fi
8484
- uses: actions/checkout@v4
8585
with:
8686
persist-credentials: false
8787
- name: Setup Ruby
8888
uses: ruby/setup-ruby@v1
8989
with:
90-
ruby-version: ${{ matrix.ruby-version }}
90+
ruby-version: ${{ steps.translate-matrix.outputs.ruby-version }}
9191
bundler: 2.5.9
9292
- name: Setup Node
9393
uses: actions/setup-node@v4
@@ -113,7 +113,7 @@ jobs:
113113
uses: actions/cache@v4
114114
with:
115115
path: vendor/bundle
116-
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
116+
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
117117
- id: get-sha
118118
run: echo "sha=\"$(git rev-parse HEAD)\"" >> "$GITHUB_OUTPUT"
119119
- name: Install Node modules with Yarn for renderer package
@@ -150,5 +150,5 @@ jobs:
150150
- name: Store test results
151151
uses: actions/upload-artifact@v4
152152
with:
153-
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
153+
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
154154
path: ~/rspec

.github/workflows/gem-tests.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,7 @@ jobs:
6969
strategy:
7070
fail-fast: false
7171
matrix:
72-
include:
73-
# Always run: Latest versions (fast feedback on PRs)
74-
- ruby-version: '3.4'
75-
dependency-level: 'latest'
76-
# Master and full-ci label: Minimum supported versions (full coverage)
77-
- ruby-version: '3.2'
78-
dependency-level: 'minimum'
79-
exclude:
80-
# Skip minimum dependency matrix on regular PRs (run only on master or with full-ci label)
81-
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && needs.detect-changes.outputs.has_full_ci_label != 'true' && '3.2' || '' }}
82-
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && needs.detect-changes.outputs.has_full_ci_label != 'true' && 'minimum' || '' }}
72+
dependency-level: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && ['minimum'] || ['latest', 'minimum']}}
8373
env:
8474
BUNDLE_FROZEN: ${{ matrix.dependency-level == 'minimum' && 'false' || 'true' }}
8575
runs-on: ubuntu-22.04
@@ -90,7 +80,7 @@ jobs:
9080
- name: Setup Ruby
9181
uses: ruby/setup-ruby@v1
9282
with:
93-
ruby-version: ${{ matrix.ruby-version }}
83+
ruby-version: ${{ steps.translate-matrix.outputs.ruby-version }}
9484
bundler: 2.5.9
9585
- name: Print system information
9686
run: |
@@ -108,7 +98,7 @@ jobs:
10898
uses: actions/cache@v4
10999
with:
110100
path: vendor/bundle
111-
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
101+
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
112102
- name: Install Ruby Gems for package
113103
run: bundle check --path=vendor/bundle || bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
114104
- name: Git Stuff
@@ -125,10 +115,10 @@ jobs:
125115
- name: Store test results
126116
uses: actions/upload-artifact@v4
127117
with:
128-
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
118+
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
129119
path: ~/rspec
130120
- name: Store artifacts
131121
uses: actions/upload-artifact@v4
132122
with:
133-
name: main-test-log-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
123+
name: main-test-log-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
134124
path: log/test.log

.github/workflows/integration-tests.yml

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,28 @@ jobs:
6464
if: |
6565
github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true'
6666
strategy:
67+
fail-fast: false
6768
matrix:
68-
ruby-version: ['3.4']
69-
node-version: ['22']
70-
dependency-level: ['latest']
71-
include:
72-
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch/force_run/full-ci label)
73-
- ruby-version: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && '3.2'}}
74-
node-version: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && '20'}}
75-
dependency-level: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && 'minimum'}}
69+
dependency-level: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && ['minimum'] || ['latest', 'minimum']}}
7670
runs-on: ubuntu-22.04
7771
steps:
72+
- name: Translate matrix for Ruby and Node versions
73+
id: translate-matrix
74+
run: |
75+
if [ "${{ matrix.dependency-level }}" == "latest" ]; then
76+
echo "ruby-version=3.4" >> "$GITHUB_OUTPUT"
77+
echo "node-version=22" >> "$GITHUB_OUTPUT"
78+
else
79+
echo "ruby-version=3.2" >> "$GITHUB_OUTPUT"
80+
echo "node-version=20" >> "$GITHUB_OUTPUT"
81+
fi
7882
- uses: actions/checkout@v4
7983
with:
8084
persist-credentials: false
8185
- name: Setup Ruby
8286
uses: ruby/setup-ruby@v1
8387
with:
84-
ruby-version: ${{ matrix.ruby-version }}
88+
ruby-version: ${{ steps.translate-matrix.outputs.ruby-version }}
8589
bundler: 2.5.9
8690
# libyaml-dev is needed for psych v5
8791
# this gem depends on sdoc which depends on rdoc which depends on psych
@@ -90,10 +94,10 @@ jobs:
9094
- name: Setup Node
9195
uses: actions/setup-node@v4
9296
with:
93-
node-version: ${{ matrix.node-version }}
97+
node-version: ${{ steps.translate-matrix.outputs.node-version }}
9498
# Disable cache for Node 22 due to V8 bug in 22.21.0
9599
# https://github.com/nodejs/node/issues/56010
96-
cache: ${{ matrix.node-version != '22' && 'yarn' || '' }}
100+
cache: yarn
97101
cache-dependency-path: '**/yarn.lock'
98102
- name: Print system information
99103
run: |
@@ -121,7 +125,7 @@ jobs:
121125
uses: actions/cache@v4
122126
with:
123127
path: spec/dummy/vendor/bundle
124-
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
128+
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
125129
- name: Install Ruby Gems for dummy app
126130
run: |
127131
cd spec/dummy
@@ -139,45 +143,44 @@ jobs:
139143
uses: actions/cache/save@v4
140144
with:
141145
path: spec/dummy/public/webpack
142-
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
146+
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
143147

144148
spec-dummy-integration-tests:
145149
needs: [detect-changes, build-dummy-app-webpack-test-bundles]
146150
# Run on master, workflow_dispatch, OR when tests needed on PR
147151
if: |
148152
github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true'
149153
strategy:
154+
fail-fast: false
150155
matrix:
151-
ruby-version: ['3.4']
152-
node-version: ['22']
153-
dependency-level: ['latest']
154-
include:
155-
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch/force_run/full-ci label)
156-
- ruby-version: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && '3.2'}}
157-
node-version: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && '20'}}
158-
dependency-level: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && 'minimum'}}
159-
exclude:
160-
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch/force_run/full-ci label)
161-
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && inputs.force_run != true && needs.detect-changes.outputs.has_full_ci_label != 'true' && '3.2' || '' }}
162-
node-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && inputs.force_run != true && needs.detect-changes.outputs.has_full_ci_label != 'true' && '20' || '' }}
163-
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && inputs.force_run != true && needs.detect-changes.outputs.has_full_ci_label != 'true' && 'minimum' || '' }}
156+
dependency-level: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && ['minimum'] || ['latest', 'minimum']}}
164157
runs-on: ubuntu-22.04
165158
steps:
159+
- name: Translate matrix for Ruby and Node versions
160+
id: translate-matrix
161+
run: |
162+
if [ "${{ matrix.dependency-level }}" == "latest" ]; then
163+
echo "ruby-version=3.4" >> "$GITHUB_OUTPUT"
164+
echo "node-version=22" >> "$GITHUB_OUTPUT"
165+
else
166+
echo "ruby-version=3.2" >> "$GITHUB_OUTPUT"
167+
echo "node-version=20" >> "$GITHUB_OUTPUT"
168+
fi
166169
- uses: actions/checkout@v4
167170
with:
168171
persist-credentials: false
169172
- name: Setup Ruby
170173
uses: ruby/setup-ruby@v1
171174
with:
172-
ruby-version: ${{ matrix.ruby-version }}
175+
ruby-version: ${{ steps.translate-matrix.outputs.ruby-version }}
173176
bundler: 2.5.9
174177
- name: Setup Node
175178
uses: actions/setup-node@v4
176179
with:
177-
node-version: ${{ matrix.node-version }}
180+
node-version: ${{ steps.translate-matrix.outputs.node-version }}
178181
# Disable cache for Node 22 due to V8 bug in 22.21.0
179182
# https://github.com/nodejs/node/issues/56010
180-
cache: ${{ matrix.node-version != '22' && 'yarn' || '' }}
183+
cache: yarn
181184
cache-dependency-path: '**/yarn.lock'
182185
- name: Print system information
183186
run: |
@@ -195,19 +198,19 @@ jobs:
195198
uses: actions/cache@v4
196199
with:
197200
path: vendor/bundle
198-
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
201+
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
199202
- name: Save dummy app ruby gems to cache
200203
uses: actions/cache@v4
201204
with:
202205
path: spec/dummy/vendor/bundle
203-
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
206+
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
204207
- id: get-sha
205208
run: echo "sha=\"$(git rev-parse HEAD)\"" >> "$GITHUB_OUTPUT"
206209
- name: Save test Webpack bundles to cache (for build number checksum used by RSpec job)
207210
uses: actions/cache@v4
208211
with:
209212
path: spec/dummy/public/webpack
210-
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
213+
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
211214
- name: Install Node modules with Yarn
212215
run: |
213216
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
@@ -260,26 +263,26 @@ jobs:
260263
- run: cd spec/dummy && bundle info shakapacker
261264
- name: Set packer version environment variable
262265
run: |
263-
echo "CI_DEPENDENCY_LEVEL=ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}" >> $GITHUB_ENV
266+
echo "CI_DEPENDENCY_LEVEL=ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}" >> $GITHUB_ENV
264267
- name: Main CI
265268
run: bundle exec rake run_rspec:all_dummy
266269
- name: Store test results
267270
uses: actions/upload-artifact@v4
268271
with:
269-
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
272+
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
270273
path: ~/rspec
271274
- name: Store artifacts
272275
uses: actions/upload-artifact@v4
273276
with:
274-
name: dummy-app-capybara-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
277+
name: dummy-app-capybara-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
275278
path: spec/dummy/tmp/capybara
276279
- name: Store artifacts
277280
uses: actions/upload-artifact@v4
278281
with:
279-
name: dummy-app-test-log-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
282+
name: dummy-app-test-log-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
280283
path: spec/dummy/log/test.log
281284
- name: Store artifacts
282285
uses: actions/upload-artifact@v4
283286
with:
284-
name: dummy-app-yarn-log-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
287+
name: dummy-app-yarn-log-${{ github.run_id }}-${{ github.job }}-ruby${{ steps.translate-matrix.outputs.ruby-version }}-${{ matrix.dependency-level }}
285288
path: spec/dummy/yarn-error.log

.github/workflows/package-js-tests.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,9 @@ jobs:
6969
if: |
7070
(github.ref == 'refs/heads/master' || needs.detect-changes.outputs.run_js_tests == 'true')
7171
strategy:
72+
fail-fast: false
7273
matrix:
73-
include:
74-
# Always run: Latest Node version (fast feedback on PRs)
75-
- node-version: '22'
76-
# Master and full-ci label: Minimum supported Node version (full coverage)
77-
- node-version: '20'
78-
exclude:
79-
# Skip minimum dependency matrix on regular PRs (run only on master or with full-ci label)
80-
- node-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && needs.detect-changes.outputs.has_full_ci_label != 'true' && '20' || '' }}
74+
node-version: ${{ (github.ref == 'refs/heads/master' || inputs.force_run == true || needs.detect-changes.outputs.has_full_ci_label == 'true') && ['20'] || ['22', '20']}}
8175
runs-on: ubuntu-22.04
8276
steps:
8377
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)