Skip to content

Commit

Permalink
chore: cache dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Dec 31, 2021
1 parent 5c3ba7f commit 560b89b
Showing 1 changed file with 41 additions and 11 deletions.
52 changes: 41 additions & 11 deletions .github/workflows/test.yml
Expand Up @@ -4,19 +4,49 @@ on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [14.x, 16.x]
node-version: [14.x]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g yarn
- run: yarn
- run: yarn prerelease
- uses: actions/checkout@v2

# install node
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

# install yarn
- run: npm i -g yarn

# https://github.com/actions/cache/blob/main/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache 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-
# https://github.com/actions/cache/blob/main/examples.md#node---lerna
- name: Cache node_modules
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}

- run: yarn
- run: yarn build
- run: yarn pretest
- run: yarn test

0 comments on commit 560b89b

Please sign in to comment.