Go back to root directory
[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 env:
14   global:
15     - secure: IoR/Xe9E+NnLAeI23WrmUsGQn5rocz+XRYUk+BbaoKiIRYm4q72GKyypRoOGLu7wImOXFSvnN/dpdnqIpx4W0NfsSvNdlXyhDy+wvT1kzTt77dJGnkGZTZ2SBOtC9AECLy4sqM9HG0rYRR6WfXcnP2GlrE5f2aF07aISQbOUsQMvyyhtCmVAzIigK1zIUto5I0pNenvo/Y+ur+mEvTh+FtaoDIGepCbZlCc+OxqRXwXNlI7mDXbzLPmTB1FWTGsrZdRX8czF9tN9Y+T79DQjB4Lcyyeow8yU9NBVlgzZJcp1xI0UIskRT8gVrXmBYL2dMeHnDQuhxjEg9n7jfr3ptA9rgwMaSsgdaLwuBXgtPuqVgUYDpE1cP8WI8q38MXX0I6psTs/WHu+z+5UwfjzpPOHmGdVt48o8ymFTapvD5Cf1+uJyk73QkyStnPIdBF1N9Yx5sD7HN28K6/Ro12sCCePHUZ9Uz1DdZI6XxkgCNKNwao0csAyvODxD6Ee43mkExtviB8BJY5jWLIMTdGhgEGH2sRqils8IDW0p8AOTPM4UC7iA7hdg3pA+XMvBHvP9ixsY7tuB+yR2AfnFaSw2DVbwI5GgFdFMNHXYuL+9V9Wuh3keBKYQT/Hy1YvxjQ/t9UouYHqEsyVFUl3R4lEAM9+qSRsRu+EKmcSO2QtCsWc=
16   matrix:
17     # Each line is a set of environment variables set before a build.
18     # Thus each line represents a different build configuration.
19     - BUILD_TYPE=RelWithDebInfo
20     - BUILD_TYPE=Debug
21
22 compiler:
23   - clang
24   - gcc
25
26 matrix:
27   allow_failures:
28     - os: osx
29   fast_finish: true
30   include:
31     # Additional build using Android NDK with android-cmake
32     - env: BUILD_ANDROID_CMAKE=ON
33     # Additional build using Android NDK with Android.mk
34     - env: BUILD_ANDROID_MK=ON
35     # Additional check over format
36     - env: CHECK_FORMAT=ON
37   exclude:
38     # Skip GCC builds on macOS.
39     - os: osx
40       compiler: gcc
41
42 cache:
43   apt: true
44
45 git:
46   depth: 1
47
48 branches:
49   only:
50     - master
51
52 before_install:
53   - if [[ "$BUILD_ANDROID_CMAKE" == "ON" ]] || [[ "$BUILD_ANDROID_MK" == "ON" ]]; then
54       git clone --depth=1 https://github.com/urho3d/android-ndk.git $HOME/android-ndk;
55       export ANDROID_NDK=$HOME/android-ndk;
56       git clone --depth=1 https://github.com/taka-no-me/android-cmake.git $HOME/android-cmake;
57       export TOOLCHAIN_PATH=$HOME/android-cmake/android.toolchain.cmake;
58     fi
59   - if [[ "$CHECK_FORMAT" == "ON" ]]; then
60       curl -L http://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format-diff.py -o utils/clang-format-diff.py;
61     fi
62
63 before_script:
64   - git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers
65   - git clone --depth=1 https://github.com/google/googletest          external/googletest
66   - git clone --depth=1 https://github.com/google/effcee              external/effcee
67   - git clone --depth=1 https://github.com/google/re2                 external/re2
68
69 script:
70   # Due to the limitation of Travis platform, we cannot start too many concurrent jobs.
71   # Otherwise GCC will panic with internal error, possibility because of memory issues.
72   # ctest with the current tests doesn't profit from using more than 4 threads.
73   - export NPROC=4
74   - mkdir build && cd build
75   - if [[ "$BUILD_ANDROID_MK" == "ON" ]]; then
76       export BUILD_DIR=$(pwd);
77       mkdir ${BUILD_DIR}/libs;
78       mkdir ${BUILD_DIR}/app;
79       $ANDROID_NDK/ndk-build -C ../android_test NDK_PROJECT_PATH=.
80                              NDK_LIBS_OUT=${BUILD_DIR}/libs
81                              NDK_APP_OUT=${BUILD_DIR}/app -j${NPROC};
82     elif [[ "$BUILD_ANDROID_CMAKE" == "ON" ]]; then
83       cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH}
84             -DANDROID_NATIVE_API_LEVEL=android-9
85             -DCMAKE_BUILD_TYPE=Release
86             -DANDROID_ABI="armeabi-v7a with NEON"
87             -DSPIRV_BUILD_COMPRESSION=ON
88             -DSPIRV_SKIP_TESTS=ON ..;
89       make -j${NPROC};
90     elif [[ "$CHECK_FORMAT" == "ON" ]]; then
91       cd ..;
92       ./utils/check_code_format.sh;
93     else
94       cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DSPIRV_BUILD_COMPRESSION=ON -DCMAKE_INSTALL_PREFIX=install ..;
95       make -j${NPROC} install;
96       ctest -j${NPROC} --output-on-failure --timeout 300;
97     fi
98
99 after_success:
100   # Create tarball for deployment
101   - if [[ "${CC}" == "clang" && "${BUILD_ANDROID_MK}" != "ON" && "${BUILD_ANDROID_CMAKE}" != "ON" ]]; then
102       cd install;
103       export TARBALL=SPIRV-Tools-master-${TRAVIS_OS_NAME}-${BUILD_TYPE}.zip;
104       find . -print | zip -@ ${TARBALL};
105     fi
106
107 before_deploy:
108   # Tag the current master top of the tree as "master-tot".
109   # Travis CI relies on the tag name to push to the correct release.
110   - git config --global user.name "Travis CI"
111   - git config --global user.email "builds@travis-ci.org"
112   - git tag -f master-tot
113   - git push -q -f https://${spirvtoken}@github.com/KhronosGroup/SPIRV-Tools --tags
114
115 deploy:
116   provider: releases
117   api_key: ${spirvtoken}
118   on:
119     branch: master
120     condition: ${CC} == clang && ${BUILD_ANDROID_MK} != ON && ${BUILD_ANDROID_CMAKE} != ON
121   file: ${TARBALL}
122   skip_cleanup: true
123   overwrite: true
124
125 notifications:
126   email:
127     recipients:
128       - andreyt@google.com
129       - antiagainst@google.com
130       - awoloszyn@google.com
131       - dneto@google.com
132       - ehsann@google.com
133       - qining@google.com
134     on_success: change
135     on_failure: always