Skip to content

Commit cced51b

Browse files
authored
Add caching of dependencies to GitHub actions
1 parent a47c722 commit cced51b

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/js_test.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,29 @@ on: [push]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
98
steps:
109
- uses: actions/checkout@v1
10+
- name: Cache
11+
id: cache
12+
uses: actions/[email protected]
13+
with:
14+
path: node_modules
15+
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
16+
restore-keys: |
17+
${{ runner.OS }}-build-${{ env.cache-name }}-
18+
${{ runner.OS }}-build-
19+
${{ runner.OS }}-
1120
- name: Use Node.js ${{ matrix.node-version }}
1221
uses: actions/setup-node@v1
1322
with:
1423
node-version: 12
15-
- name: npm install, build, and test
16-
run: |
17-
npm ci
18-
npm run build --if-present
19-
npm test
24+
- name: Install Dependencies
25+
if: steps.cache.outputs.cache-hit != 'true'
26+
run: npm ci
27+
env:
28+
CI: true
29+
- name: npm test
30+
run: npm test
2031
env:
2132
CI: true

0 commit comments

Comments
 (0)