Skip to content

Commit cf00623

Browse files
committed
feat(*): use pre-built binaries (#1)
1 parent 5c63103 commit cf00623

9 files changed

Lines changed: 6049 additions & 15 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
name: Automated deploy
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
env:
8+
VERSION: ${{ github.event.release.tag_name }}
9+
TARGET_REF: ${{ github.event.release.target_commitish }}
10+
11+
jobs:
12+
build_x86_64:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ ubuntu-20.04, macos-11, windows-2019 ]
18+
node: [ 14, 16, 18, 19, 20 ]
19+
arch: [ x64 ]
20+
include:
21+
- os: windows-2019
22+
node: 16
23+
arch: ia32
24+
- os: windows-2019
25+
node: 18
26+
arch: ia32
27+
- os: windows-2019
28+
node: 19
29+
arch: ia32
30+
- os: windows-2019
31+
node: 20
32+
arch: ia32
33+
exclude:
34+
- os: windows-2019
35+
node: 14
36+
arch: x64
37+
env:
38+
npm_config_msvs_version: 2019
39+
npm_config_python: python3.10
40+
steps:
41+
- uses: actions/checkout@v3
42+
with:
43+
ref: ${{ env.TARGET_REF }}
44+
token: ${{ secrets.GPR_TOKEN }}
45+
46+
- uses: actions/setup-node@v3
47+
with:
48+
node-version: ${{ matrix.node }}
49+
architecture: ${{ matrix.arch == 'ia32' && 'x86' || 'x64' }}
50+
51+
- name: Install dependencies
52+
run: npm ci --ignore-scripts
53+
54+
- name: Prebuild package
55+
run: npx @mapbox/node-pre-gyp --target_arch=${{ matrix.arch }} configure build package
56+
57+
- name: Upload binaries to GitHub Release
58+
run: npx node-pre-gyp-github publish
59+
env:
60+
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
61+
build_musl_x86_64:
62+
runs-on: ubuntu-20.04
63+
container:
64+
image: node:${{ matrix.node }}-alpine
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
node: [ 14, 16, 18, 19, 20 ]
69+
steps:
70+
- uses: actions/checkout@v3
71+
with:
72+
ref: ${{ env.TARGET_REF }}
73+
token: ${{ secrets.GPR_TOKEN }}
74+
75+
- name: Setup env with Node v${{ matrix.node }}
76+
run: |
77+
apk add --update
78+
apk add --no-cache ca-certificates git curl build-base python3 g++ make
79+
80+
- name: Install dependencies
81+
run: npm ci --ignore-scripts
82+
83+
- name: Prebuild package
84+
run: npx @mapbox/node-pre-gyp configure build package
85+
86+
- name: Upload binaries to GitHub Release
87+
run: |
88+
CC=x86_64-linux-musl-gcc \
89+
CXX=x86_64-linux-musl-g++ \
90+
npx node-pre-gyp-github publish
91+
env:
92+
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
93+
build_aarch64:
94+
runs-on: ubuntu-20.04
95+
strategy:
96+
fail-fast: false
97+
matrix:
98+
node: [ 14, 16, 18, 19, 20 ]
99+
steps:
100+
- uses: actions/checkout@v3
101+
with:
102+
ref: ${{ env.TARGET_REF }}
103+
token: ${{ secrets.GPR_TOKEN }}
104+
105+
- name: Install cross-compilation tools
106+
run: |
107+
sudo apt-get update -yq \
108+
&& sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -yq \
109+
&& sudo apt-get clean \
110+
&& sudo rm -rf /var/lib/apt/lists/*
111+
112+
- uses: actions/setup-node@v3
113+
with:
114+
node-version: ${{ matrix.node }}
115+
116+
- name: Install dependencies
117+
run: npm ci --ignore-scripts
118+
119+
- name: Prebuild package
120+
run: |
121+
CC=aarch64-linux-gnu-gcc \
122+
CXX=aarch64-linux-gnu-g++ \
123+
npx @mapbox/node-pre-gyp --target_arch=arm64 configure build package
124+
125+
- name: Upload binaries to GitHub Release
126+
run: npx node-pre-gyp-github publish
127+
env:
128+
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
129+
build_darwin_aarch64:
130+
runs-on: macos-11
131+
strategy:
132+
fail-fast: false
133+
matrix:
134+
node: [ 14, 16, 18, 19, 20 ]
135+
steps:
136+
- uses: actions/checkout@v3
137+
with:
138+
ref: ${{ env.TARGET_REF }}
139+
token: ${{ secrets.GPR_TOKEN }}
140+
141+
- uses: actions/setup-node@v3
142+
with:
143+
node-version: ${{ matrix.node }}
144+
145+
- name: Install dependencies
146+
run: npm ci --ignore-scripts
147+
148+
- name: Prebuild package
149+
run: |
150+
CFLAGS="-target arm64-apple-macos11 -arch arm64" \
151+
npx @mapbox/node-pre-gyp --target_arch=arm64 configure build package
152+
153+
- name: Upload binaries to GitHub Release
154+
run: npx node-pre-gyp-github publish
155+
env:
156+
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
157+
build_musl_aarch64:
158+
runs-on: ubuntu-20.04
159+
container:
160+
image: node:${{ matrix.node }}-alpine
161+
strategy:
162+
fail-fast: false
163+
matrix:
164+
node: [ 14, 16, 18, 19, 20 ]
165+
steps:
166+
- uses: actions/checkout@v3
167+
with:
168+
ref: ${{ env.TARGET_REF }}
169+
token: ${{ secrets.GPR_TOKEN }}
170+
171+
- name: Setup env with Node v${{ matrix.node }}
172+
run: |
173+
apk add --update
174+
apk add --no-cache ca-certificates git curl build-base python3 g++ make
175+
176+
- name: Setup musl cross compiler
177+
run: |
178+
curl -OL https://musl.cc/aarch64-linux-musl-cross.tgz
179+
tar -xzvf aarch64-linux-musl-cross.tgz
180+
$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc --version
181+
182+
- name: Install dependencies
183+
run: npm ci --ignore-scripts
184+
185+
- name: Prebuild package
186+
run: |
187+
CC=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc \
188+
CXX=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++ \
189+
npx @mapbox/node-pre-gyp --target_arch=arm64 configure build package
190+
191+
- name: Upload binaries to GitHub Release
192+
run: npx node-pre-gyp-github publish
193+
env:
194+
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
195+
build_arm:
196+
runs-on: ubuntu-20.04
197+
strategy:
198+
fail-fast: false
199+
matrix:
200+
node: [ 14, 16, 18, 19, 20 ]
201+
steps:
202+
- uses: actions/checkout@v3
203+
with:
204+
ref: ${{ env.TARGET_REF }}
205+
token: ${{ secrets.GPR_TOKEN }}
206+
207+
- name: Install cross-compilation tools
208+
run: |
209+
sudo apt-get update -yq \
210+
&& sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -yq \
211+
&& sudo apt-get clean \
212+
&& sudo rm -rf /var/lib/apt/lists/*
213+
214+
- uses: actions/setup-node@v3
215+
with:
216+
node-version: ${{ matrix.node }}
217+
218+
- name: Install dependencies
219+
run: npm ci --ignore-scripts
220+
221+
- name: Prebuild package
222+
run: |
223+
CC=arm-linux-gnueabihf-gcc \
224+
CXX=arm-linux-gnueabihf-g++ \
225+
npx @mapbox/node-pre-gyp --target_arch=arm configure build package
226+
227+
- name: Upload binaries to GitHub Release
228+
run: npx node-pre-gyp-github publish
229+
env:
230+
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
231+
build_musl_arm:
232+
runs-on: ubuntu-20.04
233+
container:
234+
image: node:${{ matrix.node }}-alpine
235+
strategy:
236+
fail-fast: false
237+
matrix:
238+
node: [ 14, 16, 18, 19, 20 ]
239+
steps:
240+
- uses: actions/checkout@v3
241+
with:
242+
ref: ${{ env.TARGET_REF }}
243+
token: ${{ secrets.GPR_TOKEN }}
244+
245+
- name: Setup env with Node v${{ matrix.node }}
246+
run: |
247+
apk add --update
248+
apk add --no-cache ca-certificates git curl build-base python3 g++ make
249+
250+
- name: Setup musl cross compiler
251+
run: |
252+
curl -OL https://musl.cc/arm-linux-musleabihf-cross.tgz
253+
tar -xzvf arm-linux-musleabihf-cross.tgz
254+
$(pwd)/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc --version
255+
256+
- name: Install dependencies
257+
run: npm ci --ignore-scripts
258+
259+
- name: Prebuild package
260+
run: |
261+
CC=$(pwd)/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc \
262+
CXX=$(pwd)/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-g++ \
263+
npx @mapbox/node-pre-gyp --target_arch=arm configure build package
264+
265+
- name: Upload binaries to GitHub Release
266+
run: npx node-pre-gyp-github publish
267+
env:
268+
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
269+
deploy:
270+
needs:
271+
- build_x86_64
272+
- build_musl_x86_64
273+
- build_aarch64
274+
- build_darwin_aarch64
275+
- build_musl_aarch64
276+
- build_arm
277+
- build_musl_arm
278+
runs-on: ubuntu-latest
279+
steps:
280+
- uses: actions/checkout@v3
281+
with:
282+
ref: ${{ env.TARGET_REF }}
283+
token: ${{ secrets.GPR_TOKEN }}
284+
285+
- uses: actions/setup-node@v3
286+
with:
287+
node-version: 18
288+
registry-url: 'https://registry.npmjs.org'
289+
290+
- name: Install dependencies
291+
run: npm ci --ignore-scripts
292+
293+
- name: Publish to npm
294+
run: npm publish
295+
env:
296+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
297+
298+
- uses: actions/setup-node@v3
299+
with:
300+
node-version: 18
301+
registry-url: 'https://npm.pkg.github.com'
302+
scope: '@NeuraLegion'
303+
304+
- name: Publish to GPR
305+
run: npm publish
306+
env:
307+
NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }}

.github/workflows/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Semantic release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
token: ${{ secrets.GPR_TOKEN }}
15+
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 18
19+
20+
- run: npm ci --ignore-scripts
21+
- run: npm run semantic-release
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
syntax: glob
22
build
3+
.idea
4+
lib
35
node_modules
46
npm-debug.log
5-
package-lock.json

.releaserc

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"plugins": [
3+
[
4+
"@semantic-release/commit-analyzer",
5+
{
6+
"parserOpts": {
7+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
8+
}
9+
}
10+
],
11+
[
12+
"@semantic-release/release-notes-generator",
13+
{
14+
"preset": "angular",
15+
"parserOpts": {
16+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
17+
},
18+
"writerOpts": {
19+
"commitsSort": ["subject", "scope"]
20+
}
21+
}
22+
],
23+
[
24+
"@semantic-release/npm",
25+
{
26+
"npmPublish": false
27+
}
28+
],
29+
[
30+
"@semantic-release/exec",
31+
{
32+
"prepareCmd": "npm version --no-git-tag-version --allow-same-version ${nextRelease.version}"
33+
}
34+
],
35+
[
36+
"@semantic-release/git",
37+
{
38+
"assets": ["package*.json"],
39+
"message": "chore(release): cut the ${nextRelease.version} release [skip ci]"
40+
}
41+
],
42+
[
43+
"@semantic-release/github",
44+
{
45+
"labels": false,
46+
"releasedLabels": false,
47+
"failTitle": false,
48+
"failComment": false,
49+
"successComment": false
50+
}
51+
]
52+
],
53+
"branches": [
54+
{
55+
"name": "master"
56+
}
57+
],
58+
"ci": true
59+
}

0 commit comments

Comments
 (0)