Skip to content

Commit

Permalink
Add caching support
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryNguyen5 committed Dec 14, 2020
1 parent 825e1b9 commit 543a201
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 5 deletions.
45 changes: 42 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,30 @@ on:
- master
pull_request: ~

env:
cache-name: ci

jobs:
run-basic-checks:
name: Run linters and unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2-beta
with:
node-version: "12.x"
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
~/.npm
~/.cache
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: yarn install
- run: yarn setup
- run: yarn lint
Expand All @@ -26,10 +41,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2-beta
with:
node-version: "12.x"
- run: yarn install
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
~/.npm
~/.cache
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: yarn setup
- run: yarn test:example-start-server&
- run: yarn test:example
Expand Down Expand Up @@ -57,8 +84,20 @@ jobs:
matrix: ${{fromJson(needs.matrix-adapters.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2-beta
with:
node-version: "12.x"
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
~/.npm
~/.cache
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: ${{ matrix.adapter.cmd }}
- run: ${{ matrix.adapter.docker }}
22 changes: 20 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:

name: Release

env:
cache-name: cd

jobs:
release:
name: Create Release
Expand All @@ -17,8 +20,6 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build project
run: yarn
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down Expand Up @@ -60,6 +61,23 @@ jobs:
matrix: ${{fromJson(needs.matrix-adapters.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: "12.x"
- name: Install yarn deps
run: yarn install --frozen-lockfile --production
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
~/.npm
~/.cache
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Build
run: ${{ matrix.adapter.cmd }}
- name: Upload Release Asset
Expand Down

0 comments on commit 543a201

Please sign in to comment.