chore: use cache instead of artifacts in workflow

This commit is contained in:
Joren Broekema 2020-07-28 18:07:23 +02:00
parent c8a5d60f62
commit 6666b558fb
2 changed files with 58 additions and 41 deletions

View file

@ -22,6 +22,18 @@ jobs:
with:
node-version: 12.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn

View file

@ -3,8 +3,8 @@ name: Verify changes
on: pull_request
jobs:
install:
name: Install dependencies
verify:
name: Verify changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -14,31 +14,21 @@ jobs:
with:
node-version: 12.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --frozen-lockfile
- uses: actions/upload-artifact@v2
with:
name: Node Modules
path: node_modules
verify:
name: Verify changes
needs: install
runs-on: ubuntu-latest
steps:
- name: Download math result for job 1
uses: actions/download-artifact@v2
with:
name: Node Modules
- uses: actions/checkout@v2
- name: Setup Node 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Lint
run: yarn lint
@ -47,40 +37,40 @@ jobs:
browser-tests:
name: Browser tests
needs: install
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- name: Download math result for job 1
uses: actions/download-artifact@v2
with:
name: Node Modules
- uses: actions/checkout@v2
- name: Setup Node ${{ matrix.node-version }}
- name: Setup Node 12.x
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
node-version: 12.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Test
run: yarn test:browser
node-tests:
name: Node tests
needs: install
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- name: Download math result for job 1
uses: actions/download-artifact@v2
with:
name: Node Modules
- uses: actions/checkout@v2
- name: Setup Node ${{ matrix.node-version }}
@ -88,5 +78,20 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Test
run: yarn test:node