From ac6f71fda7971ce5218efe8daae19148599c4e78 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 19 Mar 2015 17:08:53 -0700 Subject: [PATCH 1/3] code coverage --- .travis.yml | 57 +++++++++++++++++++++++++++++++----------- deps/travis_publish.sh | 2 +- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f4abb769..eb6aa7bc6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,36 @@ language: cpp -os: -- linux -- osx - -compiler: -- clang -- gcc +matrix: + include: + # Coverage + - os: osx + compiler: clang + env: NODE_VERSION="0.10" COVERAGE=true + # Linux + - os: linux + compiler: clang + env: NODE_VERSION="0.10" + - os: linux + compiler: clang + env: NODE_VERSION="0.12" + # OS X + - os: osx + compiler: clang + env: NODE_VERSION="0.10" + - os: osx + compiler: clang + env: NODE_VERSION="0.12" env: - matrix: - - NODE_VERSION="0.10.37" - - NODE_VERSION="0.12.0" global: - - BUILD: '/tmp/fontnik-build' - - PKG_CONFIG_PATH: '/tmp/fontnik-build/lib/pkgconfig' - - secure: "XV0lekmfgT+D9t0ZTIU+UJF6g+p3cBQMO6T6C9lkoKTC0YbtLtxSFtBahD/4PjL86DMJgTaf1nBmxqOxbrfkcpJUxnLe3r8u4Z2L/+7+QSACLNktlIfWNSO+33WxKNb4mVw6jMFZIo4ZurF016MXYzLzjpxRELW2oO2STUs2m44=" - - secure: "CQNHbxw8yHlAdUVbKokHzHmj7C+duXP3mifWOkZm9GKw4myWsRFhhoSYZmOSkgj9EWfYYkedrqEr9+GaMg9rkVJuO/7jzn6S+M7CFXKJju6MoZEDO6WcFva4M8pw6IFb9q22GcQ+OsE8/i0DwchTokyFkNb3fpwWuwROUPQ/nWg=" + - JOBS: "8" + - BUILD: '/tmp/fontnik-build' + - PKG_CONFIG_PATH: '/tmp/fontnik-build/lib/pkgconfig' + - secure: "XV0lekmfgT+D9t0ZTIU+UJF6g+p3cBQMO6T6C9lkoKTC0YbtLtxSFtBahD/4PjL86DMJgTaf1nBmxqOxbrfkcpJUxnLe3r8u4Z2L/+7+QSACLNktlIfWNSO+33WxKNb4mVw6jMFZIo4ZurF016MXYzLzjpxRELW2oO2STUs2m44=" + - secure: "CQNHbxw8yHlAdUVbKokHzHmj7C+duXP3mifWOkZm9GKw4myWsRFhhoSYZmOSkgj9EWfYYkedrqEr9+GaMg9rkVJuO/7jzn6S+M7CFXKJju6MoZEDO6WcFva4M8pw6IFb9q22GcQ+OsE8/i0DwchTokyFkNb3fpwWuwROUPQ/nWg=" before_install: + - export COVERAGE=${COVERAGE:-false} - export platform=$(uname -s | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/") # here we set up the node version on the fly based on the matrix value. # This is done manually so that it is easy to flip the 'language' to @@ -29,15 +41,30 @@ before_install: - 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; - export PATH="$BUILD/bin:$PATH" - if [[ "$platform" == "linux" ]]; then export CXX=g++-4.8; export CC=gcc-4.8; fi - ./deps/travis_build.sh install: - - npm install --build-from-source + - if [[ ${COVERAGE} == true ]]; then + export LDFLAGS="--coverage" && export CXXFLAGS="--coverage" && npm install --build-from-source --debug --clang=1; + else + npm install --build-from-source --clang=1; + fi; script: - npm test + - if [[ ${COVERAGE} == true ]]; then cpp-coveralls --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Release/obj/gen; fi; after_success: - ./deps/travis_publish.sh diff --git a/deps/travis_publish.sh b/deps/travis_publish.sh index 68c179708..cfba9da63 100755 --- a/deps/travis_publish.sh +++ b/deps/travis_publish.sh @@ -11,7 +11,7 @@ fi COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n') -if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE" +if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE" && [[ ${COVERAGE} == false ]]; then npm install aws-sdk From c173e1df2f22ea9967f88877ae52adca820559f4 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 19 Mar 2015 17:47:03 -0700 Subject: [PATCH 2/3] coverage: ignore node_modules and tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eb6aa7bc6..d8087e531 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,7 @@ install: script: - npm test - - if [[ ${COVERAGE} == true ]]; then cpp-coveralls --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Release/obj/gen; fi; + - 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; after_success: - ./deps/travis_publish.sh From 76d1e0e6c28d9a90cec2f44b69f25a32bae3aac7 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 19 Mar 2015 17:48:36 -0700 Subject: [PATCH 3/3] add coveralls badge [skip ci] --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c63983b60..6ab080c80 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # node-fontnik -[![NPM](https://nodei.co/npm/fontnik.png?compact=true)](https://nodei.co/npm/fontnik/) [![Build Status](https://travis-ci.org/mapbox/node-fontnik.svg?branch=master)](https://travis-ci.org/mapbox/node-fontnik) +[![NPM](https://nodei.co/npm/fontnik.png?compact=true)](https://nodei.co/npm/fontnik/) +[![Build Status](https://travis-ci.org/mapbox/node-fontnik.svg?branch=master)](https://travis-ci.org/mapbox/node-fontnik) +[![Coverage Status](https://coveralls.io/repos/mapbox/node-fontnik/badge.svg?branch=coverage)](https://coveralls.io/r/mapbox/node-fontnik?branch=coverage) A library that delivers a range of glyphs rendered as SDFs (signed distance fields) in a protocol buffer. We use these encoded glyphs as the basic blocks of font rendering in [Mapbox GL](https://github.com/mapbox/mapbox-gl-js). SDF encoding is superior to traditional fonts for our usecase terms of scaling, rotation, and quickly deriving halos - WebGL doesn't have built-in font rendering, so the decision is between vectorization, which tends to be slow, and SDF generation.