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

Auto-build binaries on release #152

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ build
.DS_Store
node_modules
npm-debug.log
lib/binding
deps/minifier/bin/minify
run-all-tests-output.log
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
threads_a_gogo.node
build
.lock-wscript
lib/binding
114 changes: 100 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,106 @@
# Portions of this file derived from https://github.com/creationix/node-gamepad/blob/master/.travis.yml
#
# node-gamepad code used under the MIT License:
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Tim Caswell
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

language: node_js

node_js:
- "7.0"
- "6.9"
- "4.6"
- "0.12"
- "0.10"
sudo: false

install:
- CXX="g++-4.8" CC="gcc-4.8" npm install
os:
- linux
- osx

env:
global:
- secure: KrnF6XWHwqwvy+m2VRltpJv7/8UfvcAAKFBxkhoB62YfZMx/4Qur9Gzzi9/U+Ulxb8VDUbDP7rmmqo90kEENcSbjgnKv0XYjWMVz/8+6MVnf8lDGY6B7+NVHu8KnmVElHYjjZUt8iuwN/0E1jThXvFS8f9B6sz7kl/oq4xJwpQi5mcY5nT2gTY3fLGru7V7+GrJ0Ukg2fkw3DrFC9YZnLJCqNzVS9vOyJZwvn7ZkoeJOw68MkqxedKlmDqa5uUbfSNFqJyd3OGKw1P61tf40cql1vxPZ/k42hlTv/Dc/mZ700Pc4PVdGPz9B/DN3neB9J82fCu2iyeJ/WaaOfm8hLf9nFjO46fpvrNmS/dW6ZMkWgE/HN9LmJPKpiD6fNM5/Lb2pOEP2zFT+lWLq0q/w46+qKnd0FbK/I+EkBG9cP5ei03Zr7EMlgRd13papfcixPPhD75vFxOyjNS3NtulOLVOXLBXyXf2fnCvcJijblz1pdll3CUvS8Ohh/f/oSS6gVp6EGQlzg4a9FlW/ZwxbPvsGy/YJbIFGJCCt0neFEe4SNTb/kc1GieckwWNyaTaE2QxBlkApkKbcYDkFZI6HdUneTH1kf6D7ZjTx5GiiB6BaOZp/yApxJn7cpwQuZGYb67+9A/yqQAfgtDcxHi3CQKge3Y5qJc7zEfMB9UkJZjw=

# thanks to http://stackoverflow.com/a/30925448/1283667:
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.8']

node_js:
- '7'
- '6'
- '4'
- '0.12'
- '0.10'

before_install:

# Use yarn on node > 4
# v0.22.0 is a temporary workaround for https://github.com/yarnpkg/yarn/issues/3138
- if [[ "$TRAVIS_NODE_VERSION" == "0.10" ]] || [[ "$TRAVIS_NODE_VERSION" == "0.12" ]]; then
export INSTALL_LOCAL="npm install";
export INSTALL_GLOBAL="npm install -g";
else
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.22.0;
export INSTALL_LOCAL="yarn";
export INSTALL_GLOBAL="yarn global add";
fi;

# Use gcc 4.8 on linux and clang on osx
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX=g++-4.8; fi

# get commit message
- COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')

# put local node_modules on PATH
- export PATH=./node_modules/.bin/:$PATH

# put global node-gyp on PATH
- eval $INSTALL_GLOBAL node-gyp

- PUBLISH_BINARY=false

# if we are building a tag then publish
- if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then PUBLISH_BINARY=true; fi;

# or if we put [publish binary] in the commit message
- if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi;

install:
# ensure source install works
- eval $INSTALL_LOCAL --build-from-source
# test module import
- node index.js

before_script:
- if [[ $PUBLISH_BINARY == true ]]; then
node-pre-gyp package;
node-pre-gyp-github publish --release;
fi;
- node-pre-gyp clean
- node-gyp clean

script:
# if publishing, test installing from remote
- if [[ $PUBLISH_BINARY == true ]]; then eval $INSTALL_LOCAL --fallback-to-build=false; fi;
# If success then we arrive here so lets clean up
- node-pre-gyp clean

after_success:
# if success then query and display all published binaries
- node-pre-gyp info
116 changes: 116 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Portions of this file derived from https://github.com/creationix/node-gamepad/blob/master/appveyor.yml
# and https://github.com/EmergingTechnologyAdvisors/node-serialport/blob/master/appveyor.yml
#
# node-gamepad code used under the MIT License:
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Tim Caswell
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# node-serialport code used under the MIT License:
#
# Copyright 2010, 2011, 2012 Christopher Williams. All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

os: Visual Studio 2015

# Fix line endings on Windows
init:
- git config --global core.autocrlf true

environment:
NODE_PRE_GYP_GITHUB_TOKEN:
secure: JIFkGFpWcdJz5bD8hoc9GaCwUIV2openq0IDowt9DRfc8/guS/HTQdjru0Zrb0Dg

matrix:
- nodejs_version: "0.10"
- nodejs_version: "0.12"
- nodejs_version: 4
- nodejs_version: 6
- nodejs_version: 7

platform:
- x86
- x64

install:
- cmd: ECHO "%nodejs_version%"
- cmd: ECHO "%platform%"
- cmd: ECHO "%APPVEYOR_REPO_COMMIT_MESSAGE%"

- cmd: SET PATH=%cd%\node_modules\.bin\;%PATH%
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:platform
- ps: >
if (($env:nodejs_version -eq "0.10") -or ($env:nodejs_version -eq "0.12")) {
$env:install_global = "npm install -g"
$env:install_local = "npm install"
} else {
$env:install_global = "yarn global add"
$env:install_local = "yarn"
}
true;

- cmd: "%install_global% npm"

- cmd: SET COMMIT_MSG="%APPVEYOR_REPO_COMMIT_MESSAGE%"
- cmd: SET PUBLISH_BINARY=false

# Check to verify the branch is the same than latest tag, if so
# then we publish the binaries if everything else is successful.
- cmd: git describe --tags --always HEAD > _git_tag.tmp
- cmd: SET /p GIT_TAG=<_git_tag.tmp
- cmd: ECHO %GIT_TAG%
- cmd: ECHO %APPVEYOR_REPO_BRANCH%
- cmd: DEL _git_tag.tmp
- cmd: IF x%APPVEYOR_REPO_BRANCH%==x%GIT_TAG% SET PUBLISH_BINARY=true

# Or look for commit message containing `[publish binary]`
- cmd: IF not x%COMMIT_MSG:[publish binary]=%==x%COMMIT_MSG% SET PUBLISH_BINARY=true
- cmd: ECHO %PUBLISH_BINARY%

# to run your custom scripts instead of automatic MSBuild
build_script:
- cmd: "%install_local% --build-from-source --msvs_version=2015"

on_success:
- cmd: IF %PUBLISH_BINARY%==true (node-pre-gyp package 2>&1)
- cmd: IF %PUBLISH_BINARY%==true (node-pre-gyp-github publish --release 2>&1)
- cmd: IF %PUBLISH_BINARY%==true (node-pre-gyp clean)
- cmd: IF %PUBLISH_BINARY%==true (%install_local% --fallback-to-build=false)

test: OFF
deploy: OFF
13 changes: 12 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"targets": [
{
"target_name": "WebWorkerThreads",
"target_name": "<(module_name)",
"sources": [
"src/WebWorkerThreads.cc"
],
Expand All @@ -27,6 +27,17 @@
}
]
]
},
{
'target_name': 'action_after_build',
'type': 'none',
'dependencies': ['<(module_name)'],
'copies': [
{
'files': ['<(PRODUCT_DIR)/<(module_name).node'],
'destination': '<(module_path)'
}
]
}
]
}
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var WebWorkerThreads = require('bindings')('WebWorkerThreads');

module.exports = WebWorkerThreads;
var binary = require('node-pre-gyp');
var path = require('path');
var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json')));

module.exports = require(binding_path);
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,34 @@
],
"repository": {
"type": "git",
"url": "http://github.com/audreyt/node-webworker-threads.git"
"url": "http://github.com/tptee/node-webworker-threads.git"
},
"scripts": {
"install": "node-pre-gyp install --fallback-to-build",
"js": "env PATH=./node_modules/.bin:\"$PATH\" lsc -cj package.ls;\ngcc deps/minifier/src/minify.c -o deps/minifier/bin/minify;\nenv PATH=./node_modules/.bin:\"$PATH\" lsc -cbp src/worker.ls > src/worker.js;\n./deps/minifier/bin/minify kWorker_js < src/worker.js > src/worker.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" lsc -cbp src/events.ls > src/events.js;\n./deps/minifier/bin/minify kEvents_js < src/events.js > src/events.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" lsc -cbp src/createPool.ls > src/createPool.js;\n./deps/minifier/bin/minify kCreatePool_js < src/createPool.js > src/createPool.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" lsc -cbp src/thread_nextTick.ls > src/thread_nextTick.js;\n./deps/minifier/bin/minify kThread_nextTick_js 1 < src/thread_nextTick.js > src/thread_nextTick.js.c;\nenv PATH=./node_modules/.bin:\"$PATH\" lsc -cbp src/load.ls > src/load.js;\n./deps/minifier/bin/minify kLoad_js 1 1 < src/load.js > src/load.js.c;",
"pretest": "npm run js && node-gyp rebuild",
"test": "./run-all-tests.sh"
},
"dependencies": {
"node-pre-gyp": "^0.6.33",
"node-pre-gyp-github": "^1.3.1"
"bindings": "^1.3.0",
"nan": "^2.8.0"
},
"bundledDependencies": [
"node-pre-gyp"
],
"devDependencies": {
"livescript": "^1.5.0",
"tap": "^5.7.1"
},
"binary": {
"module_name": "WebWorkerThreads",
"module_path": "./lib/binding/{node_abi}-{platform}-{arch}",
"package_name": "{node_abi}-{platform}-{arch}.tar.gz",
"host": "https://github.com/tptee/node-webworker-threads/releases/download/",
"remote_path": "v{version}"
},
"gypfile": true,
"engines": {
"node": ">= 0.10.16"
Expand Down
Loading