Skip to content

Commit 3efe9b8

Browse files
committed
Merge remote-tracking branch 'origin/master' into alexeyr/rubocop-config
2 parents 957ce1d + 57de0bc commit 3efe9b8

File tree

90 files changed

+4267
-678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+4267
-678
lines changed

.bundle-size-skip-branch

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file allows skipping the bundle size CI check for a specific branch.
2+
# When a branch name in this file matches the PR branch, the size check is skipped.
3+
#
4+
# Usage: Run `bin/skip-bundle-size-check` to set the current branch, then commit and push.
5+
#
6+
# This is useful when you have an intentional size increase that exceeds the 0.5KB threshold.

.claude/docs/analysis/AI_AGENT_INSTRUCTIONS.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/actionlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint JS and Ruby
1+
name: Lint GitHub Actions
22

33
on:
44
push:

.github/workflows/bundle-size.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Bundle Size
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'packages/**'
7+
- 'package.json'
8+
- 'pnpm-lock.yaml'
9+
- '.size-limit.json'
10+
- '.github/workflows/bundle-size.yml'
11+
- '.bundle-size-skip-branch'
12+
13+
jobs:
14+
check-skip:
15+
runs-on: ubuntu-22.04
16+
outputs:
17+
skip: ${{ steps.skip-check.outputs.skip }}
18+
steps:
19+
- name: Checkout PR branch
20+
uses: actions/checkout@v4
21+
22+
- name: Check if branch should skip size check
23+
id: skip-check
24+
env:
25+
BRANCH: ${{ github.head_ref }}
26+
run: |
27+
SKIP_FILE=".bundle-size-skip-branch"
28+
SKIP_BRANCH=$(grep -v '^[[:space:]]*#' "$SKIP_FILE" 2>/dev/null | grep -v '^[[:space:]]*$' | tr -d '[:space:]' || echo "")
29+
if [ "$SKIP_BRANCH" = "$BRANCH" ]; then
30+
echo "skip=true" >> $GITHUB_OUTPUT
31+
echo "::notice::Branch '$BRANCH' is set to skip size check"
32+
else
33+
echo "skip=false" >> $GITHUB_OUTPUT
34+
fi
35+
36+
check-bundle-size:
37+
needs: check-skip
38+
if: needs.check-skip.outputs.skip != 'true'
39+
runs-on: ubuntu-22.04
40+
permissions:
41+
contents: read
42+
pull-requests: write
43+
env:
44+
CI_JOB_NUMBER: 1
45+
steps:
46+
- name: Setup Node
47+
uses: actions/setup-node@v4
48+
with:
49+
node-version: '22'
50+
51+
- name: Setup pnpm
52+
uses: pnpm/action-setup@v4
53+
with:
54+
version: 9
55+
56+
# 1. Get PR's size-limit config first (base branch may not have it)
57+
- name: Checkout PR branch for config
58+
uses: actions/checkout@v4
59+
60+
- name: Save size-limit config
61+
run: cp .size-limit.json /tmp/size-limit-config.json
62+
63+
# 2. Get base branch sizes
64+
- name: Checkout base branch
65+
uses: actions/checkout@v4
66+
with:
67+
ref: ${{ github.base_ref }}
68+
69+
- name: Copy size-limit config to base branch
70+
run: cp /tmp/size-limit-config.json .size-limit.json
71+
72+
- name: Install base dependencies
73+
run: pnpm install --frozen-lockfile
74+
75+
- name: Build base branch
76+
run: pnpm run build
77+
78+
- name: Verify build artifacts
79+
run: |
80+
missing=0
81+
for pkg in react-on-rails react-on-rails-pro react-on-rails-pro-node-renderer; do
82+
if ! ls packages/$pkg/lib/*.js >/dev/null 2>&1; then
83+
echo "::error::Missing build artifacts in packages/$pkg/lib/"
84+
missing=1
85+
fi
86+
done
87+
if [ $missing -eq 1 ]; then
88+
exit 1
89+
fi
90+
echo "All build artifacts verified"
91+
92+
- name: Measure base branch sizes
93+
run: |
94+
pnpm exec size-limit --json > /tmp/base-sizes.json
95+
echo "Base branch sizes:"
96+
cat /tmp/base-sizes.json
97+
98+
# 3. Checkout PR and set dynamic limits
99+
- name: Checkout PR branch
100+
uses: actions/checkout@v4
101+
102+
- name: Install PR dependencies
103+
run: pnpm install --frozen-lockfile
104+
105+
- name: Set dynamic limits (base + 0.5KB)
106+
run: node scripts/bundle-size.mjs set-limits --base /tmp/base-sizes.json
107+
108+
- name: Copy .size-limit.json file with limits to tmp directory
109+
run: cp .size-limit.json /tmp/.size-limit-with-limits.json
110+
111+
# 4. Run the action with dynamic limits
112+
- name: Check bundle size
113+
uses: andresz1/size-limit-action@v1
114+
with:
115+
github_token: ${{ secrets.GITHUB_TOKEN }}
116+
package_manager: pnpm
117+
build_script: build-for-size-limit
118+
skip_step: install

.github/workflows/examples.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
echo "Node version: "; node -v
138138
echo "pnpm version: "; pnpm --version
139139
echo "Bundler version: "; bundle --version
140-
- name: run conversion script to support shakapacker v6
140+
- name: Run conversion script for older Node compatibility
141141
if: matrix.dependency-level == 'minimum'
142142
run: script/convert
143143
- name: Save root ruby gems to cache
@@ -180,8 +180,24 @@ jobs:
180180
- name: Set packer version environment variable
181181
run: |
182182
echo "CI_DEPENDENCY_LEVEL=${{ matrix.dependency-level }}" >> $GITHUB_ENV
183-
- name: Main CI
184-
run: cd react_on_rails && bundle exec rake run_rspec:shakapacker_examples
183+
- name: Verify rake tasks exist
184+
run: |
185+
cd react_on_rails
186+
echo "Available shakapacker_examples tasks:"
187+
bundle exec rake -T | grep shakapacker_examples || true
188+
# Verify the specific task we need exists
189+
TASK_NAME="run_rspec:shakapacker_examples_${{ matrix.dependency-level == 'latest' && 'latest' || 'pinned' }}"
190+
if ! bundle exec rake -T | grep -q "$TASK_NAME"; then
191+
echo "ERROR: Required rake task '$TASK_NAME' not found!"
192+
exit 1
193+
fi
194+
echo "✓ Found required task: $TASK_NAME"
195+
- name: Main CI - Latest version examples
196+
if: matrix.dependency-level == 'latest'
197+
run: cd react_on_rails && bundle exec rake run_rspec:shakapacker_examples_latest
198+
- name: "Main CI - Pinned version examples (React 16, 17, 18 with Shakapacker 8.2.0)"
199+
if: matrix.dependency-level == 'minimum'
200+
run: cd react_on_rails && bundle exec rake run_rspec:shakapacker_examples_pinned
185201
- name: Store test results
186202
uses: actions/upload-artifact@v4
187203
with:

.github/workflows/integration-tests.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
echo "Node version: "; node -v
141141
echo "pnpm version: "; pnpm --version
142142
echo "Bundler version: "; bundle --version
143-
- name: run conversion script to support shakapacker v6
143+
- name: Run conversion script for older Node compatibility
144144
if: matrix.dependency-level == 'minimum'
145145
run: script/convert
146146
- name: Install Node modules with pnpm for renderer package
@@ -150,11 +150,12 @@ jobs:
150150
- name: yalc publish for react-on-rails
151151
run: cd packages/react-on-rails && yalc publish
152152
- name: yalc add react-on-rails
153-
run: cd react_on_rails/spec/dummy && yalc add react-on-rails
153+
# Use --link to maintain the link: protocol that matches pnpm-lock.yaml
154+
run: cd react_on_rails/spec/dummy && yalc add --link react-on-rails
154155
- name: Install Node modules with pnpm for dummy app
155156
# --ignore-workspace prevents pnpm from treating this as part of the parent workspace
156-
# The dummy app doesn't have a pnpm-lock.yaml and shouldn't use frozen lockfile
157-
run: cd react_on_rails/spec/dummy && pnpm install --ignore-workspace
157+
# minimum config changes package.json (shakapacker version), so can't use frozen lockfile
158+
run: cd react_on_rails/spec/dummy && pnpm install --ignore-workspace ${{ matrix.dependency-level == 'minimum' && '--no-frozen-lockfile' || '' }}
158159
- name: Save dummy app ruby gems to cache
159160
uses: actions/cache@v4
160161
with:
@@ -229,7 +230,7 @@ jobs:
229230
echo "Node version: "; node -v
230231
echo "pnpm version: "; pnpm --version
231232
echo "Bundler version: "; bundle --version
232-
- name: run conversion script to support shakapacker v6
233+
- name: Run conversion script for older Node compatibility
233234
if: matrix.dependency-level == 'minimum'
234235
run: script/convert
235236
- name: Save root ruby gems to cache
@@ -256,11 +257,12 @@ jobs:
256257
- name: yalc publish for react-on-rails
257258
run: cd packages/react-on-rails && yalc publish
258259
- name: yalc add react-on-rails
259-
run: cd react_on_rails/spec/dummy && yalc add react-on-rails
260+
# Use --link to maintain the link: protocol that matches pnpm-lock.yaml
261+
run: cd react_on_rails/spec/dummy && yalc add --link react-on-rails
260262
- name: Install Node modules with pnpm for dummy app
261263
# --ignore-workspace prevents pnpm from treating this as part of the parent workspace
262-
# The dummy app doesn't have a pnpm-lock.yaml and shouldn't use frozen lockfile
263-
run: cd react_on_rails/spec/dummy && pnpm install --ignore-workspace
264+
# minimum config changes package.json (shakapacker version), so can't use frozen lockfile
265+
run: cd react_on_rails/spec/dummy && pnpm install --ignore-workspace ${{ matrix.dependency-level == 'minimum' && '--no-frozen-lockfile' || '' }}
264266
- name: Dummy JS tests
265267
run: |
266268
cd react_on_rails/spec/dummy

.github/workflows/lint-js-and-ruby.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ jobs:
132132
- name: yalc publish for react-on-rails
133133
run: cd packages/react-on-rails && yalc publish
134134
- name: yalc add react-on-rails
135-
run: cd react_on_rails/spec/dummy && yalc add react-on-rails
135+
# Use --link to maintain the link: protocol that matches pnpm-lock.yaml
136+
run: cd react_on_rails/spec/dummy && yalc add --link react-on-rails
136137
- name: Install Node modules with pnpm for dummy app
137138
# --ignore-workspace prevents pnpm from treating this as part of the parent workspace
138139
# The dummy app has its own dependencies and uses yalc links

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ jobs:
8181
)
8282
strategy:
8383
matrix:
84-
include:
84+
node-version:
8585
# Always run: Latest Node version (fast feedback on PRs)
86-
- node-version: '22'
86+
- '22'
8787
# Master and full-ci label: Minimum supported Node version (full coverage)
88-
- node-version: '20'
88+
- '20'
8989
exclude:
9090
# Skip minimum dependency matrix on regular PRs (run only on master or with full-ci label)
9191
- node-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && needs.detect-changes.outputs.has_full_ci_label != 'true' && '20' || '' }}
@@ -122,9 +122,11 @@ jobs:
122122
run: script/convert
123123
- name: Install Node modules with pnpm for renderer package
124124
run: |
125-
pnpm install ${{ matrix.node-version == '22' && '--frozen-lockfile' || '' }}
125+
pnpm install ${{ matrix.node-version == '22' && '--frozen-lockfile' || '--no-frozen-lockfile' }}
126126
pnpm add -g yalc
127127
- name: Build Renderer package
128128
run: pnpm build
129-
- name: Run JS unit tests for Renderer package
130-
run: pnpm test
129+
- name: Run JS unit tests for react-on-rails package
130+
run: pnpm --filter react-on-rails test
131+
- name: Run JS unit tests for react-on-rails-pro package
132+
run: pnpm --filter react-on-rails-pro test

0 commit comments

Comments
 (0)