Skip to content

Commit 03ba0bc

Browse files
authored
Merge pull request #77 from Procedure-RPC/speedy-ci
Speedy node_modules cache
2 parents 0c5e16e + 889aead commit 03ba0bc

4 files changed

Lines changed: 17 additions & 73 deletions

File tree

.github/workflows/npm-test.yml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
matrix:
2323
os: [ubuntu-latest, windows-latest, macos-latest]
24-
version: [lts/*]
24+
version: [lts/*, latest]
2525

2626
steps:
2727
- name: Checkout repository
@@ -32,29 +32,15 @@ jobs:
3232
with:
3333
node-version: ${{ matrix.version }}
3434

35-
- name: Get npm cache directory
36-
id: npm-cache
37-
run: echo "::set-output name=dir::$(npm config get cache)"
38-
3935
- name: Cache node_modules
40-
id: cache-npm
36+
id: cache
4137
uses: actions/cache@v3
42-
env:
43-
cache-name: cache-node-modules
4438
with:
45-
path: ${{ steps.npm-cache.outputs.dir }}
46-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
47-
restore-keys: |
48-
${{ runner.os }}-build-${{ env.cache-name }}-
49-
${{ runner.os }}-build-
50-
${{ runner.os }}-
51-
52-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
53-
name: List the state of node modules
54-
continue-on-error: true
55-
run: npm list
39+
path: ./node_modules
40+
key: ${{ runner.os }}-${{ matrix.version }}-build-node-modules-${{ hashFiles('**/package-lock.json') }}
5641

5742
- name: Install dependencies
43+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
5844
run: npm ci
5945

6046
- name: Run tests

.github/workflows/publish-code-coverage.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,15 @@ jobs:
2323
with:
2424
node-version: lts/*
2525

26-
- name: Get npm cache directory
27-
id: npm-cache
28-
run: echo "::set-output name=dir::$(npm config get cache)"
29-
3026
- name: Cache node_modules
31-
id: cache-npm
27+
id: cache
3228
uses: actions/cache@v3
33-
env:
34-
cache-name: cache-node-modules
3529
with:
36-
path: ${{ steps.npm-cache.outputs.dir }}
37-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
38-
restore-keys: |
39-
${{ runner.os }}-build-${{ env.cache-name }}-
40-
${{ runner.os }}-build-
41-
${{ runner.os }}-
42-
43-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
44-
name: List the state of node modules
45-
continue-on-error: true
46-
run: npm list
30+
path: ./node_modules
31+
key: ${{ runner.os }}-lts/*-build-node-modules-${{ hashFiles('**/package-lock.json') }}
4732

4833
- name: Install dependencies
34+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
4935
run: npm ci
5036

5137
- name: Generate code coverage reports

.github/workflows/publish-docs.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,15 @@ jobs:
3030
with:
3131
node-version: lts/*
3232

33-
- name: Get npm cache directory
34-
id: npm-cache
35-
run: echo "::set-output name=dir::$(npm config get cache)"
36-
3733
- name: Cache node_modules
38-
id: cache-npm
34+
id: cache
3935
uses: actions/cache@v3
40-
env:
41-
cache-name: cache-node-modules
4236
with:
43-
path: ${{ steps.npm-cache.outputs.dir }}
44-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
45-
restore-keys: |
46-
${{ runner.os }}-build-${{ env.cache-name }}-
47-
${{ runner.os }}-build-
48-
${{ runner.os }}-
49-
50-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
51-
name: List the state of node modules
52-
continue-on-error: true
53-
run: npm list
37+
path: ./node_modules
38+
key: ${{ runner.os }}-lts/*-build-node-modules-${{ hashFiles('**/package-lock.json') }}
5439

5540
- name: Install dependencies
41+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
5642
run: npm ci
5743

5844
- name: Generate API reference

.github/workflows/publish-package.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,15 @@ jobs:
1717
with:
1818
node-version: lts/*
1919

20-
- name: Get npm cache directory
21-
id: npm-cache
22-
run: echo "::set-output name=dir::$(npm config get cache)"
23-
2420
- name: Cache node_modules
25-
id: cache-npm
21+
id: cache
2622
uses: actions/cache@v3
27-
env:
28-
cache-name: cache-node-modules
2923
with:
30-
path: ${{ steps.npm-cache.outputs.dir }}
31-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
32-
restore-keys: |
33-
${{ runner.os }}-build-${{ env.cache-name }}-
34-
${{ runner.os }}-build-
35-
${{ runner.os }}-
36-
37-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
38-
name: List the state of node modules
39-
continue-on-error: true
40-
run: npm list
24+
path: ./node_modules
25+
key: ${{ runner.os }}-lts/*-build-node-modules-${{ hashFiles('**/package-lock.json') }}
4126

4227
- name: Install dependencies
28+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
4329
run: npm ci
4430

4531
- name: Run tests

0 commit comments

Comments
 (0)