Skip to content

Commit 35e81df

Browse files
committed
chore: add tests to github-actions workflow
1 parent 022743d commit 35e81df

File tree

2 files changed

+45
-4
lines changed

2 files changed

+45
-4
lines changed

Diff for: .github/workflows/lint.yml renamed to .github/workflows/ci.yml

+44-4
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@ env:
88
NODE_VERSION: "12.x"
99

1010
jobs:
11-
eslint:
12-
name: Eslint
11+
setup:
12+
name: Setup
1313
runs-on: ubuntu-latest
1414
timeout-minutes: 5
1515
steps:
1616
- uses: actions/checkout@v2
17-
with:
18-
fetch-depth: 0
1917

2018
- uses: actions/setup-node@v1
2119
with:
2220
node-version: "${{ env.NODE_VERSION }}"
2321

2422
- name: Cache node modules
23+
id: cache
2524
uses: actions/cache@v1
2625
with:
2726
path: node_modules
@@ -31,9 +30,50 @@ jobs:
3130
if: steps.cache.outputs.cache-hit != 'true'
3231
run: npm ci
3332

33+
eslint:
34+
name: Eslint
35+
runs-on: ubuntu-latest
36+
needs: [setup]
37+
timeout-minutes: 5
38+
steps:
39+
- uses: actions/checkout@v2
40+
with:
41+
fetch-depth: 0
42+
43+
- uses: actions/setup-node@v1
44+
with:
45+
node-version: "${{ env.NODE_VERSION }}"
46+
3447
- name: Fetch all branches
3548
run: |
3649
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
3750
51+
- name: Cache node modules
52+
uses: actions/cache@v1
53+
with:
54+
path: node_modules
55+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
56+
3857
- name: ESLint
3958
run: npm run ci:lint -- $(git diff --diff-filter d --name-only origin/${{ github.base_ref }}...HEAD -- '*.js' '*.ts' '*.tsx')
59+
60+
tests:
61+
name: Tests
62+
runs-on: ubuntu-latest
63+
needs: [setup]
64+
timeout-minutes: 5
65+
steps:
66+
- uses: actions/checkout@v2
67+
68+
- uses: actions/setup-node@v1
69+
with:
70+
node-version: "${{ env.NODE_VERSION }}"
71+
72+
- name: Cache node modules
73+
uses: actions/cache@v1
74+
with:
75+
path: node_modules
76+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
77+
78+
- name: unit tests
79+
run: npm run ci:test

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"lint": "eslint 'src/**/*.js' --quiet --fix",
1010
"clean": "rimraf ./dist ./.cache",
1111
"ci:lint": "eslint 'src/**/*.js' -c ./.eslintrc.js",
12+
"ci:test": "jest --ci" ,
1213
"test": "jest",
1314
"test:watch": "jest --watch"
1415
},

0 commit comments

Comments
 (0)