diff --git a/.gitignore b/.gitignore index 2cab609..b77bcb4 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ npm-debug.log coverage build node-addon-api + +prebuilds/ diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..bb60c74 --- /dev/null +++ b/.npmignore @@ -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.* + diff --git a/.travis.yml b/.travis.yml index 0cb9e2e..5736812 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ sudo: false env: - CXX=g++-4.9 + - CXX=clang++ + addons: apt: sources: @@ -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 diff --git a/appveyor.yml b/appveyor.yml index 8fd3f4c..b7a9092 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 @@ -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: @@ -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" diff --git a/lib/ref.js b/lib/ref.js index 671bc5a..253f0bd 100644 --- a/lib/ref.js +++ b/lib/ref.js @@ -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(); diff --git a/package.json b/package.json index a29e180..b84f225 100644 --- a/package.json +++ b/package.json @@ -31,12 +31,15 @@ "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", @@ -44,7 +47,9 @@ "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" } }