Skip to content

Commit 24e20e8

Browse files
xflordJohaney-s
authored andcommitted
ci: cache dependencies and Eslint
* GitHub now stores a cache of node_modules, running npm ci only if package-lock.json changes * Eslint cache is now also stored
1 parent 842fcfe commit 24e20e8

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,29 @@ jobs:
1212
with:
1313
node-version: 16
1414
- name: Cache node modules
15+
id: cache-npm
1516
uses: actions/cache@v3
17+
env:
18+
cache-name: cache-node-modules
1619
with:
17-
path: ~/.npm
18-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
20+
path: ./node_modules
21+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
1922
restore-keys: |
20-
${{ runner.os }}-node-
21-
- name: Install dependencies and build
22-
run: |
23-
npm ci
24-
npm run build
23+
${{ runner.os }}-build-${{ env.cache-name }}-
24+
${{ runner.os }}-build-
25+
${{ runner.os }}-
26+
- name: Cache Eslint
27+
uses: actions/cache@v3
28+
with:
29+
path: ./.eslintcache
30+
key: eslintcache-${{github.sha}}
31+
restore-keys: |
32+
eslintcache-
33+
- name: Install Dependencies
34+
if: steps.cache-npm.outputs.cache-hit != 'true'
35+
run: npm ci
36+
- name: Build
37+
run: npm run build
2538
- name: Run Prettier
2639
run: npm run format:check
2740
- name: Run ESLint

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"start": "ng serve",
1212
"build": "ng build",
1313
"test": "ng test",
14-
"lint": "nx run-many --all --target=lint",
14+
"lint": "nx run-many --all --target=lint --cache",
1515
"e2e": "ng e2e admin-gui-e2e --watch",
1616
"affected:apps": "nx affected:apps",
1717
"affected:libs": "nx affected:libs",

0 commit comments

Comments
 (0)