Skip to content

Commit 0ebed6d

Browse files
authored
Build native modules with electron runtime (#70)
* Build with electron and test electron on windows. * Bump node-abi. * Update electron. * build -> test -> publish. * Bump electron-mocha. * Larger timeout for parallel test. * Use specific electron version. * Use correct node version on Windows. * This causes issues. * Ignore electron 10 for testing.
1 parent 1a4523a commit 0ebed6d

4 files changed

Lines changed: 728 additions & 277 deletions

File tree

.circleci/config.yml

Lines changed: 63 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ orbs:
44
win: circleci/windows@2.4.0
55

66
aliases:
7+
- &build-command
8+
name: Build
9+
command: |
10+
GYP_ARGS=""
11+
if [[ "${ELECTRON_VERSION}" ]]; then
12+
GYP_ARGS="--runtime=electron --target=${ELECTRON_VERSION} --dist-url=https://electronjs.org/headers"
13+
fi
14+
./node_modules/.bin/node-pre-gyp rebuild package testpackage $GYP_ARGS
15+
16+
- &build-command-windows
17+
name: Build
18+
shell: bash.exe
19+
command: |
20+
export PATH=/c/nodejs:$PATH
21+
GYP_ARGS=""
22+
if [[ "${ELECTRON_VERSION}" ]]; then
23+
GYP_ARGS="--runtime=electron --target=${ELECTRON_VERSION} --dist-url=https://electronjs.org/headers"
24+
fi
25+
./node_modules/.bin/node-pre-gyp rebuild package testpackage $GYP_ARGS
26+
727
- &publish-command
828
name: Publish
929
command: |
@@ -12,9 +32,7 @@ aliases:
1232
GYP_ARGS="--runtime=electron --target=${ELECTRON_VERSION} --dist-url=https://electronjs.org/headers"
1333
fi
1434
COMMIT_MESSAGE=`git log --format=%s -n 1 $CIRCLE_SHA1`
15-
./node_modules/.bin/node-pre-gyp rebuild package testpackage $GYP_ARGS
1635
if [[ ${COMMIT_MESSAGE} =~ "[publish binary]" ]] && [[ "$PUBLISH" == "true" ]]; then
17-
./node_modules/.bin/node-pre-gyp package testpackage $GYP_ARGS
1836
./node_modules/.bin/node-pre-gyp publish $GYP_ARGS
1937
else
2038
echo "Not a tagged build - not publishing"
@@ -24,11 +42,13 @@ aliases:
2442
name: Publish
2543
shell: bash.exe
2644
command: |
45+
GYP_ARGS=""
46+
if [[ "${ELECTRON_VERSION}" ]]; then
47+
GYP_ARGS="--runtime=electron --target=${ELECTRON_VERSION} --dist-url=https://electronjs.org/headers"
48+
fi
2749
export PATH=/c/nodejs:$PATH
2850
COMMIT_MESSAGE=`git log --format=%s -n 1 $CIRCLE_SHA1`
29-
./node_modules/.bin/node-pre-gyp rebuild package testpackage
3051
if [[ ${COMMIT_MESSAGE} =~ "[publish binary]" ]] && [[ "$PUBLISH" == "true" ]]; then
31-
./node_modules/.bin/node-pre-gyp package testpackage
3252
./node_modules/.bin/node-pre-gyp publish $GYP_ARGS
3353
else
3454
echo "Not a tagged build - not publishing"
@@ -43,6 +63,7 @@ aliases:
4363
- run: curl -sSL https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
4464
- run: sudo apt-get update && sudo apt-get install -y git-lfs && git-lfs install --force && git-lfs pull
4565
- run: npm install --build-from-source
66+
- run: *build-command
4667

4768
- run: npm run test
4869
- run: *publish-command
@@ -62,8 +83,13 @@ aliases:
6283
- run: sudo apt-get update && sudo apt-get install -y git-lfs && git-lfs install --force && git-lfs pull
6384
# These are required for electron(-mocha)
6485
- run: sudo apt-get install -y libgtk2.0-0 libgtk-3-dev libxtst6 libxss1 libgconf2-4 libnss3 libasound2
65-
- run: npm install --build-from-source
66-
- run: ./node_modules/.bin/electron-rebuild --version=$ELECTRON_VERSION --dist-url=https://electronjs.org/headers
86+
- run:
87+
name: Install
88+
command: |
89+
node -v
90+
npm install --build-from-source
91+
npm install electron@$ELECTRON_VERSION
92+
- run: *build-command
6793
- run: npm run pretest
6894
- run: xvfb-run ./node_modules/.bin/electron-mocha --timeout 480000
6995
- run: *publish-command
@@ -97,10 +123,9 @@ aliases:
97123
command: |
98124
node -v
99125
npm install --build-from-source
100-
126+
- run: *build-command
101127
- run: npm run test
102-
- run:
103-
<<: *publish-command
128+
- run: *publish-command
104129

105130
- &common-electron-macos
106131
macos:
@@ -127,12 +152,13 @@ aliases:
127152
node -v
128153
129154
- run:
130-
name: Install & Build
155+
name: Install
131156
command: |
132157
node -v
133158
npm install --build-from-source
159+
npm install electron@$ELECTRON_VERSION
134160
135-
- run: ./node_modules/.bin/electron-rebuild --version=$ELECTRON_VERSION --dist-url=https://electronjs.org/headers
161+
- run: *build-command
136162
- run: npm run pretest
137163
- run: ./node_modules/.bin/electron-mocha --timeout 480000
138164
- run:
@@ -162,9 +188,10 @@ aliases:
162188
- run:
163189
name: Install
164190
command: npm install --build-from-source
191+
- run: *build-command-windows
165192
- run: npm run test
166-
- run:
167-
<<: *publish-command-windows
193+
- run: ./node_modules/.bin/electron-mocha --timeout 480000
194+
- run: *publish-command-windows
168195
- store_artifacts:
169196
path: c:\\project\\lib\\binding
170197
# These tests pass, but exit with code 1 on Windows. Disable for now
@@ -178,6 +205,7 @@ jobs:
178205
<<: *common-build
179206
environment:
180207
PUBLISH: true
208+
ELECTRON_VERSION: "11.2.3"
181209
docker:
182210
- image: circleci/node:14.11.0
183211

@@ -193,12 +221,19 @@ jobs:
193221

194222
# Node version should match electron's node version.
195223
# See https://github.com/mapbox/node-sqlite3/pull/1367
224+
build-electron-11:
225+
<<: *common-electron-linux
226+
docker:
227+
- image: circleci/node:12.18.3
228+
environment:
229+
ELECTRON_VERSION: "11.2.3"
230+
196231
build-electron-10:
197232
<<: *common-electron-linux
198233
docker:
199234
- image: circleci/node:12.16.3
200235
environment:
201-
ELECTRON_VERSION: "10.1.2"
236+
ELECTRON_VERSION: "10.3.2"
202237

203238
build-electron-9:
204239
<<: *common-electron-linux
@@ -233,6 +268,7 @@ jobs:
233268
environment:
234269
PUBLISH: true
235270
NODE_VERSION: "14.11.0"
271+
ELECTRON_VERSION: "11.2.3"
236272

237273
build-macos-12:
238274
<<: *common-macos
@@ -246,10 +282,16 @@ jobs:
246282

247283
# NODE_VERSION should match electron's node version.
248284
# See https://github.com/mapbox/node-sqlite3/pull/1367
285+
build-macos-electron-11:
286+
<<: *common-electron-macos
287+
environment:
288+
ELECTRON_VERSION: "11.2.3"
289+
NODE_VERSION: "12.18.3"
290+
249291
build-macos-electron-10:
250292
<<: *common-electron-macos
251293
environment:
252-
ELECTRON_VERSION: "10.1.2"
294+
ELECTRON_VERSION: "10.3.2"
253295
NODE_VERSION: "12.16.3"
254296

255297
build-macos-electron-9:
@@ -284,13 +326,15 @@ jobs:
284326
NODE_VERSION: "14.11.0"
285327
NODE_ARCH: x86
286328
PUBLISH: true
329+
ELECTRON_VERSION: "11.2.3"
287330

288331
windows-14_x64:
289332
<<: *common-windows
290333
environment:
291334
NODE_VERSION: "14.11.0"
292335
NODE_ARCH: x64
293336
PUBLISH: true
337+
ELECTRON_VERSION: "11.2.3"
294338

295339
workflows:
296340
version: 2
@@ -299,15 +343,17 @@ workflows:
299343
- build-14
300344
- build-12
301345
- build-10
302-
- build-electron-10
346+
- build-electron-11
347+
# - build-electron-10 # Segfaults on electron-mocha
303348
- build-electron-9
304349
- build-electron-8
305350
- build-electron-7
306351
- build-electron-6
307352
- build-macos-14
308353
- build-macos-12
309354
- build-macos-10
310-
- build-macos-electron-10
355+
- build-macos-electron-11
356+
# - build-macos-electron-10 # Segfaults on electron-mocha
311357
- build-macos-electron-9
312358
- build-macos-electron-8
313359
- build-macos-electron-7

0 commit comments

Comments
 (0)