-
-
Notifications
You must be signed in to change notification settings - Fork 18
147 lines (136 loc) · 3.68 KB
/
node-test.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
# https://hanxiao.io/2021/01/24/Speedup-CI-Workflow-in-Github-Actions-via-Strategy-Matrix/
name: Node.js Test
on:
pull_request:
types:
# - edited # PR's base branch was changed
- opened
- reopened
- synchronize # PR's branch was edited (i.e. new commits)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
path-filter:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
changes: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v4
- id: filter
uses: dorny/paths-filter@v2
with:
filters: |
changes:
- '*'
- 'src/**'
- 'test/**'
node-lint:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
runs-on: ubuntu-latest
steps:
# Setup and install
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
- run: npm ci
# Lint the source files
- run: npm start -- --help
- run: npm run lint
# TODO(cemmer): check for deprecated dependencies
# https://stackoverflow.com/questions/44097267/find-packages-that-give-deprecated-warning-npm
node-unit:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ ubuntu, macos, windows ]
node-version: [ lts, 18, 16.6.0 ]
steps:
# Setup and install
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
# Test the source files
- run: npm run test:unit
node-e2e:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ lts, 18, 16.6.0 ]
steps:
# Setup and install
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
# Test the built files
- run: npm run build
- run: ./test/endToEndTest.sh
node-build:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ ubuntu, macos, windows ]
steps:
# Setup and install
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
- run: npm ci
# Test building
- run: npm run build
node-package:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ lts, 18, 16.6.0 ]
steps:
# Setup and install
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
# Test the packaging
- run: |
npm pack
tar -xvzf igir-*.tgz
cd package
npm install --ignore-scripts
./dist/index.js --help
cd ..
rm -rf package
# !!! This check should be required by GitHub !!!
test-status-check:
if: always()
needs:
- path-filter
- node-lint
- node-unit
- node-e2e
- node-build
- node-package
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
allowed-skips: node-lint, node-unit, node-e2e, node-build, node-package
jobs: ${{ toJSON(needs) }}