Skip to content

Commit

Permalink
Merge pull request #77 from Procedure-RPC/speedy-ci
Browse files Browse the repository at this point in the history
Speedy node_modules cache
  • Loading branch information
toebeann authored Oct 24, 2022
2 parents 0c5e16e + 889aead commit 03ba0bc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 73 deletions.
24 changes: 5 additions & 19 deletions .github/workflows/npm-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
version: [lts/*]
version: [lts/*, latest]

steps:
- name: Checkout repository
Expand All @@ -32,29 +32,15 @@ jobs:
with:
node-version: ${{ matrix.version }}

- name: Get npm cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node_modules
id: cache-npm
id: cache
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
path: ./node_modules
key: ${{ runner.os }}-${{ matrix.version }}-build-node-modules-${{ hashFiles('**/package-lock.json') }}

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

- name: Run tests
Expand Down
22 changes: 4 additions & 18 deletions .github/workflows/publish-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,15 @@ jobs:
with:
node-version: lts/*

- name: Get npm cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node_modules
id: cache-npm
id: cache
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
path: ./node_modules
key: ${{ runner.os }}-lts/*-build-node-modules-${{ hashFiles('**/package-lock.json') }}

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

- name: Generate code coverage reports
Expand Down
22 changes: 4 additions & 18 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,15 @@ jobs:
with:
node-version: lts/*

- name: Get npm cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node_modules
id: cache-npm
id: cache
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
path: ./node_modules
key: ${{ runner.os }}-lts/*-build-node-modules-${{ hashFiles('**/package-lock.json') }}

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

- name: Generate API reference
Expand Down
22 changes: 4 additions & 18 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,15 @@ jobs:
with:
node-version: lts/*

- name: Get npm cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node_modules
id: cache-npm
id: cache
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
path: ./node_modules
key: ${{ runner.os }}-lts/*-build-node-modules-${{ hashFiles('**/package-lock.json') }}

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

- name: Run tests
Expand Down

0 comments on commit 03ba0bc

Please sign in to comment.