Check Android build on Travis CI.

Also stop requiring sudo privilege so that we can use containers
for testing.
This commit is contained in:
Lei Zhang 2017-05-13 14:26:30 -04:00
parent c49b4efa91
commit b21213e893

View File

@ -7,7 +7,7 @@ os:
- osx
# Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment.
sudo: required
sudo: false
dist: trusty
env:
@ -24,6 +24,9 @@ matrix:
# Skip GCC builds on Mac OS X.
- os: osx
compiler: gcc
include:
# Additional build using Android NDK.
- env: BUILD_NDK=ON
cache:
apt: true
@ -41,20 +44,38 @@ addons:
install:
# Install ninja on Mac OS X.
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew install ninja; fi
# Make sure that clang-3.6 is selected.
# Make sure that clang-3.6 is selected on Linux.
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" ]]; then
export CC=clang-3.6 CXX=clang++-3.6;
fi
# Download Android NDK and Android CMake toolchain file.
- if [[ "$BUILD_NDK" == "ON" ]]; then
git clone --depth=1 https://github.com/urho3d/android-ndk.git $HOME/android-ndk;
export ANDROID_NDK=$HOME/android-ndk;
git clone --depth=1 https://github.com/taka-no-me/android-cmake.git $HOME/android-cmake;
export TOOLCHAIN_PATH=$HOME/android-cmake/android.toolchain.cmake;
fi
before_script:
- git clone https://github.com/google/googletest.git External/googletest
script:
- mkdir build && cd build
# We need to install the compiled binaries so the paths in the runtests script can resolve correctly.
- cmake -GNinja -DCMAKE_BUILD_TYPE=${GLSLANG_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=`pwd`/install ..
- ninja install
# Run Google-Test-based tests.
- ctest --output-on-failure
# Run runtests-based tests.
- cd ../Test && ./runtests
# For Android, do release building using NDK without testing.
# For Linux and macOS, do debug/release building with testing.
- if [[ "$BUILD_NDK" == "ON" ]]; then
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH}
-DANDROID_NATIVE_API_LEVEL=android-12
-DCMAKE_BUILD_TYPE=Release
-DANDROID_ABI="armeabi-v7a with NEON"
-DBUILD_TESTING=OFF
-GNinja ..;
ninja;
else
cmake -DCMAKE_BUILD_TYPE=${GLSLANG_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=`pwd`/install
-GNinja ..;
ninja install;
ctest --output-on-failure &&
cd ../Test && ./runtests;
fi