Skip to content

Commit

Permalink
Support prebuild (#366)
Browse files Browse the repository at this point in the history
Simplifies distribution of pre-built binaries.

* Fixes #201
* Fixes #297
  • Loading branch information
orgads committed Jul 22, 2023
1 parent a1936c6 commit b508587
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 3 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Add native binaries to release

on:
release:
types: [created]

jobs:
prebuild:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Add msbuild to PATH
if: matrix.os == 'windows-latest'
uses: microsoft/[email protected]
- name: Install node-gyp
if: matrix.os == 'windows-latest'
run: |
npm install --global node-gyp@latest
- name: Build
run: |
npm install --ignore-scripts
- name: Prebuild
run: |
npm run prebuild
- name: Upload
run: |
npx prebuild --upload ${{ secrets.UPLOAD_TOKEN }}
env:
MAKEFLAGS: -j4

prebuild-alpine:
runs-on: ubuntu-latest
container: node:18-alpine3.18
steps:
- uses: actions/checkout@v3
- name: install build deps
run: |
apk add g++ make python3
- name: Build
run: |
npm install --ignore-scripts
- name: Prebuild
run: |
npm run prebuild
- name: Upload
run: |
npx prebuild --upload ${{ secrets.UPLOAD_TOKEN }}
env:
MAKEFLAGS: -j4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ package-lock.json
out/
.cache/
compile_commands.json
/prebuilds/
8 changes: 8 additions & 0 deletions .prebuildrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"target": [
"16.20.1",
"18.16.1",
"20.4.0"
],
"strip": true
}
18 changes: 15 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,25 @@
"node": ">=16.0.0"
},
"scripts": {
"install": "node-gyp rebuild --release -j 4",
"postinstall": "node-gyp clean",
"install": "prebuild-install || (node-gyp rebuild --release -j 4 && node-gyp clean)",
"rebuild": "node-gyp rebuild --release -j 4",
"prebuild": "prebuild",
"upload": "prebuild --upload ${GITHUB_TOKEN}",
"lint": "find src -name '*.cc' | xargs -n1 clang-tidy",
"test": "node test.js"
},
"dependencies": {
"prebuild-install": "^7.1.1"
},
"devDependencies": {
"isolated-vm": "."
"isolated-vm": ".",
"prebuild": "^11.0.4"
},
"overrides": {
"node-gyp": "^9.4.0"
},
"binary": {
"module_path": "out"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit b508587

Please sign in to comment.