From 110e46572a85f070700f68d70df2e4f7fc2574ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Mon, 15 Sep 2025 18:14:22 +0200 Subject: [PATCH] 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. Closes gh-5702 Ref jquery/jquery-migrate#597 Ref gh-5703 --- .github/workflows/browserstack.yml | 12 +++------- .github/workflows/filestash.yml | 12 +++------- .github/workflows/node.js.yml | 36 ++++++++---------------------- 3 files changed, 15 insertions(+), 45 deletions(-) diff --git a/.github/workflows/browserstack.yml b/.github/workflows/browserstack.yml index 01caa2524..d553a324a 100644 --- a/.github/workflows/browserstack.yml +++ b/.github/workflows/browserstack.yml @@ -48,17 +48,11 @@ jobs: uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ env.NODE_VERSION }} - - - name: Cache - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock- + cache: npm + cache-dependency-path: '**/package-lock.json' - name: Install dependencies - run: npm install + run: npm ci - name: Build jQuery run: npm run build:all diff --git a/.github/workflows/filestash.yml b/.github/workflows/filestash.yml index 396dcbfb7..776fcd5a6 100644 --- a/.github/workflows/filestash.yml +++ b/.github/workflows/filestash.yml @@ -25,17 +25,11 @@ jobs: uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ env.NODE_VERSION }} - - - name: Cache - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock- + cache: npm + cache-dependency-path: '**/package-lock.json' - name: Install dependencies - run: npm install + run: npm ci - name: Build run: npm run build:all diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 7742666a9..9e9bce8c7 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -51,14 +51,8 @@ jobs: uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ matrix.NODE_VERSION }} - - - name: Cache - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock- + cache: npm + cache-dependency-path: '**/package-lock.json' - name: Set download URL for Firefox ESR (old) run: | @@ -84,7 +78,7 @@ jobs: if: contains(matrix.NAME, 'Firefox ESR') - name: Install dependencies - run: npm install + run: npm ci - name: Build all for linting run: npm run build:all @@ -106,17 +100,11 @@ jobs: uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ env.NODE_VERSION }} - - - name: Cache - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock- + cache: npm + cache-dependency-path: '**/package-lock.json' - name: Install dependencies - run: npm install + run: npm ci - name: Run tests in Edge in IE mode run: npm run test:ie @@ -134,17 +122,11 @@ jobs: uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ env.NODE_VERSION }} - - - name: Cache - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock- + cache: npm + cache-dependency-path: '**/package-lock.json' - name: Install dependencies - run: npm install + run: npm ci - name: Run tests run: npm run test:safari