build on trusty

This commit is contained in:
Konstantin Käfer
2015-04-16 16:46:12 +02:00
parent 2831073f85
commit decc493ec8
38 changed files with 389 additions and 458 deletions

15
scripts/android/install.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e
set -o pipefail
source ./scripts/travis_helper.sh
mapbox_time "checkout_mason" \
git submodule update --init .mason
export MASON_PLATFORM=android
export MASON_ANDROID_ABI=${ANDROID_ABI}
mapbox_time "android_toolchain" \
./scripts/android/toolchain.sh

61
scripts/android/run.sh Executable file
View File

@@ -0,0 +1,61 @@
#!/usr/bin/env bash
set -e
set -o pipefail
BUILDTYPE=${BUILDTYPE:-Release}
TESTMUNK=${TESTMUNK:-no}
export HOST=android
export MASON_PLATFORM=android
export MASON_ANDROID_ABI=${ANDROID_ABI:-arm-v7}
source ./scripts/travis_helper.sh
# Add Mason to PATH
export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
################################################################################
# Build
################################################################################
mapbox_time "checkout_styles" \
git submodule update --init styles
mkdir -p ./android/java/MapboxGLAndroidSDKTestApp/src/main/res/raw
echo "${MAPBOX_ACCESS_TOKEN}" > ./android/java/MapboxGLAndroidSDKTestApp/src/main/res/raw/token.txt
mapbox_time "compile_library" \
make android-lib -j${JOBS} BUILDTYPE=${BUILDTYPE}
mapbox_time "build_apk" \
make android -j${JOBS} BUILDTYPE=${BUILDTYPE}
################################################################################
# Deploy
################################################################################
if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then
# Install and add awscli to PATH for uploading the results
mapbox_time "install_awscli" \
pip install --user awscli
export PATH="`python -m site --user-base`/bin:${PATH}"
mapbox_time_start "deploy_results"
echo "Deploying results..."
S3_PREFIX=s3://mapbox/mapbox-gl-native/android/build/${TRAVIS_JOB_NUMBER}
APK_OUTPUTS=./android/java/MapboxGLAndroidSDKTestApp/build/outputs/apk
# Upload either the debug or the release build
if [ ${BUILDTYPE} == "Debug" ] ; then
aws s3 cp \
${APK_OUTPUTS}/MapboxGLAndroidSDKTestApp-debug.apk \
${S3_PREFIX}/MapboxGLAndroidSDKTestApp-debug.apk
elif [ ${BUILDTYPE} == "Release" ] ; then
aws s3 cp \
${APK_OUTPUTS}/MapboxGLAndroidSDKTestApp-release-unsigned.apk \
${S3_PREFIX}/MapboxGLAndroidSDKTestApp-release-unsigned.apk
fi
mapbox_time_finish
fi

26
scripts/android/toolchain.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
set -o pipefail
export MASON_PLATFORM=android
export MASON_ANDROID_ABI=${MASON_ANDROID_ABI:-arm-v7}
export PATH="`pwd`/.mason:${PATH}"
export MASON_DIR="`pwd`/.mason"
export PATH=`mason env PATH`
echo MASON_PLATFORM=\"${MASON_PLATFORM}\"
echo MASON_ANDROID_ABI=\"${MASON_ANDROID_ABI}\"
echo CXX=\"`which $(mason env CXX)`\"
echo CC=\"`which $(mason env CC)`\"
echo LD=\"`which $(mason env LD)`\"
echo LINK=\"`which $(mason env CXX)`\"
echo AR=\"`which $(mason env AR)`\"
echo RANLIB=\"`which $(mason env RANLIB)`\"
echo STRIP=\"`which $(mason env STRIP)`\"
echo LDFLAGS=\"`mason env LDFLAGS` \${LDFLAGS:-}\"
echo CFLAGS=\"`mason env CFLAGS` \${CFLAGS:-}\"
echo CXXFLAGS=\"`mason env CXXFLAGS` \${CXXFLAGS:-}\"
echo CPPFLAGS=\"`mason env CPPFLAGS` \${CPPFLAGS:-}\"
echo JNIDIR=\"`mason env JNIDIR`\"

View File

@@ -1,25 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
./scripts/local_mason.sh
export MASON_PLATFORM=android
export PATH=`.mason/mason env PATH`
echo MASON_PLATFORM=\"android\"
echo MASON_ANDROID_ABI=\"${MASON_ANDROID_ABI}\"
echo CXX=\"`which $(.mason/mason env CXX)`\"
echo CC=\"`which $(.mason/mason env CC)`\"
echo LD=\"`which $(.mason/mason env LD)`\"
echo LINK=\"`which $(.mason/mason env CXX)`\"
echo AR=\"`which $(.mason/mason env AR)`\"
echo RANLIB=\"`which $(.mason/mason env RANLIB)`\"
echo STRIP=\"`which $(.mason/mason env STRIP)`\"
echo LDFLAGS=\"`.mason/mason env LDFLAGS` ${LDFLAGS}\"
echo CFLAGS=\"`.mason/mason env CFLAGS` ${CFLAGS}\"
echo CPPFLAGS=\"`.mason/mason env CPPFLAGS` ${CPPFLAGS}\"
echo JNIDIR=\"`.mason/mason env JNIDIR`\"

View File

@@ -1,32 +0,0 @@
#!/usr/bin/env bash
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
export DISPLAY=:99.0
if [[ ${MASON_PLATFORM} != "android" ]]; then
sh -e /etc/init.d/xvfb start
fi
# use g++ that supports c++11
if [[ ${CXX} == "g++" ]]; then
export CXX="g++-4.8"
export CC="gcc-4.8"
fi
# If building in debug then turn on sanitizers.
# They should both work with latest g++/clang++
# but it's not worth a standalone matrix so here
# we just test address->gcc and thread->clang for
# some limited coverage
# if [[ ${BUILDTYPE} == "Debug" ]]; then
# if [[ ${CXX} == "g++" ]]; then
# export CXXFLAGS="-fsanitize=address -g ${CXXFLAGS}"
# export CFLAGS="-fsanitize=address -g ${CFLAGS}"
# export LDFLAGS="-fsanitize=address ${LDFLAGS}"
# elif [[ ${CXX} == "clang++" ]]; then
# export CXXFLAGS="-fsanitize=thread -g -fPIC ${CXXFLAGS}"
# export CFLAGS="-fsanitize=thread -g ${CFLAGS}"
# export LDFLAGS="-fsanitize=thread -pie ${LDFLAGS}"
# fi
# fi
fi

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env bash
mason install node 0.10.35
export PATH="`mason prefix node 0.10.35`/bin":"$PATH"

View File

@@ -16,10 +16,10 @@ security unlock-keychain -p travis ios-build.keychain
security set-keychain-settings -t 3600 -l ~/Library/Keychains/ios-build.keychain
# Add certificates to keychain and allow codesign to access them
security import ./scripts/ios_travis/apple.crt -k ~/Library/Keychains/ios-build.keychain -T /usr/bin/codesign
security import ./scripts/ios_travis/ios-dist.cer -k ~/Library/Keychains/ios-build.keychain -T /usr/bin/codesign
security import ./scripts/ios_travis/ios-dist.p12 -k ~/Library/Keychains/ios-build.keychain -P $IOS_KEY_PASSWORD -T /usr/bin/codesign
security import ./scripts/ios/apple.crt -k ~/Library/Keychains/ios-build.keychain -T /usr/bin/codesign
security import ./scripts/ios/ios-dist.cer -k ~/Library/Keychains/ios-build.keychain -T /usr/bin/codesign
security import ./scripts/ios/ios-dist.p12 -k ~/Library/Keychains/ios-build.keychain -P $IOS_KEY_PASSWORD -T /usr/bin/codesign
# Put the provisioning profile in place
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp "./scripts/ios_travis/$IOS_PROFILE_NAME.mobileprovision" ~/Library/MobileDevice/Provisioning\ Profiles/
cp "./scripts/ios/$IOS_PROFILE_NAME.mobileprovision" ~/Library/MobileDevice/Provisioning\ Profiles/

13
scripts/ios/install.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -e
set -o pipefail
source ./scripts/travis_helper.sh
mapbox_time "checkout_mason" \
git submodule update --init .mason
export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
mapbox_time "install_xcpretty" \
gem install xcpretty --no-rdoc --no-ri --no-document --quiet

27
scripts/ios/run.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
set -o pipefail
BUILDTYPE=${BUILDTYPE:-Release}
source ./scripts/travis_helper.sh
# Add Mason to PATH
export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
################################################################################
# Build
################################################################################
mapbox_time "package_ios" \
make ipackage
################################################################################
# Deploy
################################################################################
if [[ -n "$PUBLISH_TAG" ]]; then
mapbox_time "deploy_ios" \
./scripts/ios/publish.sh "$PUBLISH_VERSION"
fi

22
scripts/linux/install.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -e
set -o pipefail
source ./scripts/travis_helper.sh
mapbox_time "update_apt" \
sudo apt-get -y update
mapbox_time "install_apt" \
sudo apt-get -y install mesa-utils llvm-3.4 pkg-config libcurl4-openssl-dev \
libboost-dev libboost-program-options-dev libxi-dev x11proto-randr-dev \
x11proto-xext-dev libxrandr-dev x11proto-xf86vidmode-dev libxxf86vm-dev \
libxcursor-dev libxinerama-dev
mapbox_time "checkout_mason" \
git submodule update --init .mason
export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
mapbox_time "install_mesa" \
mason install mesa 10.4.3

75
scripts/linux/run.sh Executable file
View File

@@ -0,0 +1,75 @@
#!/usr/bin/env bash
set -e
set -o pipefail
BUILDTYPE=${BUILDTYPE:-Release}
source ./scripts/travis_helper.sh
# Add Mason to PATH
export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
# Set the core file limit to unlimited so a core file is generated upon crash
ulimit -c unlimited -S
################################################################################
# X Server setup
################################################################################
# Start the mock X server
if [ -f /etc/init.d/xvfb ] ; then
mapbox_time "start_xvfb" \
sh -e /etc/init.d/xvfb start
sleep 2 # sometimes, xvfb takes some time to start up
fi
# Make sure we're connecting to xvfb
export DISPLAY=:99.0
# Make sure we're loading the 10.4.3 libs we installed manually
export LD_LIBRARY_PATH="`mason prefix mesa 10.4.3`/lib:${LD_LIBRARY_PATH:-}"
mapbox_time "glxinfo" \
glxinfo
################################################################################
# Build
################################################################################
mapbox_time "checkout_styles" \
git submodule update --init styles
mapbox_time "compile_program" \
make linux -j${JOBS} BUILDTYPE=${BUILDTYPE}
mapbox_time "compile_tests" \
make test -j${JOBS} BUILDTYPE=${BUILDTYPE}
################################################################################
# Test
################################################################################
mapbox_time "checkout_test_suite" \
git submodule update --init test/suite
mapbox_time "run_tests" \
make test-* BUILDTYPE=${BUILDTYPE}
mapbox_time "compare_results" \
./scripts/compare_images.sh
################################################################################
# Deploy
################################################################################
if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then
# Install and add awscli to PATH for uploading the results
mapbox_time "install_awscli" \
pip install --user awscli
export PATH="`python -m site --user-base`/bin:${PATH}"
mapbox_time_start "deploy_results"
(cd ./test/suite/ && ./bin/deploy_results.sh)
mapbox_time_finish
fi

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
git submodule update --init .mason
PATH=`pwd`/.mason:$PATH
export MASON_DIR=`pwd`/.mason

View File

@@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
cd bin
$1 install --clang=1
cd ../

13
scripts/osx/install.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -e
set -o pipefail
source ./scripts/travis_helper.sh
mapbox_time "checkout_mason" \
git submodule update --init .mason
export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
mapbox_time "install_xcpretty" \
gem install xcpretty --no-rdoc --no-ri --no-document --quiet

27
scripts/osx/run.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
set -o pipefail
BUILDTYPE=${BUILDTYPE:-Release}
source ./scripts/travis_helper.sh
# Add Mason to PATH
export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
# Set the core file limit to unlimited so a core file is generated upon crash
ulimit -c unlimited -S
################################################################################
# Build
################################################################################
mapbox_time "checkout_styles" \
git submodule update --init styles
mapbox_time "compile_program" \
make xosx -j${JOBS} BUILDTYPE=${BUILDTYPE}
mapbox_time "compile_tests" \
make xtest -j${JOBS} BUILDTYPE=${BUILDTYPE}

View File

@@ -1,53 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
#
# install Linux dependencies
#
if [[ `lsb_release -r` =~ "12.04" ]]; then
sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
fi
sudo add-apt-repository --yes ppa:boost-latest/ppa
mapbox_time "apt_update" \
sudo apt-get update -y
mapbox_time "install_gcc" \
sudo apt-get -y install gcc-4.8 g++-4.8
mapbox_time "install_build_tools" \
sudo apt-get -y install git build-essential zlib1g-dev automake gdb \
libtool xutils-dev make cmake pkg-config python-pip \
libboost1.55-dev libcurl4-openssl-dev \
libpng-dev libsqlite3-dev
if [[ ${MASON_PLATFORM} != "android" ]]; then
mapbox_time "install_opengl" \
sudo apt-get -y install mesa-utils libxi-dev x11proto-randr-dev \
x11proto-xext-dev libxrandr-dev \
x11proto-xf86vidmode-dev libxxf86vm-dev \
libxcursor-dev libxinerama-dev \
llvm-3.4 # required for mesa
mapbox_time "install_mesa" \
mason install mesa 10.4.3
fi
mapbox_time "install_awscli" \
sudo pip install awscli
elif [[ ${TRAVIS_OS_NAME} == "osx" ]]; then
#
# install OS X dependencies
#
mapbox_time "install_build_tools" \
brew install git
mapbox_time "install_awscli" \
sudo pip install awscli
mapbox_time "install_xcpretty" \
gem install xcpretty --no-rdoc --no-ri --no-document --quiet
fi

View File

@@ -1,13 +1,19 @@
#!/usr/bin/env bash
case `uname -s` in
'Darwin') JOBS=$((`sysctl -n hw.ncpu` + 2)) ;;
'Linux') JOBS=$((`nproc` + 2)) ;;
*) JOBS=2 ;;
esac
function mapbox_time_start {
local name=$1
mapbox_timer_name=$name
travis_fold start $name
mapbox_fold start $name
mapbox_timer_id=$(printf %08x $(( RANDOM * RANDOM )))
eval "mapbox_start_time_$mapbox_timer_id=$(travis_nanoseconds)"
eval "mapbox_start_time_$mapbox_timer_id=$(mapbox_nanoseconds)"
echo -en "travis_time:start:$mapbox_timer_id\n"
}
@@ -16,11 +22,11 @@ function mapbox_time_finish {
local timer_id=${2:-$mapbox_timer_id}
local timer_start="mapbox_start_time_$timer_id"
eval local start_time=\${$timer_start}
local end_time=$(travis_nanoseconds)
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"
travis_fold end $name
mapbox_fold end $name
}
function mapbox_time {
@@ -32,13 +38,13 @@ function mapbox_time {
mapbox_time_finish $name $timer_id
}
if [[ "${TRAVIS_COMMIT:-false}" == false ]]; then
function travis_fold {
function mapbox_fold {
local action=$1
local name=$2
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
}
function travis_nanoseconds {
function mapbox_nanoseconds {
local cmd="date"
local format="+%s%N"
local os=$(uname)
@@ -51,11 +57,11 @@ function travis_nanoseconds {
$cmd -u $format
}
fi
export JOBS
export ANSI_CLEAR
export -f travis_fold
export -f travis_nanoseconds
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,62 +0,0 @@
#!/usr/bin/env bash
COMMIT_MESSAGE=$(git show -s --format=%B $1 | tr -d '\n')
PUBLISH_TAG=$(echo "$COMMIT_MESSAGE" | grep -oE '\[publish [a-z0-9\.\-]+\]' | grep -oE '[a-z0-9\.\-]+' | tail -n1)
PUBLISH_PLATFORM=$(echo "$PUBLISH_TAG" | awk -F '-v' '{ print $1 }')
PUBLISH_VERSION=$(echo "$PUBLISH_TAG" | awk -F '-v' '{ print $2 }')
set -e
set -o pipefail
mapbox_time "checkout_styles" \
git submodule update --init styles
if [[ $MASON_PLATFORM == "android" ]]; then
./android/scripts/run-build.sh
elif [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
#
# build & test Linux
#
mapbox_time "compile_program" \
make linux -j$JOBS BUILDTYPE=${BUILDTYPE}
mapbox_time "compile_tests" \
make test -j$JOBS BUILDTYPE=${BUILDTYPE}
mapbox_time "checkout_test_suite" \
git submodule update --init test/suite
mapbox_time "run_tests" \
make test-* BUILDTYPE=${BUILDTYPE}
mapbox_time "compare_results" \
./scripts/compare_images.sh
if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then
mapbox_time_start "deploy_results"
(cd ./test/suite/ && ./bin/deploy_results.sh)
mapbox_time_finish
fi
elif [[ ${TRAVIS_OS_NAME} == "osx" && ${MASON_PLATFORM} == "osx" ]]; then
#
# build OS X
#
mapbox_time "build_osx" \
make xosx -j$JOBS
elif [[ ${TRAVIS_OS_NAME} == "osx" && ${MASON_PLATFORM} == "ios" ]]; then
#
# build & package iOS
#
mapbox_time "package_ios"
make ipackage
#
# conditionally deploy iOS build
#
if [[ -n "$PUBLISH_TAG" ]]; then
mapbox_time "deploy_ios"
./scripts/publish_ios.sh "$PUBLISH_VERSION"
fi
fi

3
scripts/xcpretty.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
FN=$(which xcpretty) ; [ ! -z ${FN} ] && echo "| ${FN}"