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: with:
node-version: 12.x 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 - name: Install Dependencies
run: yarn run: yarn

View file

@ -3,8 +3,8 @@ name: Verify changes
on: pull_request on: pull_request
jobs: jobs:
install: verify:
name: Install dependencies name: Verify changes
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -14,31 +14,21 @@ jobs:
with: with:
node-version: 12.x 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 - name: Install dependencies
run: yarn --frozen-lockfile 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 - name: Lint
run: yarn lint run: yarn lint
@ -47,40 +37,40 @@ jobs:
browser-tests: browser-tests:
name: Browser tests name: Browser tests
needs: install
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps: steps:
- name: Download math result for job 1
uses: actions/download-artifact@v2
with:
name: Node Modules
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup Node ${{ matrix.node-version }} - name: Setup Node 12.x
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: 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 - name: Test
run: yarn test:browser run: yarn test:browser
node-tests: node-tests:
name: Node tests name: Node tests
needs: install
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
node-version: [12.x, 14.x] node-version: [12.x, 14.x]
steps: steps:
- name: Download math result for job 1
uses: actions/download-artifact@v2
with:
name: Node Modules
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup Node ${{ matrix.node-version }} - name: Setup Node ${{ matrix.node-version }}
@ -88,5 +78,20 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} 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 - name: Test
run: yarn test:node run: yarn test:node