get tests passing on travis

add iam template with mapbox-gl-testing and mapbox-node-binary permissions
add travis build scripts and .travis.yml
rm -f platform gypi
map.resize is private now, called by view.resize
set stdlib and c++11 per platform, link glfw3 ldflags on linux
pass --clang to node-gyp per https://github.com/mapbox/mapbox-gl-native/pull/364#issuecomment-51735692
This commit is contained in:
Mike Morris
2015-02-05 17:19:26 -05:00
parent f8a7a4425d
commit df396d7d89
11 changed files with 228 additions and 12 deletions

2
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "vendor/mbgl"]
path = vendor/mbgl
url = https://github.com/mapbox/mapbox-gl-native.git
url = git@github.com:mapbox/mapbox-gl-native.git

42
.travis.yml Normal file
View File

@@ -0,0 +1,42 @@
language: cpp
matrix:
include:
- os: linux
compiler: clang
- os: linux
compiler: gcc
env: JOBS=8
- os: osx
compiler: clang
env:
global:
- NODE_NVM_VERSION: "0.10"
- LD_LIBRARY_PATH: "/usr/local/lib"
- secure: jkwZnKr5dcM9MQ6mOytnp6FHkbydSfa1L8d4jFp4v4K6Ee/iQh1YIq9c/J1zC0WLyuGokVGaijkKr6CW4nGZ5H8ygBtPo09imnRyH8X0bO5mEjl+KhbpdFqkXVLerpnAGMO7D6+6BtWJlK5uTDWhpeS7YayB3YfETVkllf4n6F8=
- secure: ZBiq+KPVM72MF0rtvpui5l7curGXckz4Pefc1L04U6dd/MPa22StvCgXBG7DKhLwI5OgHE1da769asQ3rub/pDOonxAi7fHo3+r/ocbSBZeeaj+p5i5wavppOzD27gCLrpOnSQBk0DfoD+xOM8ZCfIttBbOBMRZ1dpWFG98bJ4c=
before_install:
- ./scripts/install_nvm.sh
- cd ./vendor/mbgl && source ./scripts/local_mason.sh && cd ../../
- source ./vendor/mbgl/scripts/travis_helper.sh
- source ./vendor/mbgl/scripts/flags.sh
- source ./vendor/mbgl/scripts/travis_before_install.sh
- if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then export LD_LIBRARY_PATH=`mason prefix mesa 10.4.3`/lib:$LD_LIBRARY_PATH; glxinfo; fi
install:
- npm install
before_script:
# Set the core file limit to unlimited so a core file is generated upon crash
- ulimit -c unlimited -S
script:
- ./scripts/travis_test.sh
after_success:
- ./scripts/travis_publish.sh
git:
submodules: true

View File

@@ -8,12 +8,16 @@ endif
ifeq ($(shell uname -s), Darwin)
HOST ?= osx
ifeq ($(JOBS),)
JOBS = $(shell sysctl -n hw.ncpu)
endif
endif
ifeq ($(shell uname -s), Linux)
HOST ?= linux
ifeq ($(JOBS),)
JOBS = $(shell nproc)
endif
endif
# Explicitly disable the default FileSource implementation
ASSET = none
@@ -26,7 +30,7 @@ global: build
.PHONY: build
build: build/Makefile
@node-gyp build $(DEBUG_FLAG) -- -j$(JOBS)
@node-gyp build $(DEBUG_FLAG) --clang -- -j$(JOBS)
.PHONY: vendor/mbgl
vendor/mbgl:
@@ -34,7 +38,7 @@ vendor/mbgl:
.PHONY: build/Makefile
build/Makefile: $(MBGL)/config/$(HOST).gypi
@node-gyp configure -- \
@node-gyp configure --clang -- \
-Dmbgl=$(MBGL) \
-Dhost=$(HOST) \
-I$(MBGL)/config/$(HOST).gypi \
@@ -52,4 +56,4 @@ test: build
.PHONY: clean
clean:
rm -rf build
rm $(MBGL)/config.gypi
rm -f $(MBGL)/config/$(HOST).gypi

View File

@@ -23,24 +23,27 @@
'variables': {
'cflags_cc': [
'-std=c++11',
'-stdlib=libc++',
'-Wno-unused-parameter'
'-Wno-unused-parameter',
],
},
'conditions': [
['OS == "mac"', {
'xcode_settings': {
"CLANG_CXX_LIBRARY": "libc++",
"CLANG_CXX_LANGUAGE_STANDARD":"c++11",
"GCC_VERSION": "com.apple.compilers.llvm.clang.1_0",
'MACOSX_DEPLOYMENT_TARGET': '10.7',
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
}
}, {
'cflags_cc': [
'<@(cflags_cc)',
'-std=c++11',
'-fexceptions',
'<@(cflags_cc)',
],
'libraries': [ '<@(glfw3_ldflags)' ],
}]
],
},
@@ -56,4 +59,4 @@
]
}
]
}
}

8
scripts/deploy_results.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then
(cd ./node_modules/mapbox-gl-test-suite/ && ./bin/deploy_results.sh)
fi

11
scripts/install_nvm.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -e
set -o pipefail
git clone git@github.com:creationix/nvm.git ../.nvm
source ../.nvm/nvm.sh
nvm install $NODE_NVM_VERSION
nvm use $NODE_NVM_VERSION
node --version
npm --version

31
scripts/travis_publish.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
set -e
# Inspect binary.
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
ldd ./lib/mbgl.node
else
otool -L ./lib/mbgl.node
fi
COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE" && [[ $CXX == "clang++" ]]; then
npm install aws-sdk
./node_modules/.bin/node-pre-gyp package
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
./node_modules/.bin/node-pre-gyp testpackage
fi
./node_modules/.bin/node-pre-gyp publish info
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
rm -rf build
rm -rf lib
npm install --fallback-to-build=false
npm test
fi
fi

10
scripts/travis_test.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
set -o pipefail
# Travis OS X has no GPU
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
npm test
# ./scripts/deploy_results.sh
fi

View File

@@ -19,7 +19,6 @@ void NodeMap::RenderWorker::Execute() {
try {
nodeMap->view.resize(options->width, options->height, options->ratio);
nodeMap->map.setAccessToken(options->accessToken);
nodeMap->map.resize(options->width, options->height, options->ratio);
nodeMap->map.setClasses(options->classes);
nodeMap->map.setLonLatZoom(options->longitude, options->latitude, options->zoom);
nodeMap->map.setBearing(options->bearing);

View File

@@ -0,0 +1,108 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "node-mapbox-gl-native travis resources",
"Resources": {
"BuildUser": {
"Type": "AWS::IAM::User",
"Properties": {
"Policies": [
{
"PolicyName": "build",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::mapbox-node-binary/mapbox-gl-native/*"
],
"Effect": "Allow"
}
]
}
},
{
"PolicyName": "build-testing",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::mapbox-gl-testing/*"
]
}
]
}
},
"PolicyName": "list",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::mapbox-node-binary"
],
"Effect": "Allow"
}
]
}
{
"PolicyName": "list-testing",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::mapbox-gl-testing"
]
}
]
}
}
]
}
},
"BuildUserKey": {
"Type": "AWS::IAM::AccessKey",
"Properties": {
"UserName": {
"Ref": "BuildUser"
}
}
}
},
"Outputs": {
"AccessKeyId": {
"Value": {
"Ref": "BuildUserKey"
}
},
"SecretAccessKey": {
"Value": {
"Fn::GetAtt": [
"BuildUserKey",
"SecretAccessKey"
]
}
}
}
}

2
vendor/mbgl vendored