generated from homebridge/homebridge-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (72 loc) · 2.59 KB
/
build.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
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- { node-version: 14.x, lint: false, tests: true }
- { node-version: 16.x, lint: true, tests: true }
- { node-version: 17.x, lint: true, tests: true }
- { node-version: 18.x, lint: true, tests: true }
- { node-version: 19.x, lint: true, tests: true }
- { node-version: 20.x, lint: true, tests: true }
- { node-version: 21.x, lint: true, tests: true }
name: nodejs ${{ matrix.node-version }} (${{ matrix.lint && 'lint → ' || '' }}${{ matrix.tests && 'test → ' || '' }}build)
steps:
- uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
id: cache-npm
uses: actions/[email protected]
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json', '**/package.json') }}
- name: Cache eslint
id: cache-eslint
uses: actions/[email protected]
env:
cache-name: cache-eslint
with:
path: .eslintcache
key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json', '**/package.json') }}
- name: Cache TypeScript
id: cache-typescript
uses: actions/[email protected]
env:
cache-name: cache-typescript
with:
path: .tsbuildinfo
key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json', '**/package.json') }}
- name: Cache prettier
id: cache-prettier
uses: actions/[email protected]
env:
cache-name: cache-prettier
with:
path: node_modules/.cache/prettier/.prettier-cache
key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json', '**/package.json') }}
- name: Install dependencies
run: npm install
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
- name: Lint the project
run: npm run lint
if: ${{ matrix.lint }}
- name: Run tests
run: npm test
if: ${{ matrix.tests }}
- name: Upload code coverage
uses: actions/[email protected]
with:
name: code-coverage
path: coverage/lcov.info
if: ${{ matrix.node-version == '18.x' }}
- name: Build the project
run: npm run build