ci(workflow): add cache to workflows using actions/setup-node (#6491)

pull/6509/head
Oscar Dominguez 4 years ago committed by GitHub
parent 687492a5bc
commit 6a7f3083a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,37 +9,24 @@ jobs:
node-version: [8, 10, 12, 14] node-version: [8, 10, 12, 14]
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions/setup-node@v1 - uses: actions/setup-node@v2
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- id: npm-cache-dir cache: npm
run: echo "::set-output name=dir::$(npm config get cache)" - run: npm install
- uses: actions/cache@v2 - run: npm test
id: npm-cache env:
with: CI: true
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: npm install
- run: npm test
env:
CI: true
Lint: Lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions/setup-node@v1 - uses: actions/setup-node@v2
- id: npm-cache-dir with:
run: echo "::set-output name=dir::$(npm config get cache)" cache: npm
- uses: actions/cache@v2 - run: 'npm i && npm run lint'
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: 'npm i && npm run lint'
Unit: Unit:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 10 timeout-minutes: 10
@ -47,14 +34,8 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions/setup-node@v1 - uses: actions/setup-node@v2
- id: npm-cache-dir with:
run: echo "::set-output name=dir::$(npm config get cache)" cache: npm
- uses: actions/cache@v2 - run: 'npm i && npm run test:unit'
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: 'npm i && npm run test:unit'

Loading…
Cancel
Save