Skip to content

Commit 7a40ac7

Browse files
committed
Build: Simplify caching in CI, use npm ci
Our setup is pretty standard, so manual configuration of `actions/cache` is an overkill. Relying on built-in `actions/node` caching will also resolve differences between caching configurations for macOS/Linux vs. Windows. Also, switch from `npm install` to `npm ci` in CI. Ref jquery/jquery-migrate#597
1 parent 9d7f6e6 commit 7a40ac7

File tree

3 files changed

+15
-45
lines changed

3 files changed

+15
-45
lines changed

.github/workflows/browserstack.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,11 @@ jobs:
7575
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
7676
with:
7777
node-version: ${{ env.NODE_VERSION }}
78-
79-
- name: Cache
80-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
81-
with:
82-
path: ~/.npm
83-
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
84-
restore-keys: |
85-
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
78+
cache: npm
79+
cache-dependency-path: '**/package-lock.json'
8680

8781
- name: Install dependencies
88-
run: npm install
82+
run: npm ci
8983

9084
- name: Build jQuery
9185
run: npm run build:all

.github/workflows/filestash.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,11 @@ jobs:
2525
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2626
with:
2727
node-version: ${{ env.NODE_VERSION }}
28-
29-
- name: Cache
30-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
31-
with:
32-
path: ~/.npm
33-
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
34-
restore-keys: |
35-
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
28+
cache: npm
29+
cache-dependency-path: '**/package-lock.json'
3630

3731
- name: Install dependencies
38-
run: npm install
32+
run: npm ci
3933

4034
- name: Build
4135
run: npm run build:all

.github/workflows/node.js.yml

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,8 @@ jobs:
5151
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
5252
with:
5353
node-version: ${{ matrix.NODE_VERSION }}
54-
55-
- name: Cache
56-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
57-
with:
58-
path: ~/.npm
59-
key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
60-
restore-keys: |
61-
${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-
54+
cache: npm
55+
cache-dependency-path: '**/package-lock.json'
6256

6357
- name: Set download URL for Firefox ESR (old)
6458
run: |
@@ -84,7 +78,7 @@ jobs:
8478
if: contains(matrix.NAME, 'Firefox ESR')
8579

8680
- name: Install dependencies
87-
run: npm install
81+
run: npm ci
8882

8983
- name: Build all for linting
9084
run: npm run build:all
@@ -106,17 +100,11 @@ jobs:
106100
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
107101
with:
108102
node-version: ${{ env.NODE_VERSION }}
109-
110-
- name: Cache
111-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
112-
with:
113-
path: ~/.npm
114-
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
115-
restore-keys: |
116-
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
103+
cache: npm
104+
cache-dependency-path: '**/package-lock.json'
117105

118106
- name: Install dependencies
119-
run: npm install
107+
run: npm ci
120108

121109
- name: Run tests in Edge in IE mode
122110
run: npm run test:ie
@@ -134,17 +122,11 @@ jobs:
134122
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
135123
with:
136124
node-version: ${{ env.NODE_VERSION }}
137-
138-
- name: Cache
139-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
140-
with:
141-
path: ~/.npm
142-
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
143-
restore-keys: |
144-
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
125+
cache: npm
126+
cache-dependency-path: '**/package-lock.json'
145127

146128
- name: Install dependencies
147-
run: npm install
129+
run: npm ci
148130

149131
- name: Run tests
150132
run: npm run test:safari

0 commit comments

Comments
 (0)