-
Notifications
You must be signed in to change notification settings - Fork 218
/
.travis.yml
163 lines (147 loc) · 6.32 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
language: cpp
os:
- linux
# Use Ubuntu 18.04 LTS (Bionic) as the Linux testing environment.
dist: bionic
git:
depth: 1
branches:
only:
- /llvm_release_\d+$/
# From https://docs.travis-ci.com/user/customizing-the-build/#safelisting-or-blocklisting-branches
# "Note that safelisting also prevents tagged commits from being built.
# If you consistently tag your builds in the format v1.3 you can safelist them
# all with regular expressions, for example /^v\d+\.\d+(\.\d+)?(-\S*)?$/."
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
before_install:
- |
if [ $TRAVIS_OS_NAME == "linux" ]; then
curl -L "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add -
curl -L "https://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add -
curl -L "https://apt.kitware.com/keys/kitware-archive-latest.asc" | sudo apt-key add -
echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic main" | sudo tee -a ${TRAVIS_ROOT}/etc/apt/sources.list
echo "deb https://packages.lunarg.com/vulkan bionic main" | sudo tee -a ${TRAVIS_ROOT}/etc/apt/sources.list
echo "deb https://apt.kitware.com/ubuntu/ bionic main" | sudo tee -a ${TRAVIS_ROOT}/etc/apt/sources.list
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install \
llvm-${LLVM_VERSION}-dev \
libomp-${LLVM_VERSION}-dev \
clang-${LLVM_VERSION} \
spirv-tools \
cmake
fi
compiler:
- gcc
env:
global:
- MAKEFLAGS="-j2"
- LLVM_VERSION=16
matrix:
- BUILD_TYPE=Release BUILD_EXTERNAL=1 SHARED_LIBS=ON MAKE_TARGETS="" MAKE_TEST_TARGET="test"
- BUILD_TYPE=Debug BUILD_EXTERNAL=1 SHARED_LIBS=ON MAKE_TARGETS="" MAKE_TEST_TARGET="test"
- BUILD_TYPE=Release BUILD_EXTERNAL=0 SHARED_LIBS=ON MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
- BUILD_TYPE=Debug BUILD_EXTERNAL=0 SHARED_LIBS=ON MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
- BUILD_TYPE=Release BUILD_EXTERNAL=1 SHARED_LIBS=OFF MAKE_TARGETS="" MAKE_TEST_TARGET="test"
- BUILD_TYPE=Debug BUILD_EXTERNAL=1 SHARED_LIBS=OFF MAKE_TARGETS="" MAKE_TEST_TARGET="test"
- BUILD_TYPE=Release BUILD_EXTERNAL=0 SHARED_LIBS=OFF MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
- BUILD_TYPE=Debug BUILD_EXTERNAL=0 SHARED_LIBS=OFF MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
matrix:
include:
- os: osx
env: BUILD_TYPE=Release BUILD_EXTERNAL=0 MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
osx_image: xcode13
- os: osx
env: BUILD_TYPE=Debug BUILD_EXTERNAL=0 MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
osx_image: xcode13
- compiler: clang
env: BUILD_TYPE=Release BUILD_EXTERNAL=1 SHARED_LIBS=OFF MAKE_TARGETS="" MAKE_TEST_TARGET="test"
- compiler: clang
env: BUILD_TYPE=Debug BUILD_EXTERNAL=1 SHARED_LIBS=ON MAKE_TARGETS="" MAKE_TEST_TARGET="test"
- compiler: clang
env: BUILD_TYPE=Release BUILD_EXTERNAL=0 SHARED_LIBS=ON MAKE_TARGETS="llvm-spirv" MAKE_TEST_TARGET="check-llvm-spirv"
allow_failures:
- os: osx
fast_finish: true
script:
- |
if [ $BUILD_EXTERNAL == "0" ]; then
mkdir llvm-spirv
mv * llvm-spirv
git clone https://github.com/llvm/llvm-project --depth 1
git -C llvm-project log --oneline -1
mv llvm-spirv llvm-project/llvm-spirv
fi
- |
if [ $TRAVIS_OS_NAME == "osx" ]; then
wget -r --accept="*.tgz" --no-directories https://storage.googleapis.com/spirv-tools/badges/build_link_macos_clang_release.html
tar -xf install.tgz
sed -i '' -e 's|^prefix=\(.*\)|prefix='$PWD'/install|g' install/lib/pkgconfig/SPIRV-Tools.pc
export PKG_CONFIG_PATH=$PWD/install/lib/pkgconfig
fi
- mkdir build && cd build
- PATH=/usr/bin:$PATH
- |
if [ $BUILD_EXTERNAL == "1" ]; then
cmake .. \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DBUILD_SHARED_LIBS=${SHARED_LIBS} \
-DLLVM_BUILD_TOOLS=ON \
-DLLVM_EXTERNAL_LIT="/usr/lib/llvm-${LLVM_VERSION}/build/utils/lit/lit.py" \
-DLLVM_INCLUDE_TESTS=ON \
-DCMAKE_INSTALL_PREFIX=../install/ \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-G "Unix Makefiles"
else
BUILDDIR=$(pwd)
cmake ../llvm-project/llvm/ \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DBUILD_SHARED_LIBS=${SHARED_LIBS} \
-DLLVM_BUILD_TOOLS=ON \
-DLLVM_BUILD_TESTS=ON \
-DLLVM_INCLUDE_TESTS=ON \
-DSPIRV_SKIP_CLANG_BUILD=ON \
-DSPIRV_SKIP_DEBUG_INFO_TESTS=ON \
-DLLVM_LIT_ARGS="-sv --no-progress-bar" \
-DLLVM_EXTERNAL_PROJECTS="llvm-spirv" \
-DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=${BUILDDIR}/../llvm-project/llvm-spirv \
-DLLVM_ENABLE_PROJECTS="llvm-spirv" \
-G "Unix Makefiles"
ln -s /usr/lib/llvm-${LLVM_VERSION}/bin/clang bin/
fi
- make $MAKE_TARGETS && make $MAKE_TEST_TARGET && if [ $BUILD_EXTERNAL == "1" ]; then make install; fi
before_deploy:
# Travis CI relies on the tag name to push to the correct release.
# Tag the current master top of the tree as "dev-build".
# We must be very careful with "git push -f" and allow it ONLY
# for the "dev-build" tag!
- if [[ "${TRAVIS_BRANCH}" == "master" && -z "${TRAVIS_TAG}" ]]; then
export TRAVIS_TAG=dev-build;
git config --global user.name "Travis CI";
git config --global user.email "builds@travis-ci.org";
git tag -f ${TRAVIS_TAG};
git push -f https://${repo_token}@github.com/${TRAVIS_REPO_SLUG} --tags;
fi
# Create tarball for deployment
- echo ${TRAVIS_COMMIT} > ../install/version.txt;
- export TARBALL=SPIRV-LLVM-Translator-${TRAVIS_TAG}-${TRAVIS_OS_NAME}-${BUILD_TYPE}.zip;
- cd ../install && find . -print | zip -@ ${TARBALL};
deploy:
- provider: releases
api_key: ${repo_token}
on:
tags: true
condition: ${BUILD_EXTERNAL} == 1 && ${SHARED_LIBS} == ON && ${repo_token}
file: ${TARBALL}
skip_cleanup: true
overwrite: false
- provider: releases
api_key: ${repo_token}
on:
tags: false
branch: master
condition: ${BUILD_EXTERNAL} == 1 && ${SHARED_LIBS} == ON && ${repo_token}
file: ${TARBALL}
name: Latest development build $(date -u +'%F %R %Z')
skip_cleanup: true
overwrite: true
prerelease: true