1
- name : Build process
2
- on : [push, pull_request]
1
+ name : Build, test and coverage
2
+ on : pull_request
3
3
4
4
jobs :
5
- test :
6
- name : Build and test
7
- runs-on : ubuntu-latest
5
+ test-matrix :
8
6
strategy :
9
7
matrix :
10
- node : [8, 10, 12]
8
+ node : [10, 12, 14]
9
+ name : Test build Node v ${{ matrix.node }}
10
+ runs-on : ubuntu-latest
11
11
steps :
12
12
- name : Checkout
13
13
uses : actions/checkout@v1
@@ -18,17 +18,51 @@ jobs:
18
18
node-version : ${{ matrix.node }}
19
19
20
20
- name : Cache node modules
21
+ id : cache-node-modules
21
22
uses : actions/cache@v1
22
23
with :
23
- path : node_modules
24
- key : build -${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
25
- restore-keys : build -${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
24
+ path : ./ node_modules
25
+ key : test -${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
26
+ restore-keys : test -${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
26
27
27
28
- name : Install deps
29
+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
28
30
run : npm install
29
31
30
32
- name : Lint code
31
33
run : make lint
32
34
33
35
- name : Run tests
34
36
run : make tests
37
+
38
+ test-success :
39
+ runs-on : ubuntu-latest
40
+ needs : test-matrix
41
+ steps :
42
+ - name : Matrix tests passed
43
+ run : echo Done!
44
+
45
+ test-coverage :
46
+ runs-on : ubuntu-latest
47
+ needs : test-success
48
+ steps :
49
+ - uses : actions/checkout@v2
50
+ - uses : actions/setup-node@v1
51
+ with :
52
+ node-version : 12
53
+ - uses : actions/cache@v1
54
+ id : cache-node-modules
55
+ with :
56
+ path : ./node_modules
57
+ key : test-12-${{hashFiles('./package-lock.json')}}
58
+ restore-keys : test-12-${{hashFiles('./package-lock.json')}}
59
+ - name : Install modules
60
+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
61
+ run : npm install
62
+ - name : Test with coverage
63
+ run : make test-coverage
64
+ - name : Coveralls
65
+ uses : coverallsapp/github-action@master
66
+ with :
67
+ github-token : ${{ secrets.GITHUB_TOKEN }}
68
+
0 commit comments