-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (73 loc) · 2.08 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: tests
on:
- push
jobs:
test:
strategy:
matrix:
platform:
- ubuntu-latest
node:
- 8
- 10
- 12
- 14
- 16
- 18
- 20
name: test/node ${{ matrix.node }}/${{ matrix.platfornm }}
runs-on: ${{ matrix.platform }}
steps:
# dependencies
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- uses: actions/checkout@v2
- run: npm install
# test and publish coverage
- run: npm run cover
- uses: actions/upload-artifact@v2
with:
name: coverage
path: .nyc_output/
coverage:
needs:
- test
runs-on: ubuntu-latest
steps:
# dependencies
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- uses: actions/checkout@v2
- run: npm install
# fetch previous
- run: git clone --branch=gh-pages --depth=1 "https://za-creature:${{ github.token }}@github.com/${{ github.repository }}.git" coverage/
- uses: actions/download-artifact@v2
with:
name: coverage
path: .nyc_output/
# publish report
- run: npm run lint
- run: echo COVERAGE=$(npm run report | grep Statements | awk '{print $3}') >> $GITHUB_ENV
- uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: 1e4664346f422ed78c1cc07a6a5da580
filename: coverage.json
label: coverage
message: ${{ env.COVERAGE }}
color: green
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "GitHub Actions"
- run: cd coverage && git add . && git commit -m 'Update coverage' && git push