Skip to content

Commit 6aaf682

Browse files
authored
Prebuild with GitHub Actions (#1)
1 parent c8b6453 commit 6aaf682

File tree

2 files changed

+91
-7
lines changed

2 files changed

+91
-7
lines changed

.github/workflows/ci.yml

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,47 @@
1-
name: Build/test
1+
name: build
2+
23
on:
34
push:
45
branches:
56
- master
67
pull_request:
78
branches:
89
- master
10+
release:
11+
types:
12+
- released
13+
14+
env:
15+
NODE_BUILD_CMD: npx prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 -t 20.0.0
16+
ELECTRON_BUILD_CMD: npx prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0
17+
918
jobs:
19+
1020
test:
11-
runs-on: ${{ matrix.os }}
1221
strategy:
13-
fail-fast: true
1422
matrix:
15-
os: [macos-latest, ubuntu-latest]
23+
os:
24+
- ubuntu-latest
25+
- macos-latest
26+
node:
27+
- 14
28+
- 16
29+
- 18
30+
- 20
31+
fail-fast: false
32+
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
33+
runs-on: ${{ matrix.os }}
1634
steps:
1735
- uses: actions/checkout@v3
1836
with:
1937
submodules: true
2038
fetch-depth: 0
2139
- uses: actions/setup-node@v3
2240
with:
23-
node-version: 16
41+
node-version: ${{ matrix.node }}
2442
- run: npm install
2543
- run: npm test
44+
2645
test_windows:
2746
runs-on: windows-latest
2847
steps:
@@ -35,3 +54,52 @@ jobs:
3554
node-version: 16
3655
- run: npm install
3756
- run: npm run-script test-windows
57+
58+
publish:
59+
if: ${{ github.event_name == 'release' }}
60+
name: Publishing to NPM
61+
runs-on: ubuntu-latest
62+
needs: [ test, test_windows ]
63+
steps:
64+
- uses: actions/checkout@v3
65+
with:
66+
submodules: true
67+
fetch-depth: 0
68+
- uses: actions/setup-node@v3
69+
with:
70+
node-version: 18
71+
registry-url: https://registry.npmjs.org
72+
- run: npm publish
73+
env:
74+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
75+
76+
prebuild:
77+
strategy:
78+
matrix:
79+
os:
80+
- ubuntu-latest
81+
- macos-latest
82+
- windows-latest
83+
fail-fast: false
84+
name: Prebuild on ${{ matrix.os }}
85+
runs-on: ${{ matrix.os }}
86+
needs: publish
87+
steps:
88+
- uses: actions/checkout@v3
89+
with:
90+
submodules: true
91+
fetch-depth: 0
92+
- uses: actions/setup-node@v3
93+
with:
94+
node-version: 18
95+
- run: npm install --ignore-scripts
96+
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GH_TOKEN }}
97+
- run: ${{ env.ELECTRON_BUILD_CMD }} -u ${{ secrets.GH_TOKEN }}
98+
- if: matrix.os == 'windows-latest'
99+
run: |
100+
${{ env.NODE_BUILD_CMD }} --arch ia32 -u ${{ secrets.GH_TOKEN }}
101+
${{ env.ELECTRON_BUILD_CMD }} --arch ia32 -u ${{ secrets.GH_TOKEN }}
102+
- if: matrix.os == 'macos-latest'
103+
run: |
104+
${{ env.NODE_BUILD_CMD }} --arch arm64 -u ${{ secrets.GH_TOKEN }}
105+
${{ env.ELECTRON_BUILD_CMD }} --arch arm64 -u ${{ secrets.GH_TOKEN }}

binding.gyp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,23 @@
1313
],
1414
"cflags_c": [
1515
"-std=c99",
16-
]
16+
],
17+
"cflags_cc": ["-std=c++17"],
18+
"xcode_settings": {
19+
"OTHER_CPLUSPLUSFLAGS": ["-std=c++17", "-stdlib=libc++"],
20+
},
21+
"msvs_settings": {
22+
"VCCLCompilerTool": {
23+
"AdditionalOptions": [
24+
"/std:c++17",
25+
],
26+
"RuntimeLibrary": 0,
27+
},
28+
},
29+
1730
}
18-
]
31+
],
32+
'variables': {
33+
'openssl_fips': '',
34+
},
1935
}

0 commit comments

Comments
 (0)