Add Android.mk build to Travis CI
[platform/upstream/SPIRV-Tools.git] / .travis.yml
1 # Linux Build Configuration for Travis
2
3 language: cpp
4
5 os:
6   - linux
7   - osx
8
9 # Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment.
10 dist: trusty
11 sudo: false
12
13 # Use the default Xcode environment for Xcode.
14
15 env:
16   # Each line is a set of environment variables set before a build.
17   # Thus each line represents a different build configuration.
18   - BUILD_TYPE=Release
19   - BUILD_TYPE=Debug
20
21 compiler:
22   - clang
23   - gcc
24
25 matrix:
26   fast_finish: true
27   include:
28     # Additional build using Android NDK with android-cmake
29     - env: BUILD_ANDROID_CMAKE=ON
30     # Additional build using Android NDK with Android.mk
31     - env: BUILD_ANDROID_MK=ON
32   exclude:
33     # Skip GCC builds on macOS.
34     - os: osx
35       compiler: gcc
36
37 cache:
38   apt: true
39
40 git:
41   depth: 1
42
43 branches:
44   only:
45     - master
46
47 before_install:
48   - if [[ "$BUILD_ANDROID_CMAKE" == "ON" ]] || [[ "$BUILD_ANDROID_MK" == "ON" ]]; then
49       git clone --depth=1 https://github.com/urho3d/android-ndk.git $HOME/android-ndk;
50       export ANDROID_NDK=$HOME/android-ndk;
51       git clone --depth=1 https://github.com/taka-no-me/android-cmake.git $HOME/android-cmake;
52       export TOOLCHAIN_PATH=$HOME/android-cmake/android.toolchain.cmake;
53     fi
54
55 before_script:
56   - git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers
57   - git clone --depth=1 https://github.com/google/googletest          external/googletest
58
59 script:
60   # Due to the limitation of Travis platform, we cannot start too many concurrent jobs.
61   # Otherwise GCC will panic with internal error, possibility because of memory issues.
62   # ctest with the current tests doesn't profit from using more than 4 threads.
63   - export NPROC=4;
64   - mkdir build && cd build;
65   - if [[ "$BUILD_ANDROID_MK" == "ON" ]]; then
66       export BUILD_DIR=$(pwd);
67       mkdir ${BUILD_DIR}/libs;
68       mkdir ${BUILD_DIR}/app;
69       $ANDROID_NDK/ndk-build -C ../android_test NDK_PROJECT_PATH=.
70                              NDK_LIBS_OUT=${BUILD_DIR}/libs
71                              NDK_APP_OUT=${BUILD_DIR}/app -j${NPROC};
72     elif [[ "$BUILD_ANDROID_CMAKE" == "ON" ]]; then
73       cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH}
74             -DANDROID_NATIVE_API_LEVEL=android-9
75             -DCMAKE_BUILD_TYPE=Release
76             -DANDROID_ABI="armeabi-v7a with NEON"
77             -DSPIRV_BUILD_COMPRESSION=ON
78             -DSPIRV_SKIP_TESTS=ON ..;
79       make -j${NPROC};
80     else
81       cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DSPIRV_BUILD_COMPRESSION=ON ..;
82       make -j${NPROC};
83       ctest -j${NPROC} --output-on-failure --timeout 300;
84     fi
85
86
87 notifications:
88   email:
89     recipients:
90       - andreyt@google.com
91       - antiagainst@google.com
92       - awoloszyn@google.com
93       - dneto@google.com
94       - ehsann@google.com
95       - qining@google.com
96     on_success: change
97     on_failure: always