Skip to content

Commit 43f5fa6

Browse files
committed
Cache Node packages in setup-node
1 parent ca7e731 commit 43f5fa6

File tree

4 files changed

+11
-41
lines changed

4 files changed

+11
-41
lines changed

.github/workflows/examples.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
uses: actions/setup-node@v4
4747
with:
4848
node-version: 20
49+
cache: yarn
50+
cache-dependency-path: '**/yarn.lock'
4951
- name: Print system information
5052
run: |
5153
echo "Linux release: "; cat /etc/issue
@@ -58,11 +60,6 @@ jobs:
5860
- name: run conversion script to support shakapacker v6
5961
if: matrix.versions == 'oldest'
6062
run: script/convert
61-
- name: Save root node_modules to cache
62-
uses: actions/cache@v4
63-
with:
64-
path: node_modules
65-
key: v5-package-node-modules-cache-${{ hashFiles('yarn.lock') }}
6663
- name: Save root ruby gems to cache
6764
uses: actions/cache@v4
6865
with:

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
uses: actions/setup-node@v4
2525
with:
2626
node-version: 20
27+
cache: yarn
28+
cache-dependency-path: '**/yarn.lock'
2729
- name: Print system information
2830
run: |
2931
echo "Linux release: "; cat /etc/issue
@@ -33,11 +35,6 @@ jobs:
3335
echo "Node version: "; node -v
3436
echo "Yarn version: "; yarn --version
3537
echo "Bundler version: "; bundle --version
36-
- name: Save root node_modules to cache
37-
uses: actions/cache@v4
38-
with:
39-
path: node_modules
40-
key: v5-package-node-modules-cache-${{ hashFiles('yarn.lock') }}
4138
- name: Save root ruby gems to cache
4239
uses: actions/cache@v4
4340
with:
@@ -49,11 +46,6 @@ jobs:
4946
sudo yarn global add yalc
5047
- name: yalc publish for react-on-rails
5148
run: yalc publish
52-
- name: Save spec/dummy/node_modules to cache
53-
uses: actions/cache@v4
54-
with:
55-
path: spec/dummy/node_modules
56-
key: dummy-app-node-modules-cache-${{ hashFiles('spec/dummy/yarn.lock') }}-newest
5749
- name: yalc add react-on-rails
5850
run: cd spec/dummy && yalc add react-on-rails
5951
- name: Install Node modules with Yarn for dummy app

.github/workflows/main.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
uses: actions/setup-node@v4
3030
with:
3131
node-version: ${{ matrix.versions == 'oldest' && '16' || '20' }}
32+
cache: yarn
33+
cache-dependency-path: '**/yarn.lock'
3234
- name: Print system information
3335
run: |
3436
echo "Linux release: "; cat /etc/issue
@@ -41,26 +43,16 @@ jobs:
4143
- name: run conversion script to support shakapacker v6
4244
if: matrix.versions == 'oldest'
4345
run: script/convert
44-
- name: Save root node_modules to cache
45-
uses: actions/cache@v4
46-
with:
47-
path: node_modules
48-
key: v5-package-node-modules-cache-${{ hashFiles('yarn.lock') }}
4946
- name: Install Node modules with Yarn for renderer package
5047
run: |
5148
yarn install --no-progress --no-emoji ${{ matrix.versions == 'newest' && '--frozen-lockfile' || '' }}
5249
sudo yarn global add yalc
5350
- name: yalc publish for react-on-rails
5451
run: yalc publish
55-
- name: Save spec/dummy/node_modules to cache
56-
uses: actions/cache@v4
57-
with:
58-
path: spec/dummy/node_modules
59-
key: dummy-app-node-modules-cache-${{ hashFiles('spec/dummy/yarn.lock') }}-${{ matrix.versions }}
6052
- name: yalc add react-on-rails
6153
run: cd spec/dummy && yalc add react-on-rails
6254
- name: Install Node modules with Yarn for dummy app
63-
run: cd spec/dummy && yarn install --no-progress --no-emoji ${{ matrix.versions == 'newest' && '--frozen-lockfile' }}
55+
run: cd spec/dummy && yarn install --no-progress --no-emoji ${{ matrix.versions == 'newest' && '--frozen-lockfile' || '' }}
6456
- name: Save dummy app ruby gems to cache
6557
uses: actions/cache@v4
6658
with:
@@ -105,6 +97,8 @@ jobs:
10597
uses: actions/setup-node@v4
10698
with:
10799
node-version: ${{ matrix.versions == 'oldest' && '16' || '20' }}
100+
cache: yarn
101+
cache-dependency-path: '**/yarn.lock'
108102
- name: Print system information
109103
run: |
110104
echo "Linux release: "; cat /etc/issue
@@ -117,11 +111,6 @@ jobs:
117111
- name: run conversion script to support shakapacker v6
118112
if: matrix.versions == 'oldest'
119113
run: script/convert
120-
- name: Save root node_modules to cache
121-
uses: actions/cache@v4
122-
with:
123-
path: node_modules
124-
key: v5-package-node-modules-cache-${{ hashFiles('yarn.lock') }}
125114
- name: Save root ruby gems to cache
126115
uses: actions/cache@v4
127116
with:
@@ -132,11 +121,6 @@ jobs:
132121
with:
133122
path: spec/dummy/vendor/bundle
134123
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-${{ matrix.versions }}
135-
- name: Save spec/dummy/node_modules to cache
136-
uses: actions/cache@v4
137-
with:
138-
path: spec/dummy/node_modules
139-
key: dummy-app-node-modules-cache-${{ hashFiles('spec/dummy/yarn.lock') }}-${{ matrix.versions }}
140124
- id: get-sha
141125
run: echo "sha=\"$(git rev-parse HEAD)\"" >> "$GITHUB_OUTPUT"
142126
- name: Save test Webpack bundles to cache (for build number checksum used by RSpec job)

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,15 @@ jobs:
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version: ${{ matrix.versions == 'oldest' && '16' || '20' }}
23+
cache: yarn
24+
cache-dependency-path: '**/yarn.lock'
2325
- name: Print system information
2426
run: |
2527
echo "Linux release: "; cat /etc/issue
2628
echo "Current user: "; whoami
2729
echo "Current directory: "; pwd
2830
echo "Node version: "; node -v
2931
echo "Yarn version: "; yarn --version
30-
- name: Save root node_modules to cache
31-
uses: actions/cache@v4
32-
with:
33-
path: node_modules
34-
key: v5-package-node-modules-cache-${{ hashFiles('yarn.lock') }}
3532
- name: run conversion script
3633
if: matrix.versions == 'oldest'
3734
run: script/convert

0 commit comments

Comments
 (0)