travis: Set up to test commit messages
[platform/upstream/Vulkan-Tools.git] / .travis.yml
1 # Build Configuration for Travis CI
2 # https://travis-ci.org
3
4 dist: trusty
5 sudo: required
6 language: cpp
7
8 # This line necessary for allow_failures operation
9 env:
10
11 matrix:
12   # Show final status immediately if a test fails.
13   fast_finish: true
14   allow_failures:
15     - env: CHECK_COMMIT_FORMAT=ON
16   include:
17     # Android build.
18     - os: linux
19       compiler: gcc
20       env: VULKAN_BUILD_TARGET=ANDROID ANDROID_TARGET=android-23 ANDROID_ABI=armeabi-v7a
21     # Android 64-bit build.
22     - os: linux
23       compiler: gcc
24       env: VULKAN_BUILD_TARGET=ANDROID ANDROID_TARGET=android-23 ANDROID_ABI=arm64-v8a
25     # Linux GCC debug build.
26     - os: linux
27       compiler: gcc
28       env: VULKAN_BUILD_TARGET=LINUX
29     # Linux clang debug build.
30     - os: linux
31       compiler: clang
32       env: VULKAN_BUILD_TARGET=LINUX
33     # Check for proper clang formatting in the pull request.
34     - env: CHECK_FORMAT=ON
35     # Check for proper commit message formatting for commits in PR
36     - env: CHECK_COMMIT_FORMAT=ON
37
38 cache: ccache
39
40 # Use set -e so that the build fails when a command fails.
41 # The default action for Travis-CI is to continue running even if a command fails.
42 # See https://github.com/travis-ci/travis-ci/issues/1066.
43 # Use the YAML block scalar header (|) to allow easier multiline script coding.
44
45 before_install:
46   - set -e
47   - |
48     if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
49       # Install the appropriate Linux packages.
50       sudo apt-get -qq update
51       sudo apt-get -y install libxkbcommon-dev libwayland-dev libmirclient-dev libxrandr-dev libx11-xcb-dev
52     fi
53   - |
54     if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then
55       # Install the Android NDK.
56       export ARCH=`uname -m`
57       wget http://dl.google.com/android/repository/android-ndk-r15c-linux-${ARCH}.zip
58       unzip -u -q android-ndk-r15c-linux-${ARCH}.zip
59       export ANDROID_NDK_HOME=`pwd`/android-ndk-r15c
60       export JAVA_HOME="/usr/lib/jvm/java-8-oracle"
61       export PATH="$ANDROID_NDK_HOME:$PATH"
62     fi
63   - |
64     if [[ "$CHECK_FORMAT" == "ON" && "$TRAVIS_PULL_REQUEST" != "false" ]]; then
65       # Install the clang format diff tool, but only for pull requests.
66       curl -L http://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format-diff.py -o scripts/clang-format-diff.py;
67     fi
68   # Misc setup
69   - |
70   - export core_count=$(nproc || echo 4) && echo core_count = $core_count
71   - set +e
72
73 script:
74   - set -e
75   - |
76     if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
77       # Get VulkanTools and build DevSim
78       mkdir -p external
79       cd external
80       git clone https://github.com/LunarG/VulkanTools.git
81       cd VulkanTools
82       # Get as little as possible from external sources
83       ./update_external_sources.sh --glslang --no-build
84       # Build as few components as possible
85       cmake -H. -Bbuild -DBUILD_LOADER=NO -DBUILD_TESTS=NO \
86           -DBUILD_LAYERS=NO -DBUILD_DEMOS=NO -DBUILD_VKTRACE=NO \
87           -DBUILD_VKJSON=NO -DBUILD_VIA=NO -DBUILD_ICD=NO
88       make -C build -j $core_count
89       cd ${TRAVIS_BUILD_DIR}
90     fi
91   - |
92     if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
93       # Build LVL
94       ./update_external_sources.sh
95       cmake -H. -Bdbuild -DCMAKE_BUILD_TYPE=Debug
96       make -C dbuild -j $core_count
97     fi
98   - |
99     if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
100       # Run Tests
101       (cd dbuild/tests; ./vkvalidatelayerdoc.sh)
102       export LD_LIBRARY_PATH=dbuild/loader:$LD_LIBRARY_PATH
103       export VK_LAYER_PATH=external/VulkanTools/build/layersvt:dbuild/layers
104       export VK_ICD_FILENAMES=dbuild/icd/VkICD_mock_icd.json
105       dbuild/tests/vk_layer_validation_tests
106       for profile in tests/device_profiles/*.json
107       do
108         echo Testing with profile $profile
109         VK_DEVSIM_FILENAME=$profile dbuild/tests/vk_layer_validation_tests --devsim
110       done
111     fi
112   - |
113     if [[ "$VULKAN_BUILD_TARGET" == "ANDROID" ]]; then
114       pushd build-android
115       ./update_external_sources_android.sh --abi $ANDROID_ABI --no-build
116       ./android-generate.sh
117       USE_CCACHE=1 NDK_CCACHE=ccache ndk-build APP_ABI=$ANDROID_ABI -j $core_count
118       popd
119     fi
120   - |
121     if [[ "$CHECK_FORMAT" == "ON" ]]; then
122       if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
123         # Run the clang format check only for pull request builds because the
124         # master branch is needed to do the git diff.
125         echo "Checking clang-format between TRAVIS_BRANCH=$TRAVIS_BRANCH and TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH"
126         ./scripts/check_code_format.sh
127       else
128         echo "Skipping clang-format check since this is not a pull request."
129       fi
130     fi
131   - |
132     if [[ "$CHECK_COMMIT_FORMAT" == "ON" ]]; then
133       if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
134         echo "Checking commit message formats:  See CONTRIBUTING.md"
135         ./scripts/check_commit_message_format.sh
136       fi
137     fi
138   - set +e
139
140 notifications:
141   email:
142     recipients:
143       - karl@lunarg.com
144       - cnorthrop@google.com
145       - tobine@google.com
146       - chrisforbes@google.com
147     on_success: change
148     on_failure: always