From df0afec13bb9f23b26afdeb7357f34291f16d746 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sat, 7 Mar 2015 14:59:27 -0800 Subject: [PATCH 1/5] upgrade to node-pre-gyp 0.6.x --- Makefile | 32 +++++++++++++++++++++----------- package.json | 2 +- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 4c664a8..46a9343 100644 --- a/Makefile +++ b/Makefile @@ -8,23 +8,33 @@ INCLUDES_REPORT_FILES := $(subst src,check_reports,$(INCLUDE_FILES:.hpp=.compile DEMOS := $(shell find demo -mindepth 1 -maxdepth 1 -type d) -all: build -.PHONY: all build +all: build-all +.PHONY: all build-all -./node_modules: - npm install --build-from-source +./node_modules/node-pre-gyp: + npm install node-pre-gyp -build: ./node_modules - ./node_modules/.bin/node-pre-gyp build --loglevel=silent +./node_modules: ./node_modules/node-pre-gyp + npm install `node -e "console.log(Object.keys(require('./package.json').dependencies).join(' '))"` \ + `node -e "console.log(Object.keys(require('./package.json').devDependencies).join(' '))"` --clang=1 -debug: - ./node_modules/.bin/node-pre-gyp rebuild --debug +./build: + ./node_modules/.bin/node-pre-gyp configure --loglevel=error --clang=1 -verbose: - ./node_modules/.bin/node-pre-gyp rebuild --loglevel=verbose +build-all: ./node_modules ./build + ./node_modules/.bin/node-pre-gyp build --loglevel=error --clang=1 + +debug: ./node_modules ./build + ./node_modules/.bin/node-pre-gyp build --debug --clang=1 + +coverage: ./node_modules ./build + ./node_modules/.bin/node-pre-gyp build --debug --clang=1 --coverage=true + +verbose: ./node_modules + ./node_modules/.bin/node-pre-gyp build --loglevel=verbose --clang=1 clean: - rm -rf ./build ./check_reports lib/binding + rm -rf ./build ./check_reports lib/binding ./node_modules/ rm -f includes.log iwyu.log rm -rf lib/binding/ diff --git a/package.json b/package.json index 46e21cd..51150cc 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "package_name": "{node_abi}-{platform}-{arch}.tar.gz" }, "dependencies": { - "node-pre-gyp": "0.5.27" + "node-pre-gyp": "~0.6.4" }, "bundledDependencies":["node-pre-gyp"], "devDependencies": { From 626a13cfffeea71b7af46b4d5d013310091a6d56 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sat, 7 Mar 2015 15:43:35 -0800 Subject: [PATCH 2/5] auto-generate coverage repo --- .travis.yml | 60 +++++++++++++++++++++++++++++++++++++++-------------- Makefile | 2 +- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f9e65f..c2c4ffb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,23 +6,37 @@ language: cpp -os: - - linux - - osx - -compiler: - - clang +matrix: + include: + # Coverage + - os: osx + compiler: clang + env: NODE_VERSION="0.10.36" COVERAGE=true RUN_BUILD="shared_build" + # Linux + - os: linux + compiler: clang + env: NODE_VERSION="0.10.36" RUN_BUILD="static_build" + - os: linux + compiler: clang + env: NODE_VERSION="0.10.36" RUN_BUILD="shared_build" + # OS X + - os: osx + compiler: clang + env: NODE_VERSION="0.10.36" RUN_BUILD="shared_build" + - os: osx + compiler: clang + env: NODE_VERSION="0.10.36" RUN_BUILD="static_build" + # static_build == portable, statically linked node-osmium and deps + # shared_build == non-portable, shared libraries via package manager env: - matrix: - # static_build == portable, statically linked node-osmium and deps - # shared_build == non-portable, shared libraries via package manager - - NODE_NVM_VERSION="0.10" RUN_BUILD="static_build" - - NODE_NVM_VERSION="0.10" RUN_BUILD="shared_build" global: + - JOBS: "8" - secure: Ac0sNxaMmm/4NLJwjB5W74wNNrXH2cFz4qADJSJwGr+p78NVrp+3B70Nlffg6sf6sq57KeoQi5EbUNSa4fjLS2FqJJDr5U8cOA4nt5tPGm8cucdAyr4VCREEddtV4jfIcNN0/I/DKIK4d744SmpqomVYqTUFOVK8LOT4vAX3tTo= - secure: bsD0VyN6F6+ratG/C2AB1GrbmaPGyvaAgjZXd7tsQPYl+TR3BT643T9GikgN5IJdbjVBOJDfSqk76g/UlfLl9bRnoybP8tJsZJhCyMYKyRNGJZBIOyEVe6j5FrcT5ejBO0EIGaw2fXwSkG92pg7CFQOAPkVNgcl/H0XNdMa3Q/8= + before_install: +- export COVERAGE=${COVERAGE:-false} # check if tag exists and matches package.json - scripts/validate_tag.sh # get commit message @@ -34,10 +48,20 @@ before_install: # objective-c in another branch (to run the same travis.yml on OS X) - git clone https://github.com/creationix/nvm.git ../.nvm - source ../.nvm/nvm.sh -- nvm install $NODE_NVM_VERSION -- nvm use $NODE_NVM_VERSION +- nvm install $NODE_VERSION +- nvm use $NODE_VERSION - node --version - npm --version +- if [[ ${COVERAGE} == true ]]; then + brew update; + brew install pyenv; + eval "$(pyenv init -)"; + pyenv install 2.7.6; + pyenv global 2.7.6; + pyenv rehash; + pip install cpp-coveralls; + pyenv rehash; + fi; install: # set a few env settings for the static build script @@ -50,18 +74,24 @@ install: before_script: # install from source, ensure this works first - git clone https://github.com/osmcode/libosmium.git ../libosmium -- npm install --build-from-source --clang=1 +- if [[ ${COVERAGE} == true ]]; then + make coverage; + else + make; + fi; + - if [[ `uname -s` == 'Darwin' ]]; then otool -L ./lib/binding/* || true; fi - if [[ `uname -s` == 'Linux' ]]; then readelf -d ./lib/binding/* || true; fi - npm test - node-pre-gyp package - node-pre-gyp testpackage +- if [[ ${COVERAGE} == true ]]; then cpp-coveralls --exclude node_modules --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Release/obj/gen; fi; script: # now we publish the binary, if needed - PUBLISH_BINARY=false # or check if we are manually requesting binary publishing via a commit keyword -- if [[ $RUN_BUILD == "static_build" ]] && test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi; +- if [[ $RUN_BUILD == "static_build" ]] && [[ ${COVERAGE} == false ]] && test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi; # if either are true, then publish the binary # Note: this publishing is done here, in the 'script' section, instead of the 'after_success' # since we want any failure here to stop the build immediately diff --git a/Makefile b/Makefile index 46a9343..9a255a7 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ debug: ./node_modules ./build ./node_modules/.bin/node-pre-gyp build --debug --clang=1 coverage: ./node_modules ./build - ./node_modules/.bin/node-pre-gyp build --debug --clang=1 --coverage=true + export LDFLAGS="--coverage" && export CXXFLAGS="--coverage" && ./node_modules/.bin/node-pre-gyp build --debug --clang=1 verbose: ./node_modules ./node_modules/.bin/node-pre-gyp build --loglevel=verbose --clang=1 From e319e4cc7876e2ad0d5d3c8b439f33a041341d3f Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sat, 7 Mar 2015 16:07:27 -0800 Subject: [PATCH 3/5] increase timeout for mocha --- README.md | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ed450b..97d70ba 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ C++ library. [![Build Status](https://secure.travis-ci.org/osmcode/node-osmium.png)](http://travis-ci.org/osmcode/node-osmium) [![Build status](https://ci.appveyor.com/api/projects/status/g0j361782j0h0cge?svg=true)](https://ci.appveyor.com/project/Mapbox/node-osmium) +[![Coverage Status](https://coveralls.io/repos/osmcode/node-osmium/badge.svg?branch=coverage)](https://coveralls.io/r/osmcode/node-osmium?branch=coverage) ## Depends diff --git a/package.json b/package.json index 51150cc..09917bd 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,6 @@ }, "scripts": { "install": "node-pre-gyp install --fallback-to-build", - "test": "mocha -R spec --timeout 10000" + "test": "mocha -R spec --timeout 100000" } } From cfaf72535a28b01cd3d1245849274d52c2c2ccc3 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sat, 7 Mar 2015 16:25:25 -0800 Subject: [PATCH 4/5] exclude from coverage a few files without any code --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c2c4ffb..4a63b8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ before_script: - npm test - node-pre-gyp package - node-pre-gyp testpackage -- if [[ ${COVERAGE} == true ]]; then cpp-coveralls --exclude node_modules --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Release/obj/gen; fi; +- if [[ ${COVERAGE} == true ]]; then cpp-coveralls --exclude src/node_osmium.hpp --exclude src/apply.hpp --exclude src/include_v8.hpp --exclude node_modules --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Release/obj/gen; fi; script: # now we publish the binary, if needed From 02464b2d081883b7e5fb23332c20ee47ec111160 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sat, 7 Mar 2015 20:32:18 -0800 Subject: [PATCH 5/5] try to fix osx non-coverage build (for some reason it can't find node-gyp) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4a63b8a..cd59fa7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -77,7 +77,7 @@ before_script: - if [[ ${COVERAGE} == true ]]; then make coverage; else - make; + npm install --build-from-source --clang=1; fi; - if [[ `uname -s` == 'Darwin' ]]; then otool -L ./lib/binding/* || true; fi