Skip to content

Commit bcf2313

Browse files
authored
ci: cache node_modules (#6048)
1 parent 31cb520 commit bcf2313

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ jobs:
1313
- uses: actions/setup-node@v1
1414
with:
1515
node-version: ${{ matrix.node-version }}
16+
- id: npm-cache-dir
17+
run: echo "::set-output name=dir::$(npm config get cache)"
18+
- uses: actions/cache@v2
19+
id: npm-cache
20+
with:
21+
path: ${{ steps.npm-cache-dir.outputs.dir }}
22+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
23+
restore-keys: ${{ runner.os }}-node-
1624
- run: npm install
1725
- run: npm test
1826
env:
@@ -23,6 +31,14 @@ jobs:
2331
steps:
2432
- uses: actions/checkout@v1
2533
- uses: actions/setup-node@v1
34+
- id: npm-cache-dir
35+
run: echo "::set-output name=dir::$(npm config get cache)"
36+
- uses: actions/cache@v2
37+
id: npm-cache
38+
with:
39+
path: ${{ steps.npm-cache-dir.outputs.dir }}
40+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
41+
restore-keys: ${{ runner.os }}-node-
2642
- run: 'npm i && npm run lint'
2743
Unit:
2844
runs-on: ${{ matrix.os }}
@@ -33,4 +49,12 @@ jobs:
3349
steps:
3450
- uses: actions/checkout@v1
3551
- uses: actions/setup-node@v1
52+
- id: npm-cache-dir
53+
run: echo "::set-output name=dir::$(npm config get cache)"
54+
- uses: actions/cache@v2
55+
id: npm-cache
56+
with:
57+
path: ${{ steps.npm-cache-dir.outputs.dir }}
58+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
59+
restore-keys: ${{ runner.os }}-node-
3660
- run: 'npm i && npm run test:unit'

0 commit comments

Comments
 (0)