Skip to content

Commit c1cd149

Browse files
committed
ci: add cache to ci
1 parent e203096 commit c1cd149

File tree

4 files changed

+51
-46
lines changed

4 files changed

+51
-46
lines changed

.github/workflows/build.yml

+15-5
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,22 @@ jobs:
99
matrix:
1010
node-version: [14]
1111
steps:
12-
- uses: actions/checkout@v1
1312
- name: Use Node.js ${{ matrix.node-version }}
1413
uses: actions/setup-node@v1
1514
with:
1615
node-version: ${{ matrix.node-version }}
17-
- name: install and build
18-
run: |
19-
yarn install
20-
yarn build
16+
17+
- uses: actions/checkout@v1
18+
19+
- uses: actions/cache@v2
20+
id: yarn-cache
21+
with:
22+
path: node_modules
23+
key: ${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
24+
25+
- name: Install
26+
if: steps.yarn-cache.outputs.cache-hit != 'true'
27+
run: yarn install
28+
29+
- name: Build
30+
run: yarn build

.github/workflows/test.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test
2+
3+
on: [push]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
node-version: [14]
11+
steps:
12+
- name: Use Node.js ${{ matrix.node-version }}
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: ${{ matrix.node-version }}
16+
17+
- uses: actions/checkout@v1
18+
19+
- uses: actions/cache@v2
20+
id: yarn-cache
21+
with:
22+
path: node_modules
23+
key: ${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
24+
25+
- name: Install
26+
if: steps.yarn-cache.outputs.cache-hit != 'true'
27+
run: yarn install
28+
29+
- name: Test
30+
run: yarn test:fail
31+
32+
- name: Upload coverage
33+
uses: codecov/codecov-action@v1
34+
with:
35+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/unit-test.yml

-41
This file was deleted.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"jest": "jest --testPathIgnorePatterns test/performance",
2020
"jest:perf": "jest --testPathIgnorePatterns test/{feature,regression,unit}",
2121
"test": "yarn lint && yarn coverage",
22+
"test:fail": "yarn lint:fail && yarn coverage",
2223
"coverage": "jest --testPathIgnorePatterns test/performance --collect-coverage",
2324
"docs": "vuepress dev docs",
2425
"docs:build": "vuepress build docs",

0 commit comments

Comments
 (0)