Skip to content

Commit 65859bf

Browse files
committed
Switch benchmark.yml to pnpm and new directory structure
1 parent e0583ab commit 65859bf

File tree

2 files changed

+35
-28
lines changed

2 files changed

+35
-28
lines changed

.github/workflows/benchmark.yml

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,18 @@ jobs:
208208
- name: Fix dependency for libyaml-dev
209209
run: sudo apt install libyaml-dev -y
210210

211+
# Follow https://github.com/pnpm/action-setup?tab=readme-ov-file#use-cache-to-reduce-installation-time
212+
- name: Setup pnpm
213+
uses: pnpm/action-setup@v4
214+
with:
215+
run_install: false
216+
211217
- name: Setup Node
212218
uses: actions/setup-node@v4
213219
with:
214220
node-version: '22'
215-
cache: yarn
216-
cache-dependency-path: '**/yarn.lock'
221+
cache: pnpm
222+
cache-dependency-path: '**/pnpm-lock.yaml'
217223

218224
- name: Print system information
219225
run: |
@@ -222,24 +228,34 @@ jobs:
222228
echo "Current directory: "; pwd
223229
echo "Ruby version: "; ruby -v
224230
echo "Node version: "; node -v
225-
echo "Yarn version: "; yarn --version
231+
echo "Pnpm version: "; pnpm --version
226232
echo "Bundler version: "; bundle --version
227233
228-
- name: Install Node modules with Yarn for renderer package
234+
- name: Install Node modules with Pnpm for all packages
229235
run: |
230-
yarn install --no-progress --no-emoji --frozen-lockfile
231-
npm install --global yalc
236+
pnpm install --recursive --frozen-lockfile
237+
pnpm add --global yalc
232238
233239
- name: yalc publish for react-on-rails
234-
run: cd packages/react-on-rails && yarn install --no-progress --no-emoji --frozen-lockfile && yalc publish
240+
run: cd packages/react-on-rails && yalc publish
235241

236-
- name: yalc add react-on-rails
242+
# TODO only needed while we use --ignore-workspace below
243+
- name: Cache core dummy app node modules
237244
if: env.RUN_CORE
238-
run: cd react_on_rails/spec/dummy && yalc add react-on-rails
245+
uses: actions/cache@v4
246+
with:
247+
path: react_on_rails/spec/dummy/node_modules
248+
key: v4-pro-dummy-app-node-modules-cache-${{ hashFiles('pnpm-lock.yaml', 'react_on_rails/spec/dummy/package.json') }}
239249

240-
- name: Install Node modules with Yarn for Core dummy app
250+
- name: Install Node modules for the dummy app
241251
if: env.RUN_CORE
242-
run: cd react_on_rails/spec/dummy && yarn install --frozen-lockfile --no-progress --no-emoji
252+
# TODO simplify this both here and in integration tests
253+
# --ignore-workspace prevents pnpm from treating this as part of the parent workspace
254+
# The dummy app doesn't have a pnpm-lock.yaml and shouldn't use frozen lockfile
255+
run: |
256+
cd react_on_rails/spec/dummy
257+
yalc add react-on-rails
258+
pnpm install --ignore-workspace
243259
244260
- name: Save Core dummy app ruby gems to cache
245261
if: env.RUN_CORE
@@ -356,19 +372,12 @@ jobs:
356372
# ============================================
357373
# STEP 6: SETUP PRO APPLICATION SERVER
358374
# ============================================
359-
- name: Cache Pro package node modules
360-
if: env.RUN_PRO
361-
uses: actions/cache@v4
362-
with:
363-
path: react_on_rails_pro/node_modules
364-
key: v4-pro-package-node-modules-cache-${{ hashFiles('react_on_rails_pro/yarn.lock') }}
365-
366375
- name: Cache Pro dummy app node modules
367376
if: env.RUN_PRO
368377
uses: actions/cache@v4
369378
with:
370379
path: react_on_rails_pro/spec/dummy/node_modules
371-
key: v4-pro-dummy-app-node-modules-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/yarn.lock') }}
380+
key: v4-pro-dummy-app-node-modules-cache-${{ hashFiles('pnpm-lock.yaml', 'react_on_rails_pro/spec/dummy/package.json') }}
372381

373382
- name: Cache Pro dummy app Ruby gems
374383
if: env.RUN_PRO
@@ -377,16 +386,14 @@ jobs:
377386
path: react_on_rails_pro/spec/dummy/vendor/bundle
378387
key: v4-pro-dummy-app-gem-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/Gemfile.lock') }}
379388

380-
- name: Install Node modules with Yarn for Pro package
389+
# Same reason for --ignore-workspace as for core
390+
# TODO Remove it here as well
391+
- name: Install Node modules with Pnpm for Pro dummy app
381392
if: env.RUN_PRO
382393
run: |
383-
cd react_on_rails_pro
384-
sudo yarn global add yalc
385-
yarn install --frozen-lockfile --no-progress --no-emoji
386-
387-
- name: Install Node modules with Yarn for Pro dummy app
388-
if: env.RUN_PRO
389-
run: cd react_on_rails_pro/spec/dummy && yarn install --frozen-lockfile --no-progress --no-emoji
394+
cd react_on_rails_pro/spec/dummy
395+
yalc add react-on-rails
396+
pnpm install --ignore-workspace
390397
391398
- name: Install Ruby Gems for Pro dummy app
392399
if: env.RUN_PRO

react_on_rails/spec/dummy/bin/prod-assets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ export RAILS_ENV=production
55
if [ "$CI" = "true" ]; then
66
bundle exec bootsnap precompile --gemfile app/ lib/ config/
77
fi
8-
yarn run build:rescript
8+
pnpm run build:rescript
99
bundle exec rails assets:precompile

0 commit comments

Comments
 (0)