Skip to content

Commit 1f5b84c

Browse files
justin808claude
andcommitted
Fix workflow issues and improve CI reliability
- Remove duplicate if conditions in examples.yml and main.yml that caused knip YAML parsing errors - Replace SKIP_MINIMUM_ON_PR env var pattern with cleaner matrix-level exclude approach - Add workflow verification in run-skipped-ci.yml to confirm workflows actually start - Improve error handling with detailed status reporting showing verified/pending/failed workflows - Fix actionlint validation errors This eliminates inefficient step-level conditionals and ensures workflows are properly filtered at the job level, making them more efficient and easier to maintain. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a23eff8 commit 1f5b84c

File tree

3 files changed

+74
-99
lines changed

3 files changed

+74
-99
lines changed

.github/workflows/examples.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ jobs:
4141
# Run on master, workflow_dispatch, OR when generators needed
4242
if: |
4343
github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_generators == 'true'
44-
# For master/workflow_dispatch: run all versions
45-
if: |
46-
(github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_generators == 'true') &&
47-
(matrix.dependency-level != 'minimum' || github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch')
4844
strategy:
4945
fail-fast: false
5046
matrix:
@@ -55,25 +51,24 @@ jobs:
5551
# Master and workflow_dispatch: Minimum supported versions (full coverage)
5652
- ruby-version: '3.2'
5753
dependency-level: 'minimum'
54+
exclude:
55+
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch)
56+
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && '3.2' || '' }}
57+
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && 'minimum' || '' }}
5858
env:
59-
# Skip minimum dependency on regular PRs (only run on master or workflow_dispatch)
60-
SKIP_MINIMUM: ${{ matrix.dependency-level == 'minimum' && github.event_name != 'workflow_dispatch' && github.ref != 'refs/heads/master' }}
6159
SKIP_YARN_COREPACK_CHECK: 0
6260
BUNDLE_FROZEN: ${{ matrix.dependency-level == 'minimum' && 'false' || 'true' }}
6361
runs-on: ubuntu-22.04
6462
steps:
6563
- uses: actions/checkout@v4
66-
if: env.SKIP_MINIMUM != 'true'
6764
with:
6865
persist-credentials: false
6966
- name: Setup Ruby
70-
if: env.SKIP_MINIMUM != 'true'
7167
uses: ruby/setup-ruby@v1
7268
with:
7369
ruby-version: ${{ matrix.ruby-version }}
7470
bundler: 2.5.9
7571
- name: Setup Node
76-
if: env.SKIP_MINIMUM != 'true'
7772
uses: actions/setup-node@v4
7873
with:
7974
node-version: 20
@@ -82,7 +77,6 @@ jobs:
8277
# cache: yarn
8378
# cache-dependency-path: '**/yarn.lock'
8479
- name: Print system information
85-
if: env.SKIP_MINIMUM != 'true'
8680
run: |
8781
echo "Linux release: "; cat /etc/issue
8882
echo "Current user: "; whoami
@@ -95,30 +89,25 @@ jobs:
9589
if: matrix.dependency-level == 'minimum'
9690
run: script/convert
9791
- name: Save root ruby gems to cache
98-
if: env.SKIP_MINIMUM != 'true'
9992
uses: actions/cache@v4
10093
with:
10194
path: vendor/bundle
10295
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
10396
- id: get-sha
10497
run: echo "sha=\"$(git rev-parse HEAD)\"" >> "$GITHUB_OUTPUT"
10598
- name: Install Node modules with Yarn for renderer package
106-
if: env.SKIP_MINIMUM != 'true'
10799
run: |
108100
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
109101
sudo yarn global add yalc
110102
- name: yalc publish for react-on-rails
111-
if: env.SKIP_MINIMUM != 'true'
112103
run: yalc publish
113104
- name: Install Ruby Gems for package
114-
if: env.SKIP_MINIMUM != 'true'
115105
run: |
116106
bundle lock --add-platform 'x86_64-linux'
117107
if ! bundle check --path=vendor/bundle; then
118108
bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
119109
fi
120110
- name: Ensure minimum required Chrome version
121-
if: env.SKIP_MINIMUM != 'true'
122111
run: |
123112
echo -e "Already installed $(google-chrome --version)\n"
124113
MINIMUM_REQUIRED_CHROME_VERSION=75
@@ -131,17 +120,13 @@ jobs:
131120
echo -e "\nInstalled $(google-chrome --version)"
132121
fi
133122
- name: Increase the amount of inotify watchers
134-
if: env.SKIP_MINIMUM != 'true'
135123
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
136124
- name: Set packer version environment variable
137-
if: env.SKIP_MINIMUM != 'true'
138125
run: |
139126
echo "CI_DEPENDENCY_LEVEL=${{ matrix.dependency-level }}" >> $GITHUB_ENV
140127
- name: Main CI
141-
if: env.SKIP_MINIMUM != 'true'
142128
run: bundle exec rake run_rspec:shakapacker_examples
143129
- name: Store test results
144-
if: env.SKIP_MINIMUM != 'true'
145130
uses: actions/upload-artifact@v4
146131
with:
147132
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}

.github/workflows/main.yml

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -52,35 +52,26 @@ jobs:
5252
- ruby-version: '3.2'
5353
node-version: '20'
5454
dependency-level: 'minimum'
55+
exclude:
56+
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch)
57+
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && '3.2' || '' }}
58+
node-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && '20' || '' }}
59+
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && 'minimum' || '' }}
5560
runs-on: ubuntu-22.04
56-
env:
57-
# Skip minimum dependency on regular PRs (only run on master or workflow_dispatch)
58-
SKIP_MINIMUM: ${{ matrix.dependency-level == 'minimum' && github.event_name != 'workflow_dispatch' && github.ref != 'refs/heads/master' }}
5961
steps:
60-
- name: Check if job should skip
61-
if: env.SKIP_MINIMUM == 'true'
62-
run: |
63-
echo "Skipping minimum dependency run on regular PR"
64-
echo "Use /run-skipped-ci command to run all versions"
65-
exit 0
66-
6762
- uses: actions/checkout@v4
68-
if: env.SKIP_MINIMUM != 'true'
6963
with:
7064
persist-credentials: false
7165
- name: Setup Ruby
72-
if: env.SKIP_MINIMUM != 'true'
7366
uses: ruby/setup-ruby@v1
7467
with:
7568
ruby-version: ${{ matrix.ruby-version }}
7669
bundler: 2.5.9
7770
# libyaml-dev is needed for psych v5
7871
# this gem depends on sdoc which depends on rdoc which depends on psych
7972
- name: Fix dependency for libyaml-dev
80-
if: env.SKIP_MINIMUM != 'true'
8173
run: sudo apt install libyaml-dev
8274
- name: Setup Node
83-
if: env.SKIP_MINIMUM != 'true'
8475
uses: actions/setup-node@v4
8576
with:
8677
node-version: ${{ matrix.node-version }}
@@ -89,7 +80,6 @@ jobs:
8980
cache: ${{ matrix.node-version != '22' && 'yarn' || '' }}
9081
cache-dependency-path: '**/yarn.lock'
9182
- name: Print system information
92-
if: env.SKIP_MINIMUM != 'true'
9383
run: |
9484
echo "Linux release: "; cat /etc/issue
9585
echo "Current user: "; whoami
@@ -102,43 +92,34 @@ jobs:
10292
if: matrix.dependency-level == 'minimum'
10393
run: script/convert
10494
- name: Install Node modules with Yarn for renderer package
105-
if: env.SKIP_MINIMUM != 'true'
10695
run: |
10796
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
10897
sudo yarn global add yalc
10998
- name: yalc publish for react-on-rails
110-
if: env.SKIP_MINIMUM != 'true'
11199
run: cd packages/react-on-rails && yalc publish
112100
- name: yalc add react-on-rails
113-
if: env.SKIP_MINIMUM != 'true'
114101
run: cd spec/dummy && yalc add react-on-rails
115102
- name: Install Node modules with Yarn for dummy app
116-
if: env.SKIP_MINIMUM != 'true'
117103
run: cd spec/dummy && yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
118104
- name: Save dummy app ruby gems to cache
119-
if: env.SKIP_MINIMUM != 'true'
120105
uses: actions/cache@v4
121106
with:
122107
path: spec/dummy/vendor/bundle
123108
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
124109
- name: Install Ruby Gems for dummy app
125-
if: env.SKIP_MINIMUM != 'true'
126110
run: |
127111
cd spec/dummy
128112
bundle lock --add-platform 'x86_64-linux'
129113
if ! bundle check --path=vendor/bundle; then
130114
bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
131115
fi
132116
- name: generate file system-based packs
133-
if: env.SKIP_MINIMUM != 'true'
134117
run: cd spec/dummy && RAILS_ENV="test" bundle exec rake react_on_rails:generate_packs
135118
- name: Build test bundles for dummy app
136-
if: env.SKIP_MINIMUM != 'true'
137119
run: cd spec/dummy && rm -rf public/webpack/test && yarn run build:rescript && RAILS_ENV="test" NODE_ENV="test" bin/shakapacker
138120
- id: get-sha
139121
run: echo "sha=\"$(git rev-parse HEAD)\"" >> "$GITHUB_OUTPUT"
140122
- name: Save test Webpack bundles to cache (for build number checksum used by RSpec job)
141-
if: env.SKIP_MINIMUM != 'true'
142123
uses: actions/cache/save@v4
143124
with:
144125
path: spec/dummy/public/webpack
@@ -147,13 +128,8 @@ jobs:
147128
dummy-app-integration-tests:
148129
needs: [detect-changes, build-dummy-app-webpack-test-bundles]
149130
# Run on master, workflow_dispatch, OR when tests needed on PR
150-
# For regular PRs: only run latest versions
151131
if: |
152132
github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true'
153-
# For master/workflow_dispatch: run all versions
154-
if: |
155-
(github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true') &&
156-
(matrix.dependency-level != 'minimum' || github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch')
157133
strategy:
158134
fail-fast: false
159135
matrix:
@@ -166,23 +142,22 @@ jobs:
166142
- ruby-version: '3.2'
167143
node-version: '20'
168144
dependency-level: 'minimum'
145+
exclude:
146+
# Skip minimum dependency matrix on regular PRs (run only on master/workflow_dispatch)
147+
- ruby-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && '3.2' || '' }}
148+
node-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && '20' || '' }}
149+
dependency-level: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && 'minimum' || '' }}
169150
runs-on: ubuntu-22.04
170-
env:
171-
# Skip minimum dependency on regular PRs (only run on master or workflow_dispatch)
172-
SKIP_MINIMUM: ${{ matrix.dependency-level == 'minimum' && github.event_name != 'workflow_dispatch' && github.ref != 'refs/heads/master' }}
173151
steps:
174152
- uses: actions/checkout@v4
175-
if: env.SKIP_MINIMUM != 'true'
176153
with:
177154
persist-credentials: false
178155
- name: Setup Ruby
179-
if: env.SKIP_MINIMUM != 'true'
180156
uses: ruby/setup-ruby@v1
181157
with:
182158
ruby-version: ${{ matrix.ruby-version }}
183159
bundler: 2.5.9
184160
- name: Setup Node
185-
if: env.SKIP_MINIMUM != 'true'
186161
uses: actions/setup-node@v4
187162
with:
188163
node-version: ${{ matrix.node-version }}
@@ -191,7 +166,6 @@ jobs:
191166
cache: ${{ matrix.node-version != '22' && 'yarn' || '' }}
192167
cache-dependency-path: '**/yarn.lock'
193168
- name: Print system information
194-
if: env.SKIP_MINIMUM != 'true'
195169
run: |
196170
echo "Linux release: "; cat /etc/issue
197171
echo "Current user: "; whoami
@@ -204,61 +178,50 @@ jobs:
204178
if: matrix.dependency-level == 'minimum'
205179
run: script/convert
206180
- name: Save root ruby gems to cache
207-
if: env.SKIP_MINIMUM != 'true'
208181
uses: actions/cache@v4
209182
with:
210183
path: vendor/bundle
211184
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
212185
- name: Save dummy app ruby gems to cache
213-
if: env.SKIP_MINIMUM != 'true'
214186
uses: actions/cache@v4
215187
with:
216188
path: spec/dummy/vendor/bundle
217189
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
218190
- id: get-sha
219191
run: echo "sha=\"$(git rev-parse HEAD)\"" >> "$GITHUB_OUTPUT"
220192
- name: Save test Webpack bundles to cache (for build number checksum used by RSpec job)
221-
if: env.SKIP_MINIMUM != 'true'
222193
uses: actions/cache@v4
223194
with:
224195
path: spec/dummy/public/webpack
225196
key: dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
226197
- name: Install Node modules with Yarn
227-
if: env.SKIP_MINIMUM != 'true'
228198
run: |
229199
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
230200
sudo yarn global add yalc
231201
- name: yalc publish for react-on-rails
232-
if: env.SKIP_MINIMUM != 'true'
233202
run: cd packages/react-on-rails && yalc publish
234203
- name: yalc add react-on-rails
235-
if: env.SKIP_MINIMUM != 'true'
236204
run: cd spec/dummy && yalc add react-on-rails
237205
- name: Install Node modules with Yarn for dummy app
238-
if: env.SKIP_MINIMUM != 'true'
239206
run: cd spec/dummy && yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
240207
- name: Dummy JS tests
241-
if: env.SKIP_MINIMUM != 'true'
242208
run: |
243209
cd spec/dummy
244210
yarn run test:js
245211
- name: Install Ruby Gems for package
246-
if: env.SKIP_MINIMUM != 'true'
247212
run: |
248213
bundle lock --add-platform 'x86_64-linux'
249214
if ! bundle check --path=vendor/bundle; then
250215
bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
251216
fi
252217
- name: Install Ruby Gems for dummy app
253-
if: env.SKIP_MINIMUM != 'true'
254218
run: |
255219
cd spec/dummy
256220
bundle lock --add-platform 'x86_64-linux'
257221
if ! bundle check --path=vendor/bundle; then
258222
bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
259223
fi
260224
- name: Ensure minimum required Chrome version
261-
if: env.SKIP_MINIMUM != 'true'
262225
run: |
263226
echo -e "Already installed $(google-chrome --version)\n"
264227
MINIMUM_REQUIRED_CHROME_VERSION=75
@@ -271,10 +234,8 @@ jobs:
271234
echo -e "\nInstalled $(google-chrome --version)"
272235
fi
273236
- name: Increase the amount of inotify watchers
274-
if: env.SKIP_MINIMUM != 'true'
275237
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
276238
- name: generate file system-based packs
277-
if: env.SKIP_MINIMUM != 'true'
278239
run: cd spec/dummy && RAILS_ENV="test" bundle exec rake react_on_rails:generate_packs
279240
- name: Git Stuff
280241
if: matrix.dependency-level == 'minimum'
@@ -284,32 +245,26 @@ jobs:
284245
git commit -am "stop generators from complaining about uncommitted code"
285246
- run: cd spec/dummy && bundle info shakapacker
286247
- name: Set packer version environment variable
287-
if: env.SKIP_MINIMUM != 'true'
288248
run: |
289249
echo "CI_DEPENDENCY_LEVEL=ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}" >> $GITHUB_ENV
290250
- name: Main CI
291-
if: env.SKIP_MINIMUM != 'true'
292251
run: bundle exec rake run_rspec:all_dummy
293252
- name: Store test results
294-
if: env.SKIP_MINIMUM != 'true'
295253
uses: actions/upload-artifact@v4
296254
with:
297255
name: main-rspec-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
298256
path: ~/rspec
299257
- name: Store artifacts
300-
if: env.SKIP_MINIMUM != 'true'
301258
uses: actions/upload-artifact@v4
302259
with:
303260
name: dummy-app-capybara-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
304261
path: spec/dummy/tmp/capybara
305262
- name: Store artifacts
306-
if: env.SKIP_MINIMUM != 'true'
307263
uses: actions/upload-artifact@v4
308264
with:
309265
name: dummy-app-test-log-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}
310266
path: spec/dummy/log/test.log
311267
- name: Store artifacts
312-
if: env.SKIP_MINIMUM != 'true'
313268
uses: actions/upload-artifact@v4
314269
with:
315270
name: dummy-app-yarn-log-${{ github.run_id }}-${{ github.job }}-ruby${{ matrix.ruby-version }}-${{ matrix.dependency-level }}

0 commit comments

Comments
 (0)