-
-
Notifications
You must be signed in to change notification settings - Fork 1
167 lines (143 loc) · 4.04 KB
/
test-dev.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
testConcurrency:
description: 'Check that parallel tests run in parallel (requires real CPUs)'
required: false
default: '0'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- run: npm install --ignore-scripts
- run: npm run lint
unix:
runs-on: ${{ matrix.platforms }}
strategy:
matrix:
node-version: [ 18.x, 20.x, 22.x ]
platforms: [ ubuntu-20.04, macos-12, macos-14 ]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: unix-${{ matrix.platforms }}-${{ matrix.node-version }}
- run: npm install --ignore-scripts
- run: npx node-pre-gyp configure
env:
CXX: ccache g++
CC: ccache gcc
- name: Build from sources
run: npx node-pre-gyp build -j max
env:
CXX: ccache g++
CC: ccache gcc
- name: Run unit tests
run: npm test
env:
MOCHA_TEST_CONCURRENCY: ${{ github.event.inputs.testConcurrency }}
windows:
runs-on: windows-2019
strategy:
matrix:
node-version: [ 18.x, 20.x, 22.x ]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install --ignore-scripts
- run: npx node-pre-gyp configure
- name: Build from sources
run: npx node-pre-gyp build -j max
- name: Run unit tests
run: npm test
env:
MOCHA_TEST_CONCURRENCY: ${{ github.event.inputs.testConcurrency }}
codecov:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: codecov
- run: npm install --ignore-scripts
- run: npx node-pre-gyp configure --debug --enable_coverage
env:
CXX: ccache g++
CC: ccache gcc
- name: Build from sources
run: npx node-pre-gyp build -j max
env:
CXX: ccache g++
CC: ccache gcc
- name: Run unit tests
run: npx c8 npm test
env:
MOCHA_TEST_CONCURRENCY: 0
- name: Collect coverage data
run: |
npm run gcov
npm run lcov
- name: Send data to codecov
run: npm run codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
asan:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: asan
- run: npm install --ignore-scripts
- run: npx node-pre-gyp configure --debug --enable_coverage --enable_asan
env:
CXX: ccache g++
CC: ccache gcc
- name: Build from sources
run: npx node-pre-gyp build -j max
env:
CXX: ccache g++
CC: ccache gcc
- name: Run unit tests
shell: bash {0}
run: |
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5.0.0 npm test &> asan.output
true
env:
MOCHA_TEST_CONCURRENCY: 0
MOCHA_SKIP_EXEC: 1
- name: Check for memory leaks
run: "! egrep -q \"exprtk_js\" asan.output"