generated from homebridge/homebridge-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 49
88 lines (75 loc) · 2.25 KB
/
verify.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
81
82
83
84
85
86
87
88
name: Verify
on:
push:
branches:
- master
- main
- "releases?/**"
tags:
- v[0-9]+.[0-9]+.[0-9]+*
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
types: [opened, assigned, synchronize, reopened]
jobs:
build:
name: Verify
runs-on: ubuntu-latest
env:
node-version-analysis: 16.x
strategy:
matrix:
# the Node.js versions to build on
node-version: [14.x, 16.x, 18.x]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
CI: true
- name: Test
run: npm run test
- name: Export PR info
if: github.event_name == 'pull_request' && matrix.node-version == env.node-version-analysis
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/number
echo ${{ github.head_ref }} > ./pr/head_ref
echo ${{ github.sha }} > ./pr/head_sha
echo ${{ github.base_ref }} > ./pr/base_ref
- name: Archive reports and info (for PR)
if: github.event_name == 'pull_request' && matrix.node-version == env.node-version-analysis
uses: actions/upload-artifact@v3
with:
name: reports
retention-days: 7
path: |
pr/
coverage/lcov.info
coverage/clover.xml
reports/tests.xml
- name: SonarCloud (on push)
uses: sonarsource/sonarcloud-github-action@master
if: github.event_name == 'push' && matrix.node-version == env.node-version-analysis
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Code Coverage (on push)
uses: codecov/codecov-action@v3
if: github.event_name == 'push' && matrix.node-version == env.node-version-analysis
with:
files: ./coverage/clover.xml
flags: tests
name: codecov-umbrella
fail_ci_if_error: true