• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Build Configuration for Travis CI
2# https://travis-ci.org
3
4dist: xenial
5sudo: required
6language: cpp
7
8matrix:
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-26 ANDROID_ABI=armeabi-v7a
19    # Android 64-bit build.
20    - os: linux
21      compiler: gcc
22      env: VULKAN_BUILD_TARGET=ANDROID ANDROID_TARGET=android-26 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
39cache: 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
46before_install:
47  - set -e
48  - CMAKE_VERSION=3.10.2
49  - |
50    if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
51      # Upgrade to the desired version of CMake
52      CMAKE_URL="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
53      echo CMAKE_URL=${CMAKE_URL}
54      mkdir cmake-${CMAKE_VERSION} && travis_retry wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake-${CMAKE_VERSION}
55      export PATH=${PWD}/cmake-${CMAKE_VERSION}/bin:${PATH}
56    else
57      brew install cmake || brew upgrade cmake
58    fi
59    cmake --version
60  - |
61    if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]] || [[ "$VULKAN_BUILD_TARGET" == "GN" ]]; then
62      # Install the appropriate Linux packages.
63      sudo apt-get -qq update
64      sudo apt-get -y install libxkbcommon-dev libwayland-dev libmirclient-dev libxrandr-dev \
65                              libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-ewmh-dev \
66                              libxcb-randr0-dev python-pathlib
67    fi
68  - |
69    if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then
70      # Install the Android NDK.
71      export ARCH=`uname -m`
72      wget http://dl.google.com/android/repository/android-ndk-r18b-linux-${ARCH}.zip
73      unzip -u -q android-ndk-r18b-linux-${ARCH}.zip
74      export ANDROID_NDK_HOME=`pwd`/android-ndk-r18b
75      export JAVA_HOME="/usr/lib/jvm/java-8-oracle"
76      export PATH="$ANDROID_NDK_HOME:$PATH"
77    fi
78  - |
79    if [[ "$CHECK_FORMAT" == "ON" && "$TRAVIS_PULL_REQUEST" != "false" ]]; then
80      # Install the clang format diff tool, but only for pull requests.
81      curl -L http://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format-diff.py \
82           -o scripts/clang-format-diff.py;
83    fi
84  # Misc setup
85  - export core_count=$(nproc || echo 4) && echo core_count = $core_count
86  - ccache --zero-stats
87  - set +e
88
89script:
90  - set -e
91  - |
92    if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
93      # Build all dependencies for Vulkan-ValidationLayers
94      if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then
95        # Build master branch when triggered by (daily) cron job
96        ${TRAVIS_BUILD_DIR}/scripts/update_deps.py --dir=${TRAVIS_BUILD_DIR}/external --ref=master
97      else
98        ${TRAVIS_BUILD_DIR}/scripts/update_deps.py --dir=${TRAVIS_BUILD_DIR}/external
99      fi
100    fi
101  - |
102    if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
103      # Fetch googletest component to build validation layer tests
104      echo Fetching googletest external dependencies for building validation layer tests
105      git clone https://github.com/google/googletest.git ${TRAVIS_BUILD_DIR}/external/googletest
106      pushd ${TRAVIS_BUILD_DIR}/external/googletest
107      git checkout tags/release-1.8.1
108      popd
109    fi
110  - |
111    if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
112      # Verify consistency between source file generators and output
113      echo Verifying consistency between source file generators and output
114      python3 ${TRAVIS_BUILD_DIR}/scripts/generate_source.py --verify ${TRAVIS_BUILD_DIR}/external/Vulkan-Headers/registry
115    fi
116  - |
117    if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
118      # Build Vulkan-ValidationLayers
119      cd ${TRAVIS_BUILD_DIR}
120      mkdir build
121      cd build
122      cmake -C ${TRAVIS_BUILD_DIR}/external/helper.cmake -DCMAKE_BUILD_TYPE=Debug \
123            -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/build/install -DBUILD_LAYER_SUPPORT_FILES=ON \
124            -DUSE_CCACHE=ON ..
125      cmake --build . --target install -- -j$core_count
126    fi
127  - |
128    if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
129      # Build VulkanTools
130      # Note: VulkanTools has a build dependency on Vulkan-ValidationLayers so it must be built after V-VL is built
131      pushd ${TRAVIS_BUILD_DIR}/external/VulkanTools
132      ./update_external_sources.sh
133      mkdir build
134      cd build
135      cmake -DCMAKE_BUILD_TYPE=Debug \
136            -DBUILD_VIA=NO -DBUILD_VKTRACE=NO -DBUILD_VLF=NO -DBUILD_TESTS=NO -DBUILD_LAYERMGR=NO \
137            -DBUILD_VKTRACEVIEWER=NO -DBUILD_VKTRACE_LAYER=NO -DBUILD_VKTRACE_REPLAY=NO \
138            -DVULKAN_HEADERS_INSTALL_DIR=${TRAVIS_BUILD_DIR}/external/Vulkan-Headers/build/install \
139            -DVULKAN_LOADER_INSTALL_DIR=${TRAVIS_BUILD_DIR}/external/Vulkan-Loader/build/install \
140            -DVULKAN_VALIDATIONLAYERS_INSTALL_DIR=${TRAVIS_BUILD_DIR}/build/install \
141            ..
142      cmake --build . -- -j $core_count
143      popd
144    fi
145  - |
146    if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
147      # Run Tests
148      cd ${TRAVIS_BUILD_DIR}
149      export LD_LIBRARY_PATH=${TRAVIS_BUILD_DIR}/external/Vulkan-Loader/install/lib:${LD_LIBRARY_PATH}
150      export VK_LAYER_PATH=${TRAVIS_BUILD_DIR}/external/VulkanTools/build/layersvt:${TRAVIS_BUILD_DIR}/build/layers
151      export VK_ICD_FILENAMES=${TRAVIS_BUILD_DIR}/external/Vulkan-Tools/build/icd/VkICD_mock_icd.json
152      build/tests/vk_layer_validation_tests
153      for profile in tests/device_profiles/*.json
154      do
155        echo Testing with profile $profile
156        VK_DEVSIM_FILENAME=$profile build/tests/vk_layer_validation_tests --devsim
157      done
158    fi
159  - |
160    if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then
161      pushd build-android
162      ./update_external_sources_android.sh --abi $ANDROID_ABI --no-build
163      USE_CCACHE=1 NDK_CCACHE=ccache ndk-build APP_ABI=$ANDROID_ABI -j $core_count
164      popd
165    fi
166  - |
167    if [[ "$CHECK_FORMAT" == "ON" ]]; then
168      if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
169        # Run the clang format check only for pull request builds because the
170        # master branch is needed to do the git diff.
171        echo "Checking clang-format between TRAVIS_BRANCH=$TRAVIS_BRANCH and TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH"
172        ./scripts/check_code_format.sh
173      else
174        echo "Skipping clang-format check since this is not a pull request."
175      fi
176    fi
177  - |
178    if [[ "$CHECK_COMMIT_FORMAT" == "ON" ]]; then
179      if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
180        echo "Checking commit message formats:  See CONTRIBUTING.md"
181        ./scripts/check_commit_message_format.sh
182      fi
183    fi
184  - |
185    if [[ "$VULKAN_BUILD_TARGET" == "GN" ]]; then
186      git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools
187      export PATH=$PATH:$PWD/depot_tools
188      ./build-gn/update_deps.sh
189      gn gen out/Debug
190      ninja -C out/Debug
191    fi
192  - ccache --show-stats
193  - set +e
194
195notifications:
196  email:
197    recipients:
198      - cnorthrop@google.com
199      - tobine@google.com
200      - chrisforbes@google.com
201      - shannon@lunarg.com
202      - mikes@lunarg.com
203    on_success: change
204    on_failure: always
205