Skip to content

Commit

Permalink
Prebuild and publish binaries
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Perry <pimterry@gmail.com>
Co-authored-by: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
addaleax and pimterry committed Apr 22, 2020
1 parent f0775c1 commit e8660cf
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ npm-debug.log
coverage
build
node-addon-api

prebuilds/
21 changes: 21 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

.nyc_output/
coverage
build
node-addon-api

core
vgcore.*

39 changes: 37 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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/ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ const assert = require('assert');
const inspect = require('util').inspect;
const debug = require('debug')('ref');
const os = require('os');
const path = require('path');

exports = module.exports = require('bindings')('binding');
exports = module.exports = require('node-gyp-build')(path.join(__dirname, '..'));

exports.endianness = os.endianness();

Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,25 @@
"main": "./lib/ref.js",
"scripts": {
"docs": "node docs/compile",
"test": "nyc mocha -gc"
"test": "nyc mocha -gc",
"install": "node-gyp-build",
"prebuild": "prebuildify --napi",
"prepack": "prebuildify-ci download && ([ $(ls prebuilds | wc -l) = '4' ] || (echo 'Some prebuilds are missing'; exit 1))"
},
"dependencies": {
"bindings": "^1.3.0",
"debug": "^3.1.0",
"node-addon-api": "^2.0.0"
"node-addon-api": "^2.0.0",
"node-gyp-build": "^4.2.1"
},
"devDependencies": {
"dox": "0.9.0",
"highlight.js": "^9.12.0",
"jade": "^1.11.0",
"marked": "^0.7.0",
"mocha": "^5.0.0",
"nyc": "^12.0.1",
"nyc": "^15.0.0",
"prebuildify": "^3.0.4",
"prebuildify-ci": "^1.0.5",
"weak-napi": "1"
}
}

0 comments on commit e8660cf

Please sign in to comment.