forked from Sapd/HeadsetControl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
289 lines (271 loc) · 6.05 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#
# Configuration
#
language: c
dist: xenial
#
# Build Dependencies
#
before_script:
#
# Build Folder
#
- mkdir build
- cd build
#
# Update / Install CMake
#
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
mkdir -p external/cmake
pushd external/cmake
wget https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.sh
chmod +x cmake-*-Linux-x86_64.sh
./cmake-*-Linux-x86_64.sh --exclude-subdir --skip-license
export PATH="${PWD}/bin:$PATH"
popd
fi
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
if ! brew ls --version cmake &>/dev/null; then brew update; brew install cmake; fi
fi
#
# Before Install for Windows builds
#
before_install:
- |-
case $TRAVIS_OS_NAME in
windows)
[[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64
choco uninstall -y mingw
choco upgrade --no-progress -y msys2
export msys2='cmd //C RefreshEnv.cmd '
export msys2+='& set MSYS=winsymlinks:nativestrict '
export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
export mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --"
export msys2+=" -msys2 -c "\"\$@"\" --"
$msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-toolchain
## Install more MSYS2 packages from https://packages.msys2.org/base here
$msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-hidapi make git
taskkill //IM gpg-agent.exe //F # https://travis-ci.community/t/4967
export PATH=/C/tools/msys64/mingw64/bin:$PATH
;;
esac
before_cache:
- |-
case $TRAVIS_OS_NAME in
windows)
# https://unix.stackexchange.com/a/137322/107554
$msys2 pacman --sync --clean --noconfirm
;;
osx)
brew cleanup
;;
esac
cache:
directories:
- $HOME/AppData/Local/Temp/chocolatey
- /C/tools/msys64
- $HOME/Library/Caches/Homebrew
#
# Build Matrix
#
matrix:
include:
#
# Git Check
#
- os: linux
env:
- TEST="Git Check"
script:
- |
if [[ -n $(git diff --check HEAD^) ]]; then
echo "You must remove whitespace before submitting a pull request"
echo ""
git diff --check HEAD^
exit -1
fi
#
# Clang Format
#
- os: linux
env:
- TEST="Clang Format"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-6
- libhidapi-dev
script:
- cmake -DENABLE_CLANG_FORMAT=ON -DCMAKE_C_COMPILER="gcc-6" ..
- make
- make format
- |
if [[ -n $(git diff) ]]; then
echo "You must run make format before submitting a pull request"
echo ""
git diff
exit -1
fi
#
# Clang Tidy
#
- os: linux
env:
- TEST="Clang Tidy"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
- clang-9
- clang-tidy-9
- libhidapi-dev
script:
- cmake -DENABLE_CLANG_TIDY=ON -DCMAKE_C_COMPILER="clang-9" ..
- make
- make tidy > output.txt
- |
if [[ -n $(grep "warning: " output.txt) ]] || [[ -n $(grep "error: " output.txt) ]]; then
echo "You must pass the clang tidy checks before submitting a pull request"
echo ""
grep --color -E '^|warning: |error: ' output.txt
exit -1;
else
echo -e "\033[1;32m\xE2\x9C\x93 passed:\033[0m $1";
fi
#
# GCC 7
#
- os: linux
env:
- TEST="GCC 7"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-8
- libhidapi-dev
script:
- cmake -DCMAKE_C_COMPILER="gcc-8" ..
- make
- make test
#
# GCC 8
#
- os: linux
env:
- TEST="GCC 8"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-8
- libhidapi-dev
script:
- cmake -DCMAKE_C_COMPILER="gcc-8" ..
- make
- make test
#
# GCC 9
#
- os: linux
env:
- TEST="GCC 9"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-9
- libhidapi-dev
script:
- cmake -DCMAKE_C_COMPILER="gcc-9" ..
- make
- make test
#
# Clang 7
#
- os: linux
env:
- TEST="Clang 7"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-7
packages:
- clang-7
- libhidapi-dev
script:
- cmake -DCMAKE_C_COMPILER=clang-7 ..
- make
- make test
#
# Clang 8
#
- os: linux
env:
- TEST="Clang 8"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-8
packages:
- clang-8
- libhidapi-dev
script:
- cmake -DCMAKE_C_COMPILER=clang-8 ..
- make
- make test
#
# Clang 9
#
- os: linux
env:
- TEST="Clang 9"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
- clang-9
- libhidapi-dev
script:
- cmake -DCMAKE_C_COMPILER=clang-9 ..
- make
- make test
#
# XCode 11.3
#
- os: osx
env:
- TEST="XCode 11.3"
osx_image: xcode11.3
script:
- cmake ..
- make
- make test
addons:
homebrew:
packages:
- hidapi
#
# Windows via msys2 (mingw 64-bit)
#
- os: windows
env:
- TEST="Windows (msys2, mingw64)"
script:
- $mingw64 cmake -G"MSYS Makefiles" ..
- $mingw64 make
- $mingw64 make test