Skip to content

Commit

Permalink
ci: Fix JS caching (#270)
Browse files Browse the repository at this point in the history
Updated CI caching to use a glob for the `node_modules` directories. The
previous wildcard would only search 1 level deep which is not valid for
our setup. This should fix some edge cases that could cause test
failures if the expected package version was installed to the package's
local `node_modules`.

Updated cache action to v4. Added the `save-always` flag to the
`node_modules` cache which should work whenever it's fixed. Ticket for
the flag not working actions/cache#1315.
Without that flag functioning, it acts just like v3 cache
  • Loading branch information
mattrunyon authored Feb 7, 2024
1 parent d93dc9c commit 3e24a20
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/test-js-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,41 @@ jobs:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Cache jest
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
.jest-cache
plugins/*/.jest-cache
plugins/**/.jest-cache
key: ${{ runner.os }}-jestcache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-jestcache-
- name: Cache linters
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
.eslintcache
plugins/*/.eslintcache
plugins/**/.eslintcache
.stylelintcache
plugins/*/.stylelintcache
plugins/**/.stylelintcache
key: ${{ runner.os }}-lintcache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-lintcache-
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
save-always: true
path: |
node_modules
plugins/*/node_modules
plugins/**/node_modules
key: unit-node-modules-${{ hashFiles('package-lock.json')}}

- name: Install dependencies
Expand Down

0 comments on commit 3e24a20

Please sign in to comment.