-
-
Notifications
You must be signed in to change notification settings - Fork 181
282 lines (268 loc) · 8.61 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
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build app
on:
workflow_dispatch:
push:
branches:
- main
tags:
- "*"
paths-ignore:
- "*.md"
- "*.txt"
- "*.yml"
- .editorconfig
- ".github/**"
- .gitignore
- .npmignore
pull_request:
branches:
- main
paths-ignore:
- "*.md"
- "*.txt"
- "*.yml"
- .editorconfig
- ".github/**"
- .gitignore
- .npmignore
jobs:
build:
permissions:
actions: write
checks: write
pull-requests: write
name: Build amd64
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
node: ["18.x", "20.x", "22.x", "23.x"]
runner: ["windows-latest", "ubuntu-latest", "macos-latest"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
registry-url: "https://registry.npmjs.org"
cache: npm
- run: |
node --version
npm --version
npm ci
name: Install npm dependencies
- run: npm run lint .
name: Lint
if: matrix.runner == 'ubuntu-latest'
- run: npm run typecheck
name: Type check
if: matrix.runner == 'ubuntu-latest'
- run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y libnss3
name: Install OS dependencies
if: matrix.runner == 'ubuntu-latest'
- run: ./test-driver.sh
name: Verify install
shell: bash
- run: npm run test:ci
name: Run tests
continue-on-error: true
- name: Publish Report
uses: turing85/publish-report@v1
if: ${{ always() }}
with:
cancel-workflow-on-error: false
comment-header: my-comment-header
comment-message-success: |
{0} passed!
{1} tests were successful, {2} tests failed, {3} test were skipped.
The report can be found [here]({4}).
comment-message-failure: |
{0} failed!
{1} tests were successful, {2} tests failed, {3} test were skipped.
The report can be found [here]({4}).
report-fail-on-error: true
report-name: Tests ${{ matrix.runner }}-${{ matrix.node }}
report-path: junit.xml
report-reporter: jest-junit
build_arm64:
name: Build arm64
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ["20", "22", "23"]
steps:
- uses: actions/checkout@v4
- uses: uraimo/[email protected]
name: Verify install
id: build
with:
arch: aarch64
distro: ubuntu22.04
env: | # this is just so we can cache each version
GITHUB_WORKFLOW: ${{ github.workflow }}-${{ github.job }}-${{ matrix.node }}
dockerRunArgs: |
--volume "$PWD:/app"
githubToken: ${{ github.token }}
install: |
set -euo pipefail
apt-get update
apt-get -y install xz-utils curl libnss3
curl -fsSL --output sha https://nodejs.org/dist/latest-v${{ matrix.node }}.x/SHASUMS256.txt
FULL_FILE=`grep 'node-v${{ matrix.node }}.*-linux-arm64.tar.gz' sha | tr -s ' ' | cut -d' ' -f2`
NODE_VERSION=`echo $FULL_FILE | grep --color=never -Eo '[0-9]{2,}\.[0-9]{1,}\.[0-9]{1,}'`
echo "Node version is $NODE_VERSION"
ARCH=arm64
curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz"
tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner
rm sha
rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz"
run: |
node --version
npm --version
cd /app
npm ci --no-progress
BIN="./lib/chromedriver/chromedriver"
if ! [ -e $BIN ]; then
echo "Binary not found at $BIN"
exit 1
fi
build_s390x:
name: Build s390x
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ["18", "20", "22", "23"]
steps:
- uses: actions/checkout@v4
- uses: uraimo/[email protected]
name: Verify install
id: build
with:
arch: s390x
distro: ubuntu22.04
env: | # this is just so we can cache each version
GITHUB_WORKFLOW: ${{ github.workflow }}-${{ github.job }}-${{ matrix.node }}
dockerRunArgs: |
--volume "$PWD:/app"
githubToken: ${{ github.token }}
install: |
set -euo pipefail
apt-get update
apt-get -y install xz-utils curl libnss3
curl -fsSL --output sha https://nodejs.org/dist/latest-v${{ matrix.node }}.x/SHASUMS256.txt
FULL_FILE=`grep 'node-v${{ matrix.node }}.*-linux-s390x.tar.gz' sha | tr -s ' ' | cut -d' ' -f2`
NODE_VERSION=`echo $FULL_FILE | grep --color=never -Eo '[0-9]{2,}\.[0-9]{1,}\.[0-9]{1,}'`
echo "Node version is $NODE_VERSION"
ARCH=s390x
curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz"
tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner
rm sha
rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz"
npm install -g npm@latest
run: |
node --version
npm --version
cd /app
npm ci --no-progress
BIN="./lib/chromedriver/chromedriver"
if ! [ -e $BIN ]; then
echo "Binary not found at $BIN"
exit 1
fi
build_proxy:
name: Build with proxy
runs-on: ubuntu-latest
services:
squid:
image: ubuntu/squid:5.2-22.04_beta
ports:
- 3128:3128
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
registry-url: "https://registry.npmjs.org"
cache: npm
- run: |
node --version
npm --version
export http_proxy=http://localhost:3128 https_proxy=http://localhost:3128
npm ci
name: Install npm dependencies
- run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y libnss3
name: Install OS dependencies
- run: ./test-driver.sh
name: Verify install
build_local_file_install:
name: Build with local file install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
registry-url: "https://registry.npmjs.org"
cache: npm
- run: |
node --version
npm --version
curl -fsSL --output /tmp/chromedriver-linux64.zip https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.105/linux64/chromedriver-linux64.zip
export CHROMEDRIVER_FILEPATH=/tmp/chromedriver-linux64.zip
npm ci
name: Install npm dependencies
- run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y libnss3
name: Install OS dependencies
- run: ./test-driver.sh
name: Verify install
build_legacy:
name: Build with legacy cdn url
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
registry-url: "https://registry.npmjs.org"
cache: npm
- run: |
node --version
npm --version
export CHROMEDRIVER_VERSION=LATEST_113
npm ci
name: Install npm dependencies
- run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y libnss3
name: Install OS dependencies
- run: ./test-driver.sh
name: Verify install
publish:
permissions:
contents: read
id-token: write
name: Publish to npm
runs-on: ubuntu-latest
needs: [build, build_arm64, build_s390x, build_proxy]
if: success() && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
registry-url: "https://registry.npmjs.org"
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}