cmake: adjust cmake download process to match new design
[platform/upstream/Vulkan-Tools.git] / .travis.yml
1 # Build Configuration for Travis CI
2 # https://travis-ci.org
3
4 dist: xenial
5 sudo: required
6 language: cpp
7
8 matrix:
9   # Show final status immediately if a test fails.
10   fast_finish: true
11   allow_failures:
12     - env: CHECK_COMMIT_FORMAT=ON
13     - env: VULKAN_BUILD_TARGET=GN
14   include:
15     # Android build.
16     - os: linux
17       compiler: gcc
18       env: VULKAN_BUILD_TARGET=ANDROID ANDROID_TARGET=android-23 ANDROID_ABI=armeabi-v7a
19     # Android 64-bit build.
20     - os: linux
21       compiler: gcc
22       env: VULKAN_BUILD_TARGET=ANDROID ANDROID_TARGET=android-23 ANDROID_ABI=arm64-v8a
23     # Linux GCC debug build.
24     - os: linux
25       compiler: gcc
26       env: VULKAN_BUILD_TARGET=LINUX
27     # Linux clang debug build.
28     - os: linux
29       compiler: clang
30       env: VULKAN_BUILD_TARGET=LINUX
31     # Linux GN debug build
32     - os: linux
33       env: VULKAN_BUILD_TARGET=GN
34     # Check for proper clang formatting in the pull request.
35     - env: CHECK_FORMAT=ON
36     # Check for proper commit message formatting for commits in PR
37     - env: CHECK_COMMIT_FORMAT=ON
38
39 cache: ccache
40
41 # Use set -e so that the build fails when a command fails.
42 # The default action for Travis-CI is to continue running even if a command fails.
43 # See https://github.com/travis-ci/travis-ci/issues/1066.
44 # Use the YAML block scalar header (|) to allow easier multiline script coding.
45
46 before_install:
47   - set -e
48   - CMAKE_VERSION=3.10.2
49   - |
50     if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
51       CMAKE_URL="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
52       echo CMAKE_URL=${CMAKE_URL}
53       mkdir cmake-${CMAKE_VERSION} && travis_retry wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake-${CMAKE_VERSION}
54       export PATH=${PWD}/cmake-${CMAKE_VERSION}/bin:${PATH}
55     else
56       brew install cmake || brew upgrade cmake
57     fi
58     cmake --version
59   - |
60     if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]] || [[ "$VULKAN_BUILD_TARGET" == "GN" ]]; then
61       # Install the appropriate Linux packages.
62       sudo apt-get -qq update
63       sudo apt-get -y install libxkbcommon-dev libwayland-dev libmirclient-dev libxrandr-dev libx11-xcb-dev python-pathlib
64     fi
65   - |
66     if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then
67       # Install the Android NDK.
68       export ARCH=`uname -m`
69       wget http://dl.google.com/android/repository/android-ndk-r15c-linux-${ARCH}.zip
70       unzip -u -q android-ndk-r15c-linux-${ARCH}.zip
71       export ANDROID_NDK_HOME=`pwd`/android-ndk-r15c
72       export JAVA_HOME="/usr/lib/jvm/java-8-oracle"
73       export PATH="$ANDROID_NDK_HOME:$PATH"
74     fi
75   - |
76     if [[ "$CHECK_FORMAT" == "ON" && "$TRAVIS_PULL_REQUEST" != "false" ]]; then
77       # Install the clang format diff tool, but only for pull requests.
78       curl -L http://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format-diff.py -o scripts/clang-format-diff.py;
79     fi
80   # Misc setup
81   - |
82   - export core_count=$(nproc || echo 4) && echo core_count = $core_count
83   - set +e
84
85 script:
86   - set -e
87   - |
88     if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
89       # Build Vulkan-Tools
90       cd ${TRAVIS_BUILD_DIR}
91       mkdir build
92       cd build
93       python ${TRAVIS_BUILD_DIR}/scripts/update_deps.py --config=Debug --dir=${TRAVIS_BUILD_DIR}/external
94       cmake -C${TRAVIS_BUILD_DIR}/external/helper.cmake -DCMAKE_BUILD_TYPE=Debug ..
95       make -j $core_count
96       cd ${TRAVIS_BUILD_DIR}
97     fi
98   - |
99     if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
100       # Run vulkaninfo as a test
101       cd ${TRAVIS_BUILD_DIR}
102       cd build/vulkaninfo
103       ldd vulkaninfo
104       VK_ICD_FILENAMES=../icd/VkICD_mock_icd.json ./vulkaninfo
105       cd ${TRAVIS_BUILD_DIR}
106     fi
107   - |
108     if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then
109       pushd ${TRAVIS_BUILD_DIR}/build-android
110       ./update_external_sources_android.sh  --abi $ANDROID_ABI --no-build
111       popd
112       pushd ${TRAVIS_BUILD_DIR}/cube/android
113       USE_CCACHE=1 NDK_CCACHE=ccache ndk-build APP_ABI=$ANDROID_ABI -j $core_count
114       popd
115     fi
116   - |
117     if [[ "$VULKAN_BUILD_TARGET" == "GN" ]]; then
118       git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools
119       export PATH=$PATH:$PWD/depot_tools
120       ./build-gn/update_deps.sh
121       gn gen out/Debug
122       ninja -C out/Debug
123     fi
124   - |
125     if [[ "$CHECK_FORMAT" == "ON" ]]; then
126       if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
127         # Run the clang format check only for pull request builds because the
128         # master branch is needed to do the git diff.
129         echo "Checking clang-format between TRAVIS_BRANCH=$TRAVIS_BRANCH and TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH"
130         ./scripts/check_code_format.sh
131       else
132         echo "Skipping clang-format check since this is not a pull request."
133       fi
134     fi
135   - |
136     if [[ "$CHECK_COMMIT_FORMAT" == "ON" ]]; then
137       if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
138         echo "Checking commit message formats:  See CONTRIBUTING.md"
139         ./scripts/check_commit_message_format.sh
140       fi
141     fi
142   - set +e
143
144 notifications:
145   email:
146     recipients:
147       - cnorthrop@google.com
148       - tobine@google.com
149       - chrisforbes@google.com
150       - shannon@lunarg.com
151     on_success: change
152     on_failure: always