-
Notifications
You must be signed in to change notification settings - Fork 33
198 lines (190 loc) · 5.89 KB
/
run-all-tests-pr.yaml
File metadata and controls
198 lines (190 loc) · 5.89 KB
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: "🔍 Tests PR"
on:
pull_request:
branches: [main]
merge_group:
workflow_dispatch:
permissions:
contents: read
concurrency:
group:
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
linting:
name: lint
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v6
- name: node
uses: actions/setup-node@v6
with:
node-version: 22
cache: "npm"
- name: rust
uses: dtolnay/rust-toolchain@stable
- name: install dependencies
run: npm ci
- name: install clang-tidy
run: sudo apt-get install -y clang-tidy
- name: build project
# Build project so that imports can be checked during linting
run: npm run build
- name: build fuzzer
# Build the native addon so that CMake downloads libFuzzer and
# generates compile_commands.json, which are needed by clang-tidy
run: npm run build --workspace=@jazzer.js/fuzzer
- name: check formatting and linting
run: npm run check
tests:
name: unit tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, ubuntu-24.04-arm, macos-latest]
node: [20]
include:
# Node 14 runtime compatibility is covered by end-to-end tests.
# Unit tests require npm 7+ (workspaces) which Node 14 doesn't ship.
# Ceiling: current LTS
- os: ubuntu-latest
node: 24
steps:
- name: checkout
uses: actions/checkout@v6
- uses: actions/cache@v5
id: cache-fuzzer
with:
path: |
packages/fuzzer/prebuilds
key:
fuzzer-cache-${{ matrix.os }}-${{
hashFiles('packages/fuzzer/CMakeLists.txt',
'packages/fuzzer/**/*.h', 'packages/fuzzer/**/*.cpp') }}
- name: node
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
cache: "npm"
- name: rust
uses: dtolnay/rust-toolchain@stable
- name: MSVC (windows)
uses: ilammy/msvc-dev-cmd@v1
if: contains(matrix.os, 'windows')
- name: install dependencies
run: npm ci
- name: build project
run: npm run build
- name: build fuzzer
if: ${{ steps.cache-fuzzer.outputs.cache-hit != 'true' }}
run: npm run build --workspace=@jazzer.js/fuzzer
- name: run all tests
run: npm run test
end-to-end:
name: end-to-end (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
steps:
- name: checkout
uses: actions/checkout@v6
# Build with node.js 22
- name: node
uses: actions/setup-node@v6
with:
node-version: 22
cache: "npm"
- name: rust
uses: dtolnay/rust-toolchain@stable
- name: MSVC (windows)
uses: ilammy/msvc-dev-cmd@v1
if: contains(matrix.os, 'windows')
- name: pack jazzer.js
run: cd end-to-end && ./package-jazzer-js.sh
shell: bash
- name: build example
run: cd end-to-end && npm install --save-dev *.tgz && npm run build
shell: bash
# Run with different node.js versions
# all in one job to avoid rebuilding
# each runtime executes consolidated runtime checks
# Node 14 only has binaries for x64 runners
- name: "node 14"
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest'
uses: actions/setup-node@v6
with:
node-version: 14
- name: run runtime checks (node 14)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest'
run: cd end-to-end && npm run test:runtime
shell: bash
- name: "node 16"
uses: actions/setup-node@v6
with:
node-version: 16
- name: run runtime checks (node 16)
run: cd end-to-end && npm run test:runtime
shell: bash
- name: "node 18"
uses: actions/setup-node@v6
with:
node-version: 18
- name: run runtime checks (node 18)
run: cd end-to-end && npm run test:runtime
shell: bash
- name: "node 20"
uses: actions/setup-node@v6
with:
node-version: 20
- name: run runtime checks (node 20)
run: cd end-to-end && npm run test:runtime
shell: bash
- name: "node 22"
uses: actions/setup-node@v6
with:
node-version: 22
- name: run runtime checks (node 22)
run: cd end-to-end && npm run test:runtime
shell: bash
- name: "node 24"
uses: actions/setup-node@v6
with:
node-version: 24
- name: run runtime checks (node 24)
run: cd end-to-end && npm run test:runtime
shell: bash
auto-merge:
needs:
- linting
- tests
- end-to-end
permissions:
pull-requests: write
contents: write
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.3.6
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve
if:
${{steps.metadata.outputs.update-type !=
'version-update:semver-major'}}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge
if:
${{steps.metadata.outputs.update-type !=
'version-update:semver-major'}}
run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}