-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy path.travis.yml
205 lines (167 loc) · 4.78 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
language: cpp
notifications:
email: false
addons:
homebrew:
packages:
- sdl2
- giflib
- jasper
- jpeg-turbo
- jpeg-xl
- libavif
- libomp
- libpng
- libtiff
- resvg
- webp
apt:
packages:
- libavif-dev
- libgif-dev
- libjpeg-dev
- libpng-dev
- libsdl2-dev
- libtiff-dev
- libwebp-dev
update: true
jobs:
include:
- os: windows
name: "Windows Server"
env:
- PATH="/c/SAIL/bin:$PATH"
cache:
directories:
- extra/B
- os: linux
dist: jammy
name: "Ubuntu 22.04 Jammy"
- os: osx
osx_image: xcode14.2
name: "macOS 12.6"
env:
- CMAKE_PREFIX_PATH="/usr/local/opt/jpeg-turbo;$CMAKE_PREFIX_PATH"
- OpenMP_ROOT=/usr/local/opt/libomp
before_script:
- |-
case "$TRAVIS_OS_NAME" in
windows)
# Build non-existing extra libs
if [ -d extra/B/bin ]; then
extra_bin_time=$(stat -c %Y extra/B/bin)
build_script_time=$(git log --pretty=format:%cd -n 1 --date=unix --date-order -- extra/build)
if [ $build_script_time -gt $extra_bin_time ]; then
extra/build
fi
else
extra/build
fi
;;
linux)
# Workaround ASAN bug in Jammy
# See https://github.com/google/sanitizers/issues/1614
sudo sysctl vm.mmap_rnd_bits=28
;;
esac
script:
- |-
fail_on_error()
{
if [ $# -eq 0 ]; then
echo "Error: No arguments given for fail_on_error()" >&2
exit 1
fi
set -e
"$@"
set +e
}
test_external_windows()
{
local project_path="$1"
local sail_cmake_path="$2"
local build_type="$3"
local old_dir="$PWD"
echo
echo "External Windows Test '$project_path' '$build_type'"
echo
cd "$TRAVIS_BUILD_DIR"
cd "$project_path"
rm -rf build
mkdir build
cd build
fail_on_error cmake -A x64 -DSAIL_DEV=ON -DCMAKE_PREFIX_PATH="$sail_cmake_path" ..
fail_on_error cmake --build . --config $build_type
cd "$old_dir"
}
test_external_unix()
{
local project_path="$1"
local build_type="$2"
local exe="$3"
local old_dir="$PWD"
echo
echo "External Unix Test '$project_path' '$build_type'"
echo
cd "$TRAVIS_BUILD_DIR"
cd "$project_path"
rm -rf build
mkdir build
cd build
fail_on_error cmake -DSAIL_DEV=ON -DCMAKE_BUILD_TYPE="$build_type" ..
fail_on_error cmake --build .
fail_on_error "$exe"
cd "$old_dir"
}
build()
{
echo
echo " *** Building with $@ ***"
echo
local cmake_parallel_options="--parallel 2"
eval $@
cd "$TRAVIS_BUILD_DIR"
rm -rf build
mkdir build
cd build
case "$TRAVIS_OS_NAME" in
windows)
git -C .. apply .travis/disable-jpeg-test-files.patch
CMAKE_INSTALL_PREFIX="C:/SAIL"
fail_on_error cmake -A x64 -DBUILD_SHARED_LIBS="$BUILD_SHARED_LIBS" -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \
-DSAIL_DEV=ON -DSAIL_COMBINE_CODECS="$SAIL_COMBINE_CODECS" ..
fail_on_error cmake --build . --config $CMAKE_BUILD_TYPE $cmake_parallel_options --target install
cd tests
fail_on_error ctest -C $CMAKE_BUILD_TYPE --output-on-failure
fail_on_error "$CMAKE_INSTALL_PREFIX/bin/sail" --version
test_external_windows "tests/external/link/c" "$CMAKE_INSTALL_PREFIX/lib/cmake" "$CMAKE_BUILD_TYPE"
test_external_windows "tests/external/link/c++" "$CMAKE_INSTALL_PREFIX/lib/cmake" "$CMAKE_BUILD_TYPE"
rm -rf "$CMAKE_INSTALL_PREFIX"
;;
osx | linux)
CMAKE_INSTALL_PREFIX="/usr/local"
fail_on_error cmake -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \
-DBUILD_SHARED_LIBS="$BUILD_SHARED_LIBS" -DSAIL_DEV=ON -DSAIL_COMBINE_CODECS="$SAIL_COMBINE_CODECS" ..
fail_on_error cmake --build . $cmake_parallel_options
fail_on_error sudo make install
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
fail_on_error sudo ldconfig
fi
cd tests
fail_on_error ctest --output-on-failure
cd -
fail_on_error "$CMAKE_INSTALL_PREFIX/bin/sail" --version
test_external_unix "tests/external/link/c" "$CMAKE_BUILD_TYPE" "./external-c-api-link"
test_external_unix "tests/external/link/c++" "$CMAKE_BUILD_TYPE" "./external-c++-api-link"
xargs sudo rm -v < install_manifest.txt
;;
esac
}
# DEBUG, SHARED
build CMAKE_BUILD_TYPE=Debug BUILD_SHARED_LIBS=ON
# DEBUG, SHARED, COMBINED
build CMAKE_BUILD_TYPE=Debug BUILD_SHARED_LIBS=ON SAIL_COMBINE_CODECS=ON
# DEBUG, STATIC
if [ "$TRAVIS_OS_NAME" != "windows" ]; then
build CMAKE_BUILD_TYPE=Debug BUILD_SHARED_LIBS=OFF
fi