Skip to content

Commit 529c9f3

Browse files
sarageriondreamorosi
authored andcommitted
fix(cicd): same cached modules for examples and layer PR lint
1 parent bcab998 commit 529c9f3

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Diff for: .github/workflows/reusable-run-linting-check-and-unit-tests.yml

+7-12
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ jobs:
2929
path: "./node_modules"
3030
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
3131
# if one of them changes the cache is invalidated/discarded
32-
key: ${{ matrix.version }}-cache-utils-node-modules-${{ hashFiles('./package-lock.json') }}
32+
key: ${{ matrix.version }}-cache-utilities-node-modules-${{ hashFiles('./package-lock.json') }}
3333
- name: Install dependencies
34-
# We can skip the install if there was a cache hit
34+
# We can skip the installation if there was a cache hit
3535
if: steps.cache-node-modules.outputs.cache-hit != 'true'
3636
# See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts
3737
run: npm ci --foreground-scripts
3838
- name: Build packages
3939
# If there's a cache hit we still need to manually build the packages
4040
# this would otherwise have been done automatically as a part of the
41-
# postinstall npm hook
41+
# post-install npm hook
4242
if: steps.cache-node-modules.outputs.cache-hit == 'true'
4343
run: |
4444
npm run build -w packages/commons
@@ -67,12 +67,8 @@ jobs:
6767
id: cache-node-modules
6868
uses: actions/cache@v3
6969
with:
70-
path: "./examples/${{ matrix.example }}/node_modules"
71-
# Use the combo between example, name, and SHA-256 hash of all example lock files as cache key.
72-
# It's not possible to use the ${{ matrix.example }} key in the hashFiles fn so
73-
# if any of the lock files (which should be fairly similar anyway) changes the cache is
74-
# invalidated/discarded for all.
75-
key: ${{ matrix.example }}-cache-examples-node-modules-${{ hashFiles('./examples/*/package-lock.json') }}
70+
path: "./node_modules"
71+
key: cache-node-modules-${{ hashFiles('./package-lock.json') }}
7672
- name: Install dependencies
7773
# We can skip the installation if there was a cache hit
7874
if: steps.cache-node-modules.outputs.cache-hit != 'true'
@@ -97,9 +93,8 @@ jobs:
9793
id: cache-node-modules
9894
uses: actions/cache@v3
9995
with:
100-
path: "./layer-publisher/node_modules"
101-
# Use the combo between example, name, and SHA-256 hash of the layer-publisher lock files as cache key.
102-
key: cache-layer-publisher-node-modules-${{ hashFiles('./layer-publisher/*/package-lock.json') }}
96+
path: "./node_modules"
97+
key: cache-node-modules-${{ hashFiles('./package-lock.json') }}
10398
- name: Install Layer publisher
10499
# We can skip the installation if there was a cache hit
105100
if: steps.cache-node-modules.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)