[build] Switch from Travis CI to CircleCI

This commit is contained in:
Bruno de Oliveira Abinader
2017-05-24 11:10:36 +03:00
committed by Konstantin Käfer
parent 3a0c5b046c
commit 461387343d
7 changed files with 415 additions and 395 deletions

View File

@@ -1,243 +1,7 @@
group: deprecated-2017Q2
language: cpp
git:
submodules: false
# Save common build configurations as shortcuts, so we can reference them later.
addons:
apt:
sources:
- &common_sources [ 'ubuntu-toolchain-r-test', 'george-edison55-precise-backports', 'llvm-toolchain-trusty-3.9' ]
packages:
- &common_packages [ 'libllvm3.8v4', 'cmake', 'cmake-data' ]
- &clang39_packages [ 'clang-3.9', 'libstdc++-5-dev', 'libstdc++6' ]
- &gcc5_packages [ 'gcc-5', 'g++-5' ]
- &glfw_packages [ 'libxrandr-dev', 'libxcursor-dev', 'libxinerama-dev' ]
addons_shortcuts:
addons_clang39: &clang39
apt:
sources: *common_sources
packages:
- *common_packages
- *clang39_packages
- *glfw_packages
addons_gcc5: &gcc5
apt:
sources: *common_sources
packages:
- *common_packages
- *gcc5_packages
- *glfw_packages
addons_qt4: &qt4
apt:
sources: *common_sources
packages:
- *common_packages
- *gcc5_packages
- [ 'libjemalloc-dev', 'mesa-utils', 'qt4-default', 'libqt4-sql-mysql' ]
addons_qt5: &qt5
apt:
sources: *common_sources
packages:
- *common_packages
- *gcc5_packages
- [ 'mesa-utils', 'libc6-dbg', 'qt5-default', 'libqt5opengl5-dev', 'qtdeclarative5-dev', 'qtpositioning5-dev', 'qtlocation5-dev', 'libqt5sql5-sqlite' ]
env:
global:
- TERM: dumb
- CCACHE: 1
- CCACHE_MAXSIZE: 384M
# AWS
- secure: "OjsCDBFxtGGdNIOCEVtb7GMt/JSFfsKQD/LDV45ctt0UF2QWtwGt+2kXtDlAAu2SdmmuQuxmkc06emZabVmAGDjZ0DNnbhfCNIWeN4nx73dw7uyDBKmP/rsCLQGAF+R5NVywxLmdgJL3LM8SddIwotODjaEboyLV4n6GGloLFsw="
- secure: "hCFkljxpbQEai3WR/s+zcu+jOPrZZwXCSY2voU4W0GygbTxh2ZUq803PgO98EAkiShITfyHIP7lSKdT20uh/cNQwW7g0KMf/hYZk7wLy7YZrcr3wZRY8MlTV3Rn+MxvDrW85J371twz64KEgvvO1TlfWqDr1C1YDNbCBIJnhYEE="
# Access Token
- secure: "RiBIBfVhhaMjU5ksuwJO3shdvG9FpinBjdSv4co9jg9171SR8edNriedHjVKSIeBhSGNmZmX+twS3dJS/By6tl/LKh9sTynA+ZAYYljkE7jn881B/gMrlYvdAA6og5KvkhV1/0iJWlhuZrMTkhpDR200iLgg3EWBhWjltzmDW/I="
install:
- source ./scripts/travis_helper.sh
- source ./scripts/travis_setup.sh
- ccache --zero-stats
script:
- make linux
- make benchmark
- make test
- make run-test
after_script:
- ccache --show-stats
- ./platform/linux/scripts/after_script.sh ${TRAVIS_JOB_NUMBER}
after_success:
- ./platform/linux/scripts/after_success.sh
matrix:
include:
# Clang 3.9.0 / clang-{format,tidy} 4.0.0
- os: linux
sudo: required
dist: trusty
language: cpp
compiler: "check"
env: _CXX=clang++-3.9 _CC=clang-3.9
addons: *clang39
script:
- git fetch origin master:refs/remotes/origin/master
- make check
branches:
except:
- master
# EGL - Node v4 - Clang 3.9 - Release
- os: linux
sudo: required
dist: trusty
language: node
compiler: "egl-node4-clang39-release"
env: BUILDTYPE=Release _CXX=clang++-3.9 _CC=clang-3.9 WITH_EGL=1
addons: *clang39
before_script:
# fglrx causes the GLX extension to be unavailable
- sudo apt-get purge -qq fglrx
- export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
- export PUBLISH=$([[ "${TRAVIS_TAG:-}" == "node-v${PACKAGE_JSON_VERSION}" ]] && echo true)
- mapbox_install_gdb_logbt
- mapbox_start_xvfb
- mapbox_export_mesa_library_path
script:
- nvm install 4
- nvm use 4
- make node
- ./logbt -- $(scripts/mason.sh PREFIX apitrace VERSION 6a30de1)/bin/apitrace trace --api=egl -v make test-node
after_script:
- ccache --show-stats
- ./platform/node/scripts/after_script.sh ${TRAVIS_JOB_NUMBER}
after_success:
- ./platform/node/scripts/after_success.sh
after_failure:
- aws s3 cp . s3://mapbox/mapbox-gl-native/render-tests/$TRAVIS_JOB_NUMBER --recursive --exclude "*" --include "*.trace"
# EGL - Node v6 - Clang 3.9 - Debug
- os: linux
sudo: required
dist: trusty
language: node
compiler: "egl-node6-clang39-debug"
env: BUILDTYPE=Debug _CXX=clang++-3.9 _CC=clang-3.9 WITH_EGL=1
addons: *clang39
before_script:
- export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
- export PUBLISH=$([[ "${TRAVIS_TAG:-}" == "node-v${PACKAGE_JSON_VERSION}" ]] && echo true)
- mapbox_install_gdb_logbt
- mapbox_start_xvfb
- mapbox_export_mesa_library_path
script:
- nvm install 6
- nvm use 6
- make node
- ./logbt -- $(scripts/mason.sh PREFIX apitrace VERSION 6a30de1)/bin/apitrace trace --api=egl -v make test-node
after_script:
- ccache --show-stats
- ./platform/node/scripts/after_script.sh ${TRAVIS_JOB_NUMBER}
after_success:
- ./platform/node/scripts/after_success.sh
after_failure:
- aws s3 cp . s3://mapbox/mapbox-gl-native/render-tests/$TRAVIS_JOB_NUMBER --recursive --exclude "*" --include "*.trace"
# EGL - Node v6 - Clang 3.9 - Release
- os: linux
sudo: required
dist: trusty
language: node
compiler: "egl-node6-clang39-release"
env: BUILDTYPE=Release _CXX=clang++-3.9 _CC=clang-3.9 WITH_EGL=1
addons: *clang39
before_script:
# fglrx causes the GLX extension to be unavailable
- sudo apt-get purge -qq fglrx
- export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
- export PUBLISH=$([[ "${TRAVIS_TAG:-}" == "node-v${PACKAGE_JSON_VERSION}" ]] && echo true)
- mapbox_install_gdb_logbt
- mapbox_start_xvfb
- mapbox_export_mesa_library_path
script:
- nvm install 6
- nvm use 6
- make node
- ./logbt -- $(scripts/mason.sh PREFIX apitrace VERSION 6a30de1)/bin/apitrace trace --api=egl -v make test-node
after_script:
- ccache --show-stats
- ./platform/node/scripts/after_script.sh ${TRAVIS_JOB_NUMBER}
after_success:
- ./platform/node/scripts/after_success.sh
after_failure:
- aws s3 cp . s3://mapbox/mapbox-gl-native/render-tests/$TRAVIS_JOB_NUMBER --recursive --exclude "*" --include "*.trace"
# EGL - GCC 5 - Debug (Coverage)
- os: linux
sudo: required
dist: trusty
language: cpp
compiler: "egl-gcc5-debug"
env: BUILDTYPE=Debug _CXX=g++-5 _CC=gcc-5 WITH_COVERAGE=1 WITH_EGL=1
addons: *gcc5
before_script:
- mapbox_start_xvfb
- mapbox_export_mesa_library_path
after_script:
- ccache --show-stats
- ./platform/linux/scripts/coveralls.sh
# EGL - Clang 3.9 - Debug
- os: linux
sudo: required
dist: trusty
language: cpp
compiler: "egl-clang39-debug"
env: BUILDTYPE=Debug _CXX=clang++-3.9 _CC=clang-3.9 WITH_EGL=1
addons: *clang39
before_script:
- mapbox_start_xvfb
- mapbox_export_mesa_library_path
# Qt 4 - GCC 5 - Release
- os: linux
sudo: required
dist: trusty
language: cpp
compiler: "qt4-gcc5-release"
env: BUILDTYPE=Release _CXX=g++-5 _CC=gcc-5
addons: *qt4
before_script:
- mapbox_start_xvfb
- mapbox_export_mesa_library_path
script:
- make qt-app
- GTEST_OUTPUT=xml LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so make run-qt-test-Memory.*:*.Load
- scripts/log_memory_benchmarks.sh test_detail.xml "Platform=Linux,Compiler=${_CC},Arch=$(uname -m)"
# Qt 5 - GCC 5 - Release
- os: linux
sudo: required
dist: trusty
language: cpp
compiler: "qt5-gcc5-release"
env: BUILDTYPE=Release _CXX=g++-5 _CC=gcc-5 WITH_QT_I18N=1
addons: *qt5
before_script:
- mapbox_start_xvfb
- mapbox_export_mesa_library_path
script:
- make qt-app
- make qt-test
- make qt-docs
- scripts/valgrind.sh build/qt-linux-x86_64/Release/mbgl-test --gtest_filter=-*.Load --gtest_filter=-Memory.Vector
cache:
directories:
- $HOME/.ccache
- $HOME/.cache/pip
- node_modules
- mason_packages/.binaries
- true
notifications:
slack:

View File

@@ -4,15 +4,57 @@ workflows:
version: 2
default:
jobs:
- clang-tidy
- android-debug-arm-v7
- android-release-all
- node4-clang39-release
- node6-clang39-release
- node6-clang39-debug
- linux-clang39-debug
- linux-gcc5-debug-coverage
- linux-gcc5-release-qt4
- linux-gcc5-release-qt5
jobs:
# ------------------------------------------------------------------------------
clang-tidy:
docker:
- image: mbgl/ci:r3-linux-clang-3.9
working_directory: /src
environment:
LIBSYSCONFCPUS: 6
JOBS: 6
BUILDTYPE: Debug
branches:
ignore:
- master
steps:
- checkout
- restore_cache:
key: v1-clang-tidy
paths:
- node_modules
- /root/.ccache
- run:
name: Fetch 'origin/master' branch
command: git fetch origin master:refs/remotes/origin/master
- run:
name: Generate compilation database
command: make compdb
- run:
name: Run Clang checks
command: make check
- save_cache:
key: v1-clang-tidy
paths:
- node_modules
- /root/.ccache
# ------------------------------------------------------------------------------
android-debug-arm-v7:
docker:
- image: mbgl/ci:r2-android-ndk-r15beta2-gradle
- image: mbgl/ci:r3-android-ndk-r15-gradle
working_directory: /src
environment:
LIBSYSCONFCPUS: 6
@@ -20,6 +62,11 @@ jobs:
BUILDTYPE: Debug
steps:
- checkout
- restore_cache:
key: v1-android-debug-arm-v7
paths:
- node_modules
- /root/.ccache
- run:
name: Build libmapbox-gl.so for arm-v7
command: make android-lib-arm-v7
@@ -70,6 +117,11 @@ jobs:
xargs -0 -I '{}' ${ANDROID_NDK_HOME}/ndk-stack -sym build/android-arm-v7/Debug -dump {}
exit ${EXIT_CODE:-0}
- save_cache:
key: v1-android-debug-arm-v7
paths:
- node_modules
- /root/.ccache
- store_artifacts:
path: platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk
destination: .
@@ -77,7 +129,7 @@ jobs:
# ------------------------------------------------------------------------------
android-release-all:
docker:
- image: mbgl/ci:r2-android-ndk-r15beta2-gradle
- image: mbgl/ci:r3-android-ndk-r15-gradle
working_directory: /src
environment:
LIBSYSCONFCPUS: 6
@@ -85,6 +137,11 @@ jobs:
BUILDTYPE: Release
steps:
- checkout
- restore_cache:
key: v1-android-release-all
paths:
- node_modules
- /root/.ccache
- run:
name: Generate Maven credentials
shell: /bin/bash -euo pipefail
@@ -128,3 +185,310 @@ jobs:
name: Publish to Maven
command: |
if [ "${CIRCLE_BRANCH}" == "release-ios-v3.6.0-android-v5.1.0" ]; then make run-android-upload-archives ; fi
- save_cache:
key: v1-android-release-all
paths:
- node_modules
- /root/.ccache
# ------------------------------------------------------------------------------
node4-clang39-release:
docker:
- image: mbgl/ci:r3-linux-clang-3.9-node-4
working_directory: /src
environment:
LIBSYSCONFCPUS: 6
JOBS: 6
BUILDTYPE: Release
WITH_EGL: 1
PACKAGE_JSON_VERSION: $(node -e "console.log(require('./package.json').version)")
PUBLISH: $([[ "${CIRCLE_BRANCH}" == "node-v${PACKAGE_JSON_VERSION}" ]] && echo true)
DISPLAY: :0
steps:
- checkout
- restore_cache:
key: v1-node4-clang39-release
paths:
- node_modules
- /root/.ccache
- run:
name: Build node
command: make node
- run:
name: Run node tests
command: |
source scripts/circle_setup.sh
mapbox_install_logbt
mapbox_install_apitrace
mapbox_export_mesa_library_path
xvfb-run --server-args="-screen 0 1024x768x24" \
./logbt -- apitrace trace --api=egl -v make test-node
- run:
name: Publish node package
when: on_success
command: platform/node/scripts/after_success.sh
- save_cache:
key: v1-node4-clang39-release
paths:
- node_modules
- /root/.ccache
- store_artifacts:
path: mapbox-gl-js/test/integration/render-tests/index.html
destination: render-tests
# ------------------------------------------------------------------------------
node6-clang39-release:
docker:
- image: mbgl/ci:r3-linux-clang-3.9
working_directory: /src
environment:
LIBSYSCONFCPUS: 6
JOBS: 6
BUILDTYPE: Release
WITH_EGL: 1
PACKAGE_JSON_VERSION: $(node -e "console.log(require('./package.json').version)")
PUBLISH: $([[ "${CIRCLE_BRANCH}" == "node-v${PACKAGE_JSON_VERSION}" ]] && echo true)
DISPLAY: :0
steps:
- checkout
- restore_cache:
key: v1-node6-clang39-release
paths:
- node_modules
- /root/.ccache
- run:
name: Build node
command: make node
- run:
name: Run node tests
command: |
source scripts/circle_setup.sh
mapbox_install_logbt
mapbox_install_apitrace
mapbox_export_mesa_library_path
xvfb-run --server-args="-screen 0 1024x768x24" \
./logbt -- apitrace trace --api=egl -v make test-node
- run:
name: Publish node package
when: on_success
command: platform/node/scripts/after_success.sh
- save_cache:
key: v1-node6-clang39-release
paths:
- node_modules
- /root/.ccache
- store_artifacts:
path: mapbox-gl-js/test/integration/render-tests/index.html
destination: render-tests
# ------------------------------------------------------------------------------
node6-clang39-debug:
docker:
- image: mbgl/ci:r3-linux-clang-3.9
working_directory: /src
environment:
LIBSYSCONFCPUS: 6
JOBS: 6
BUILDTYPE: Debug
WITH_EGL: 1
PACKAGE_JSON_VERSION: $(node -e "console.log(require('./package.json').version)")
PUBLISH: $([[ "${CIRCLE_BRANCH}" == "node-v${PACKAGE_JSON_VERSION}" ]] && echo true)
DISPLAY: :0
steps:
- checkout
- restore_cache:
key: v1-node6-clang39-debug
paths:
- node_modules
- /root/.ccache
- run:
name: Build node
command: make node
- run:
name: Run node tests
command: |
source scripts/circle_setup.sh
mapbox_install_logbt
mapbox_install_apitrace
mapbox_export_mesa_library_path
xvfb-run --server-args="-screen 0 1024x768x24" \
./logbt -- apitrace trace --api=egl -v make test-node
- run:
name: Publish node package
when: on_success
command: platform/node/scripts/after_success.sh
- save_cache:
key: v1-node6-clang39-debug
paths:
- node_modules
- /root/.ccache
- store_artifacts:
path: mapbox-gl-js/test/integration/render-tests/index.html
destination: render-tests
# ------------------------------------------------------------------------------
linux-clang39-debug:
docker:
- image: mbgl/ci:r3-linux-clang-3.9
working_directory: /src
environment:
LIBSYSCONFCPUS: 6
JOBS: 6
BUILDTYPE: Debug
WITH_EGL: 1
DISPLAY: :0
steps:
- checkout
- restore_cache:
key: v1-linux-clang39-debug
paths:
- node_modules
- /root/.ccache
- run:
name: Build linux
command: make linux
- run:
name: Build benchmark
command: make benchmark
- run:
name: Build test
command: make test
- run:
name: Run tests
command: |
source scripts/circle_setup.sh
mapbox_export_mesa_library_path
xvfb-run --server-args="-screen 0 1024x768x24" \
make run-test
- save_cache:
key: v1-linux-clang39-debug
paths:
- node_modules
- /root/.ccache
# ------------------------------------------------------------------------------
linux-gcc5-debug-coverage:
docker:
- image: mbgl/ci:r3-linux-gcc-5
working_directory: /src
environment:
LIBSYSCONFCPUS: 6
JOBS: 2
BUILDTYPE: Debug
WITH_EGL: 1
WITH_COVERAGE: 1
DISPLAY: :0
steps:
- checkout
- restore_cache:
key: v1-linux-gcc5-debug-coverage
paths:
- node_modules
- /root/.ccache
- run:
name: Build linux
command: make linux
- run:
name: Build benchmark
command: make benchmark
- run:
name: Build test
command: make test
- run:
name: Run tests
command: |
source scripts/circle_setup.sh
mapbox_export_mesa_library_path
xvfb-run --server-args="-screen 0 1024x768x24" \
make run-test
- run:
name: Upload coverage results to coveralls
command: |
source scripts/circle_setup.sh
platform/linux/scripts/coveralls.sh
- save_cache:
key: v1-linux-gcc5-debug-coverage
paths:
- node_modules
- /root/.ccache
# ------------------------------------------------------------------------------
linux-gcc5-release-qt4:
docker:
- image: mbgl/ci:r3-linux-gcc-5-qt-4
working_directory: /src
environment:
LIBSYSCONFCPUS: 6
JOBS: 2 # OOM, causing the compiler to crash.
BUILDTYPE: Release
GTEST_OUTPUT: xml
LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libjemalloc.so
DISPLAY: 0
steps:
- checkout
- restore_cache:
key: v1-linux-gcc5-release-qt4
paths:
- node_modules
- /root/.ccache
- run:
name: Build qt-app
command: make qt-app
- run:
name: Build qt-test
command: make qt-test
- run:
name: Run memory-load tests
command: |
source scripts/circle_setup.sh
mapbox_export_mesa_library_path
xvfb-run --server-args="-screen 0 1024x768x24" \
make run-qt-test-Memory.*:*.Load
scripts/log_memory_benchmarks.sh test_detail.xml "Platform=Linux,Compiler=${_CC},Arch=$(uname -m)"
- save_cache:
key: v1-linux-gcc5-release-qt4
paths:
- node_modules
- /root/.ccache
# ------------------------------------------------------------------------------
linux-gcc5-release-qt5:
docker:
- image: mbgl/ci:r3-linux-gcc-5-qt-5
working_directory: /src
environment:
LIBSYSCONFCPUS: 6
JOBS: 2 # OOM, causing the compiler to crash.
BUILDTYPE: Release
WITH_QT_I18N: 1
DISPLAY: 0
steps:
- checkout
- restore_cache:
key: v1-linux-gcc5-release-qt5
paths:
- node_modules
- /root/.ccache
- run:
name: Build qt-app
command: make qt-app
- run:
name: Build qt-test
command: make qt-test
- run:
name: Build qt-docs
command: make qt-docs
- run:
name: Run valgrind-backed tests
environment:
JOBS: 1 # https://github.com/mapbox/mapbox-gl-native/issues/9108
command: |
source scripts/circle_setup.sh
mapbox_export_mesa_library_path
xvfb-run --server-args="-screen 0 1024x768x24" \
scripts/valgrind.sh build/qt-linux-x86_64/Release/mbgl-test --gtest_filter=-*.Load --gtest_filter=-Memory.Vector
- save_cache:
key: v1-linux-gcc5-release-qt5
paths:
- node_modules
- /root/.ccache

View File

@@ -3,9 +3,13 @@
set -e
set -o pipefail
command -v lcov 2> /dev/null || {
echo "Aborting: lcov not found."
exit 1
}
# Collect coverage data and save it into coverage.info
mapbox_time "lcov_capture" \
`scripts/mason.sh PREFIX lcov VERSION 1.12`/usr/bin/lcov \
lcov \
--quiet \
--capture \
--no-external \
@@ -17,5 +21,8 @@ mapbox_time "lcov_capture" \
--base-directory "build/linux-x86_64/${BUILDTYPE}" \
--output-file "build/linux-x86_64/${BUILDTYPE}/coverage.info"
mapbox_time "coveralls_upload" \
coveralls-lcov "build/linux-x86_64/${BUILDTYPE}/coverage.info"
coveralls-lcov \
--service-name="${COVERALLS_SERVICE_NAME}" \
--repo-token="${COVERALLS_REPO_TOKEN}" \
--service-job-id="${CIRCLE_BUILD_NUM}" \
"build/linux-x86_64/${BUILDTYPE}/coverage.info"

View File

@@ -3,7 +3,7 @@
set -e
set -o pipefail
if [[ -n ${PUBLISH:-} ]]; then
if [[ "${PUBLISH:-}" == "true" ]]; then
if [[ "${BUILDTYPE}" == "Release" ]]; then
./node_modules/.bin/node-pre-gyp package publish info
else

35
scripts/circle_setup.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# This script is sourced; do not set -e or -o pipefail here.
# Touch package.json so that we are definitely going to run an npm update action
touch package.json
function mapbox_install_logbt {
export PATH=$(scripts/mason.sh PREFIX gdb VERSION 7.12)/bin:${PATH}
curl -sSfL https://github.com/mapbox/logbt/archive/v2.0.1.tar.gz | tar --gunzip --extract --strip-components=2 --exclude="*md" --exclude="test*" --directory=.
./logbt --test
}
export -f mapbox_install_logbt
function mapbox_install_apitrace {
export PATH=$(scripts/mason.sh PREFIX apitrace VERSION 6a30de1)/bin:${PATH}
}
export -f mapbox_install_apitrace
function mapbox_export_mesa_library_path {
# Install and set up to load a more recent version of mesa
MESA_PREFIX=$(scripts/mason.sh PREFIX mesa VERSION 13.0.4)
export LD_LIBRARY_PATH="${MESA_PREFIX}/lib:${LD_LIBRARY_PATH:-}"
export LIBGL_DRIVERS_PATH="${MESA_PREFIX}/lib/dri"
}
export -f mapbox_export_mesa_library_path
# Install and set up to load awscli
pip install --user awscli
export PATH="`python -m site --user-base`/bin:${PATH}"
# Install coveralls gem
gem install coveralls-lcov --no-rdoc --no-ri

View File

@@ -1,73 +0,0 @@
#!/usr/bin/env bash
# This script is sourced, so do not set -e or -o pipefail here. Doing so would
# bleed into Travis' wrapper script, which messes with their workflow, e.g.
# preventing after_failure scripts to be triggered.
case `uname -s` in
'Darwin') JOBS=$((`sysctl -n hw.ncpu` + 2)) ;;
'Linux') JOBS=$((`nproc` + 2)) ;;
*) JOBS=2 ;;
esac
ANSI_CLEAR="\e[0m"
function mapbox_time_start {
local name=$1
mapbox_timer_name=$name
mapbox_fold start $name
mapbox_timer_id=$(printf %08x $(( RANDOM * RANDOM )))
eval "mapbox_start_time_$mapbox_timer_id=$(mapbox_nanoseconds)"
echo -en "travis_time:start:$mapbox_timer_id\n"
}
function mapbox_time_finish {
local name=${1:-$mapbox_timer_name}
local timer_id=${2:-$mapbox_timer_id}
local timer_start="mapbox_start_time_$timer_id"
eval local start_time=\${$timer_start}
local end_time=$(mapbox_nanoseconds)
local duration=$(($end_time-$start_time))
echo -en "travis_time:end:$timer_id:start=$start_time,finish=$end_time,duration=$duration\n"
mapbox_fold end $name
}
function mapbox_time {
local name=$1 ; shift
mapbox_time_start $name
local timer_id=$mapbox_timer_id
echo "\$ $@"
$@
mapbox_time_finish $name $timer_id
}
function mapbox_fold {
local action=$1
local name=$2
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
}
function mapbox_nanoseconds {
local cmd="date"
local format="+%s%N"
local os=$(uname)
if hash gdate > /dev/null 2>&1; then
cmd="gdate" # use gdate if available
elif [[ "$os" = Darwin ]]; then
format="+%s000000000" # fallback to second precision on darwin (does not support %N)
fi
$cmd -u $format
}
export JOBS
export ANSI_CLEAR
export -f mapbox_fold
export -f mapbox_nanoseconds
export -f mapbox_time
export -f mapbox_time_start
export -f mapbox_time_finish

View File

@@ -1,77 +0,0 @@
#!/usr/bin/env bash
# This script is sourced; do not set -e or -o pipefail here.
if [ ! -z "${_CXX}" ]; then export CXX="${_CXX}" ; fi
if [ ! -z "${_CC}" ]; then export CC="${_CC}" ; fi
if [ "${CCACHE:-0}" -ge 1 ]; then
export CXX="ccache ${CXX}"
export CC="ccache ${CC}"
# ccache splits up the compile steps, so we end up with unused arguments in some steps.
# Clang also thinks that ccache isn't interactive, so we explicitly need to enable color.
if [ $(echo | ${CXX} -dM -E - | grep -c "#define __clang__ 1") -ge 1 ]; then
export CXX="${CXX} -Qunused-arguments -fcolor-diagnostics"
export CC="${CC} -Qunused-arguments -fcolor-diagnostics"
else
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60304
# GCC normally throws this error which is in GTest, but *only* when compilation and
# preprocessing aren't combined in one step. However, when using ccache with GCC, we are
# running them in separate steps, so this warning/error is shown.
export CXX="${CXX} -Wno-conversion-null"
export CC="${CC} -Wno-conversion-null"
fi
fi
echo "export CXX=\"${CXX}\""
echo "export CC=\"${CC}\""
if [ -x $(which ${CXX}) ]; then
${CXX} --version
fi
# Touch package.json so that we are definitely going to run an npm update action
mapbox_time "touch_package_json" \
touch package.json
function mapbox_install_gdb_logbt {
scripts/mason.sh INSTALL gdb VERSION 2017-04-08-aebcde5
export PATH=$(scripts/mason.sh PREFIX gdb VERSION 2017-04-08-aebcde5)/bin:${PATH}
curl -sSfL https://github.com/mapbox/logbt/archive/v2.0.1.tar.gz | tar --gunzip --extract --strip-components=2 --exclude="*md" --exclude="test*" --directory=.
sudo ./logbt --setup
./logbt --test
}
function mapbox_start_xvfb {
if [ ! -f /etc/init.d/xvfb ]; then
echo "Error: Could not start Xvfb mock server."
exit 1
fi
mapbox_time "start_xvfb" \
sh -e /etc/init.d/xvfb start
sleep 2 # sometimes, xvfb takes some time to start up
# Make sure we're connecting to xvfb
export DISPLAY=:99.0
}
export -f mapbox_start_xvfb
function mapbox_export_mesa_library_path {
# Install and set up to load a more recent version of mesa
mapbox_time "install_mesa" \
scripts/mason.sh install mesa VERSION 13.0.4
MESA_PREFIX=`scripts/mason.sh PREFIX mesa VERSION 13.0.4`
export LD_LIBRARY_PATH="${MESA_PREFIX}/lib:${LD_LIBRARY_PATH:-}"
export LIBGL_DRIVERS_PATH="${MESA_PREFIX}/lib/dri"
}
export -f mapbox_export_mesa_library_path
# Install and set up to load awscli
pip install --user awscli
export PATH="`python -m site --user-base`/bin:${PATH}"
# Install coveralls gem
gem install coveralls-lcov --no-rdoc --no-ri