-
-
Notifications
You must be signed in to change notification settings - Fork 202
80 lines (68 loc) · 1.93 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
74
75
76
77
78
79
80
name: ci
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout Z-Wave JS UI
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
if: matrix['node-version'] == '18.x'
run: npm run lint
- name: Prepare lint auto-fix patch
if: |
matrix['node-version'] == '18.x' &&
failure() &&
github.event_name == 'pull_request'
id: lint
run: |
# Run all lint commands and abort if one has unfixable errors
npm run lint-fix
git diff --name-only || true
if ! git diff --quiet ; then
echo "has changes"
git diff > fix.patch
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "unchanged"
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Upload Patch
if: |
matrix['node-version'] == '18.x' &&
failure() &&
github.event_name == 'pull_request' &&
steps.lint.outputs.changed == 'true'
uses: actions/upload-artifact@v3
with:
name: lint-fix
path: fix.patch
- name: Test
run: npm run test
- name: Generate coverage report
if: matrix['node-version'] == '18.x'
run: |
npm run coverage
npm run record-coverage
- name: Coveralls
uses: coverallsapp/github-action@master
if: matrix['node-version'] == '18.x'
with:
github-token: ${{ secrets.github_token }}