-
-
Notifications
You must be signed in to change notification settings - Fork 46
342 lines (340 loc) · 11.5 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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
name: Build
on:
push:
tags:
- "1.*"
- "2.*"
- "3.*"
- "4.*"
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-22.04
env:
node_version: 18.8.0
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
- run: npm install prettier
- run: npm run test:codestyle
build-musl-arm:
needs: [lint]
strategy:
fail-fast: false
matrix:
node: [17.6.0, 18.8.0, 19.0.0, 20.0.0, 21.0.0]
include:
- architecture: arm64
architecture_node: x64
target_architecture: arm64
extra_compile_flags: -march=armv8-a
- python_version: 3
node: 17.6.0
- python_version: 3
node: 18.8.0
- python_version: 3
node: 19.0.0
- python_version: 3
node: 20.0.0
- python_version: 3
node: 21.0.0
runs-on: ubuntu-latest
container:
image: dockcross/linux-arm64-musl
credentials:
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.architecture_node }}
- run: apt-get install -y python${{ matrix.python_version }}
- run: node --version
- run: npm --version
- run: chmod 0777 tests/output/
- run: npm install --build-from-source
env:
npm_config_arch: ${{ matrix.architecture }}
npm_config_target_arch: ${{ matrix.target_architecture }}
CFLAGS: ${{ matrix.extra_compile_flags }}
CPPFLAGS: ${{ matrix.extra_compile_flags }}
EXTRA_NODE_PRE_GYP_FLAGS: --target_libc=musl
npm_config_unsafe_perm: true
# - run: npm run test, this is not an arm64 machine so we can not test.
- run: ./node_modules/.bin/node-pre-gyp package --target_libc=musl --target_arch=${{ matrix.target_architecture }}
- uses: actions/upload-artifact@v4
with:
path: build/stage/julianhille/MuhammaraJS/releases/download/**/*.gz
name: bindings-node-musl-arm-${{ matrix.node }}
if-no-files-found: error
build-musl:
needs: [lint]
strategy:
fail-fast: false
matrix:
node: [17.6.0, 18.8.0, 19.0.0, 20.0.0, 21.0.0]
include:
- python_version: 3
node: 17.6.0
- python_version: 3
node: 18.8.0
- python_version: 3
node: 19.0.0
- python_version: 3
node: 20.0.0
- python_version: 3
node: 21.0.0
runs-on: ubuntu-latest
container:
image: node:${{ matrix.node }}-alpine
credentials:
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
steps:
- uses: actions/checkout@v4
- run: apk update
- run: apk add --no-cache make gcc jq g++ python${{ matrix.python_version }} tar
- run: node --version
- run: npm --version
- run: chmod 0777 tests/output/
- run: npm install --build-from-source
env:
EXTRA_NODE_PRE_GYP_FLAGS: --target_libc=musl
npm_config_unsafe_perm: true
- run: npm run test
- run: ./node_modules/.bin/node-pre-gyp package testpackage --target_libc=musl
- uses: actions/upload-artifact@v4
with:
path: build/stage/julianhille/MuhammaraJS/releases/download/**/*.gz
name: bindings-node-musl-${{ matrix.node }}
if-no-files-found: error
build-electron:
needs: [lint]
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-13, windows-2019]
architecture: [x64, ia32, arm64]
electron:
[
25.3.0,
25.2.0,
25.1.0,
25.0.0,
24.6.0,
24.5.0,
24.4.0,
24.3.0,
24.2.0,
24.1.0,
24.0.0,
23.3.0,
23.2.0,
23.1.0,
23.0.0,
]
include:
- electron_mocha_version: ^11
python_version: "3.10"
- architecture: arm64
architecture_node: x64
target_architecture: arm64
extra_compile_flags: -arch arm64
- architecture: ia32
architecture_node: x86
target_architecture: ia32
- architecture: x64
architecture_node: x64
target_architecture: x64
- electron: 25.3.0
node: 18.15.0
- electron: 25.2.0
node: 18.15.0
- electron: 25.1.0
node: 18.15.0
- electron: 25.0.0
node: 18.15.0
- electron: 24.6.0
node: 18.14.0
- electron: 24.5.0
node: 18.14.0
- electron: 24.4.0
node: 18.14.0
- electron: 24.3.0
node: 18.14.0
- electron: 24.2.0
node: 18.14.0
- electron: 24.1.0
node: 18.14.0
- electron: 24.0.0
node: 18.14.0
- electron: 23.3.0
node: 18.12.1
- electron: 23.2.0
node: 18.12.1
- electron: 23.1.0
node: 18.12.1
- electron: 23.0.0
node: 18.12.1
exclude:
- os: macos-13
architecture: ia32
- os: ubuntu-20.04
architecture: arm64
- os: windows-2019
architecture: arm64
- os: ubuntu-20.04
architecture: ia32
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.architecture_node }}
- run: node --version
- run: npm --version
- run: npm install --build-from-source
env:
npm_config_arch: ${{ matrix.architecture }}
npm_config_msbuild_path: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe'
npm_config_target_arch: ${{ matrix.target_architecture }}
npm_config_target: ${{ matrix.electron }}
npm_config_disturl: https://artifacts.electronjs.org/headers/dist
npm_config_runtime: electron
npm_config_python: python${{ matrix.python_version }}
CFLAGS: ${{ matrix.extra_compile_flags }}
CPPFLAGS: ${{ matrix.extra_compile_flags }}
- uses: Wandalen/wretry.action@v3
with:
command: npm install -g electron@${{ matrix.electron }} electron-mocha@${{ matrix.electron_mocha_version }}
attempt_limit: 3
attempt_delay: 10000
- name: Run test
uses: GabrielBB/xvfb-action@v1
with:
working-directory: ./ #optional
run: npm run test:electron
if: ${{ matrix.target_architecture != 'arm64' }}
- run: ./node_modules/.bin/node-pre-gyp package testpackage
env:
npm_config_runtime: electron
npm_config_target: ${{ matrix.electron }}
if: ${{ matrix.target_architecture != 'arm64' }}
- run: ./node_modules/.bin/node-pre-gyp package --target_arch=${{ matrix.target_architecture }}
if: ${{ matrix.target_architecture == 'arm64' }}
env:
npm_config_runtime: electron
npm_config_target: ${{ matrix.electron }}
- uses: actions/upload-artifact@v4
with:
path: build/stage/julianhille/MuhammaraJS/releases/download/**/*.gz
name: bindings-electron-${{ matrix.os }}-${{ matrix.target_architecture }}-${{matrix.electron}}
if-no-files-found: error
build-node:
needs: [lint]
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-13, windows-2019]
node: [17.6.0, 18.8.0, 19.0.0, 20.0.0]
architecture: [x64, ia32, arm64]
include:
- python_version: "3.10"
- architecture: ia32
architecture_node: x86
target_architecture: ia32
- architecture: x64
architecture_node: x64
target_architecture: x64
- architecture: arm64
architecture_node: x64
target_architecture: arm64
extra_compile_flags: -arch arm64
EXTRA_NODE_PRE_GYP_FLAGS: --target_arch=arm64
exclude:
- os: ubuntu-20.04
architecture: arm64
- os: windows-2019
architecture: arm64
- os: macos-13
architecture: ia32
- os: ubuntu-20.04
architecture: ia32
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.architecture_node }}
- run: node --version
- run: npm --version
- run: npm install --build-from-source
env:
npm_config_arch: ${{ matrix.architecture }}
npm_config_target_arch: ${{ matrix.target_architecture }}
npm_config_python: python${{ matrix.python_version }}
npm_config_msbuild_path: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe'
CFLAGS: ${{ matrix.extra_compile_flags }}
CPPFLAGS: ${{ matrix.extra_compile_flags }}
- run: ./node_modules/.bin/node-pre-gyp package testpackage
if: ${{ matrix.target_architecture != 'arm64' }}
- run: ./node_modules/.bin/node-pre-gyp package --target_arch=${{ matrix.target_architecture }}
if: ${{ matrix.target_architecture == 'arm64' }}
- uses: actions/upload-artifact@v4
with:
path: build/stage/julianhille/MuhammaraJS/releases/download/**/*.gz
name: bindings-electron-${{ matrix.os }}-${{ matrix.target_architecture }}-${{matrix.node}}
if-no-files-found: error
publish:
needs: [build-musl, build-musl-arm, build-electron, build-node]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 10
- uses: actions/download-artifact@v4
with:
pattern: bindings-*
path: builds/bindings
id: upload-release-asset
- run: ls -lah builds/bindings/
- name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ github.ref }}
version_extractor_regex: 'tags\/(.*)$'
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.semver_parser.outputs.fullversion }}
release_name: ${{ steps.semver_parser.outputs.fullversion }}
draft: false
prerelease: steps.semver_parser.outputs.prerelease != []
- uses: AButler/[email protected]
with:
files: "builds/bindings/**/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ steps.semver_parser.outputs.fullversion }}
- run: npm install
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}