Skip to content

Commit

Permalink
Prebuild and publish binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Apr 22, 2020
1 parent 3efed54 commit 760bbe2
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 10 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/
20 changes: 20 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

.nyc_output/
coverage
build
node-addon-api

core
vgcore.*
38 changes: 37 additions & 1 deletion .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,11 +13,45 @@ addons:

language: node_js

os:
- linux
- osx

osx_image: xcode10

node_js:
- "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 --v8_enable_pointer_compression=false --v8_enable_31bit_smis_on_64bit_arch=false
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ARCH=ia32 npm run prebuild --v8_enable_pointer_compression=false --v8_enable_31bit_smis_on_64bit_arch=false; 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
25 changes: 21 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ 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 +19,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 +29,26 @@ test_script:
# run tests
- npm test

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

# 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/weak.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
const EventEmitter = require('events');
const { WeakTag, ObjectInfo } = require('bindings')('weakref.node');
const path = require('path');
const { WeakTag, ObjectInfo } = require('node-gyp-build')(path.join(__dirname, '..'));
Object.setPrototypeOf(ObjectInfo, EventEmitter);
Object.setPrototypeOf(ObjectInfo.prototype, EventEmitter.prototype);

Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@
},
"main": "lib/weak.js",
"scripts": {
"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",
"node-addon-api": "^1.1.0",
"setimmediate-napi": "^1.0.3"
"setimmediate-napi": "^1.0.3",
"node-gyp-build": "^4.2.1"
},
"devDependencies": {
"mocha": "^5.0.0",
"nyc": "^11.3.0"
"nyc": "^15.0.0",
"prebuildify": "^3.0.4",
"prebuildify-ci": "^1.0.5"
}
}

0 comments on commit 760bbe2

Please sign in to comment.