Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prebuild and publish binaries #63

Merged
merged 9 commits into from Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -24,3 +24,5 @@ deps/libffi/include/ffi.h
deps/libffi/include/ffitarget.h
deps/libffi/local.exp
vgcore.*

prebuilds/
24 changes: 24 additions & 0 deletions .npmignore
@@ -0,0 +1,24 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

.nyc_output/
coverage
build
node-addon-api

core
deps/libffi/fficonfig.h
deps/libffi/include/ffi.h
deps/libffi/include/ffitarget.h
deps/libffi/local.exp
vgcore.*
39 changes: 37 additions & 2 deletions .travis.yml
Expand Up @@ -2,6 +2,8 @@ sudo: false

env:
- CXX=g++-4.9
- CXX=clang++

addons:
apt:
sources:
Expand All @@ -11,12 +13,45 @@ addons:

language: node_js

os:
- linux
- osx

osx_image: xcode10

node_js:
- "4"
- "6"
- "8"
- "9"
- "10"
- "12"

jobs:
exclude:
- os: osx
env: CXX=g++-4.9
- os: linux
env: CXX=clang++

install:
- npm install --build-from-source

after_success:
- npm install coveralls
- nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls

before_deploy:
- ARCHIVE_NAME="${TRAVIS_TAG:-latest}-$TRAVIS_OS_NAME-`uname -m`.tar"
- npm run prebuild
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ARCH=ia32 npm run prebuild; fi
- tar --create --verbose --file="$ARCHIVE_NAME" --directory "$TRAVIS_BUILD_DIR/prebuilds" .

deploy:
provider: releases
draft: false
prerelease: true
file: "$ARCHIVE_NAME"
skip_cleanup: true
on:
tags: true
node: 12
api_key: $PREBUILD_GITHUB_TOKEN
23 changes: 21 additions & 2 deletions appveyor.yml
Expand Up @@ -5,9 +5,10 @@ environment:
# Test against these versions of Node.js and io.js
matrix:
# node.js
- nodejs_version: "6"
- nodejs_version: "8"
- nodejs_version: "9"
- nodejs_version: "10"
- nodejs_version: "12"

platform:
- x86
Expand All @@ -20,7 +21,7 @@ install:
- ps: Install-Product node $env:nodejs_version $env:platform
- node -p process.arch
- node -p process.version
- npm install
- npm install --build-from-source

# Post-install test scripts.
test_script:
Expand All @@ -30,8 +31,26 @@ test_script:
# run tests
- npm test

after_test:
- ps: If ($env:nodejs_version -eq "12") { npm run prebuild }

# Don't actually build.
build: off

# Set build version format here instead of in the admin panel.
version: "{build}"

artifacts:
- path: prebuilds
name: $(APPVEYOR_REPO_TAG_NAME)-win-$(PLATFORM)
type: zip

deploy:
- provider: GitHub
artifact: /.*\.zip/
draft: false
prerelease: true
auth_token: $(PREBUILD_GITHUB_TOKEN)
on:
appveyor_repo_tag: true
nodejs_version: "12"
3 changes: 2 additions & 1 deletion lib/bindings.js
@@ -1,2 +1,3 @@
'use strict';
module.exports = require('bindings')('ffi_bindings.node');
var path = require('path');
module.exports = require('node-gyp-build')(path.join(__dirname, '..'));
10 changes: 8 additions & 2 deletions package.json
Expand Up @@ -26,20 +26,26 @@
},
"main": "./lib/ffi",
"dependencies": {
"bindings": "^1.3.0",
"debug": "^3.1.0",
"get-uv-event-loop-napi-h": "^1.0.5",
"node-addon-api": "1.6.1",
"node-gyp-build": "^4.2.1",
"ref-napi": "^1.4.0",
"ref-struct-di": "^1.1.0"
},
"devDependencies": {
"bindings": "^1.3.0",
pimterry marked this conversation as resolved.
Show resolved Hide resolved
"fs-extra": "^5.0.0",
"mocha": "^5.0.0",
"nyc": "^12.0.1",
"nyc": "^15.0.0",
"prebuildify": "^3.0.4",
"prebuildify-ci": "^1.0.5",
"ref-array-di": "^1.2.1"
},
"scripts": {
"install": "node-gyp-build",
"prebuild": "prebuildify --napi",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add --strip (strip symbols) to shave off a few bytes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d prefer not to do that.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How so? Just curious, I personally don't care about prebuild and thus package size.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes debugging harder, and it’s most likely not saving a lot of space given that this isn’t a large addon to begin with. But mostly I’d like to have a decent debugging experience, because this is the kind of addon that people are bound to make crash… 😄

"prepack": "prebuildify-ci download && ([ $(ls prebuilds | wc -l) = '4' ] || (echo 'Some prebuilds are missing'; exit 1))",
"test": "node-gyp rebuild --directory test && nyc mocha -gc --reporter spec"
},
"repository": {
Expand Down