forked from KhronosGroup/KTX-Software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
350 lines (327 loc) · 12 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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# Copyright 2015-2020 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
# CI build script for Travis.
# See https://docs.travis-ci.com/user/multi-os/ for more info.
# If we specify both osx & linux here, we'll get osx & linux jobs for all the
# configurations under env.jobs. Since there are 3 environment variables
# common to all osx jobs, vs 1 for linux, we choose to use the global
# env. variables for osx and hence also env.jobs There are fewer linux jobs and fewer all-job
# environment variables so it is easier to explicitly specify the linux
# jobs.
os: osx
osx_image: xcode13.2
language: cpp
addons:
homebrew:
packages:
- git-lfs
- doxygen
- sdl2
#update: true
env:
global:
- BUILD_DIR: build
- CHECK_REUSE: NO
- FEATURE_TESTS: ON
- GIT_LFS_SKIP_SMUDGE: 1
- PACKAGE: NO
- REL_DESC_FILE: "$BUILD_DIR/rel_desc.md"
- VULKAN_SDK_VER: "1.2.176.1"
# This is just to tell the Vulkan install script where to install.
- VULKAN_INSTALL_DIR: "$HOME/VulkanSDK/$VULKAN_SDK_VER"
- VULKAN_SDK: "$VULKAN_INSTALL_DIR/macOS"
- WASM_BUILD: NO
jobs:
# FEATURE_TESTS is off for arm64 macOS because we can't even build
# them during CI. CI runs on x86_64 and there is a PostBuild command
# that attempts to execute the compiled-for-m1 tests to have gtest
# add the list of tests to the cmake test runner.
- CONFIGURATION=Debug,Release PLATFORM=macOS ARCHS=x86_64
FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_LOADTESTS=ON FEATURE_TOOLS=ON
SUPPORT_SSE=ON SUPPORT_OPENCL=OFF DEPLOY_DOCS=YES PACKAGE=YES
- CONFIGURATION=Release PLATFORM=macOS ARCHS=arm64
FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_LOADTESTS=ON FEATURE_TESTS=OFF
FEATURE_TOOLS=ON SUPPORT_SSE=ON SUPPORT_OPENCL=OFF PACKAGE=YES
- CONFIGURATION=Release PLATFORM=macOS ARCHS=x86_64
FEATURE_DOC=ON FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF FEATURE_TOOLS=OFF
SUPPORT_SSE=ON SUPPORT_OPENCL=ON
- CONFIGURATION=Release PLATFORM=macOS ARCHS=arm64
FEATURE_DOC=ON FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF FEATURE_TESTS=OFF
FEATURE_TOOLS=OFF SUPPORT_SSE=ON SUPPORT_OPENCL=ON
- CONFIGURATION=Release PLATFORM=macOS ARCHS=x86_64
FEATURE_DOC=ON FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF FEATURE_TOOLS=OFF
SUPPORT_SSE=OFF SUPPORT_OPENCL=ON
- CONFIGURATION=Release PLATFORM=macOS ARCHS=arm64
FEATURE_DOC=ON FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF FEATURE_TESTS=OFF
FEATURE_TOOLS=OFF SUPPORT_SSE=OFF SUPPORT_OPENCL=ON
- CONFIGURATION=Release PLATFORM=macOS ARCHS=x86_64
FEATURE_DOC=ON FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF FEATURE_TOOLS=OFF
SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF
- CONFIGURATION=Release PLATFORM=macOS ARCHS=arm64
FEATURE_DOC=ON FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF FEATURE_TESTS=OFF
FEATURE_TOOLS=OFF SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF
- CONFIGURATION=Debug,Release PLATFORM=iOS
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=ON FEATURE_TOOLS=OFF
SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF PACKAGE=YES
jobs:
include:
- os: linux
dist: focal
env:
- CHECK_REUSE: ONLY
- os: linux
dist: focal
compiler: gcc # clang is tested by macOS build
env:
# NB: This must not have the fourth component of the version number.
- VULKAN_SDK_VER: "1.2.176"
- CONFIGURATION=Debug
FEATURE_DOC=OFF FEATURE_JNI=ON FEATURE_LOADTESTS=ON FEATURE_TOOLS=ON
SUPPORT_SSE=ON SUPPORT_OPENCL=OFF
- os: linux
dist: focal
compiler: gcc
env:
# NB: This must not have the fourth component of the version number.
- VULKAN_SDK_VER: "1.2.176"
- CONFIGURATION=Release
FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_LOADTESTS=ON FEATURE_TOOLS=ON
SUPPORT_SSE=ON SUPPORT_OPENCL=OFF PACKAGE=YES
- os: linux
dist: focal
compiler: gcc
env:
- CONFIGURATION=Release
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF
FEATURE_TOOLS=OFF
SUPPORT_SSE=ON SUPPORT_OPENCL=ON PACKAGE=NO
- os: linux
dist: focal
compiler: gcc
env:
- CONFIGURATION=Release
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF
FEATURE_TOOLS=OFF
SUPPORT_SSE=OFF SUPPORT_OPENCL=ON PACKAGE=NO
- os: linux
dist: focal
compiler: gcc
env:
- CONFIGURATION=Release
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF
FEATURE_TOOLS=OFF
SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF PACKAGE=NO
- os: linux
dist: focal
compiler: clang
services: docker
env:
- WASM_BUILD=YES
- CONFIGURATION=Debug
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=ON
SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF
- os: linux
dist: focal
compiler: clang
services: docker
env:
- WASM_BUILD=YES
- CONFIGURATION=Release
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=ON
SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF PACKAGE=YES
# Phase 1: Git clone - done automatically.
# Phase 2: Install apt addons.
# Phase 3: Install cache components - Currently not using a cache
# then the following phases:
before_install:
- echo "Running on the following travis CI runner"
- uname -a
- echo "CMake version on the runner is"
- cmake --version
#- eval "${MATRIX_EVAL}"
- echo -e "machine github.com\n login $GITHUB_TOKEN" >> ~/.netrc # Prevent rate limiting on Git LFS.
- cat ~/.netrc
- |
case "${TRAVIS_OS_NAME:-linux}" in
linux)
if [ "$WASM_BUILD" = "YES" ]; then
# Need to set uid/gid because, unlike when running docker locally,
# /src ends up being owned by the uid/gid running this script and
# the recent fix for CVE-2022-24765 in Git causes Git to error
# when the repo owner differs from the user. For details see
# https://github.blog/2022-04-12-git-security-vulnerability-announced/
docker run -dit --name emscripten --user "$(id -u):$(id -g)" -v $(pwd):/src emscripten/emsdk bash
elif [ "$CHECK_REUSE" != "ONLY" ]; then
sudo apt-get update
fi
;;
esac
install:
- |
case "${TRAVIS_OS_NAME:-linux}" in
linux)
if [ "$CHECK_REUSE" = "YES" -o "$CHECK_REUSE" = "ONLY" ]; then
set -e # because the if below swallows a bad exit status.
pip3 install reuse
set +e
fi
if [ "$CHECK_REUSE" != "ONLY" -a "$WASM_BUILD" != "YES" ]; then
./ci_scripts/install_linux.sh
fi
;;
osx)
./ci_scripts/install_macos.sh
;;
esac
before_script:
- git fetch --unshallow --tags
- |
case "${TRAVIS_OS_NAME:-linux}" in
linux)
;;
osx)
./ci_scripts/before_build_macos.sh
;;
esac
# Make sure embedded dates are correct.
- ./install-gitconfig.sh
- rm TODO.md lib/mainpage.md pkgdoc/pages.md tools/toktx/toktx.cc
- git checkout TODO.md lib/mainpage.md pkgdoc/pages.md tools/toktx/toktx.cc
- git status
script:
- |
case "${TRAVIS_OS_NAME:-linux}" in
linux)
if [ "$CHECK_REUSE" = "YES" -o "$CHECK_REUSE" = "ONLY" ]; then
echo "Calling reuse lint."
set -e # because the if below swallows a bad exit status.
reuse lint
set +e
fi
if [ "$CHECK_REUSE" != "ONLY" ]; then
if [ "$WASM_BUILD" = "YES" ]; then
./ci_scripts/build_wasm_docker.sh
else
./ci_scripts/build_linux.sh
fi
fi
;;
osx)
if [ "$PLATFORM" = "macOS" ]; then
./ci_scripts/build_macos.sh
else
./ci_scripts/build_ios.sh
fi
;;
esac
# See if this helps with truncated logs.
#after_script:
# - sleep 10
after_failure:
- ./ci_scripts/on_failure.sh
# Errors in something run in after_success: don't cause the build to fail
# so don't use for anything important.
after_success:
# The settings of CUR_BUILD_DIR make in the build scripts are not being
# propagated to this script. Hardwire the directory with the current problem.
# - rurl=$(curl --upload-file ./build-macos-sse/Testing/Temporary/LastTest.log https://transfer.sh/ktx-last-test.log) ; echo $rurl
before_deploy:
- |
gem install octokit:'~> 4.15.0' mime-types
case "${TRAVIS_OS_NAME:-linux}" in
linux)
;;
osx)
# Only notarize if we're going to deploy. I.e on a tag. Also check for
# access to signing certs to make sure we don't try this on a fork which
# has a tag.
#
# Although undocumented, except for a blog post, before_deploy is run for
# each deployment so we need to take steps to prevent notarization being
# run twice. https://github.com/travis-ci/travis-ci/issues/2570 about
# this has been open for years. What a crock!
if [ -n "$MACOS_CERTIFICATES_P12" -a -n "$TRAVIS_TAG" -a -z "$NOTARIZED" ]; then
./ci_scripts/notarize.sh $BUILD_DIR/KTX-Software-*.pkg $APPLE_ID $DEVELOPMENT_TEAM $ALTOOL_PASSWORD; export NOTARIZED="true"
fi
;;
esac
if [ ! -f $REL_DESC_FILE -a -f RELEASE_NOTES.md ]; then
# Remove lines that are unnecessary in the context of a GitHub
# release description.
awk '/^Release Notes/,/^## Version/ { next }
! /<!-- Copyright/ && ! /<!-- SPDX/ { print }' RELEASE_NOTES.md \
> $REL_DESC_FILE
# dpl v2 alternative
#RELNOTES=$(awk '/^Release Notes/,/^## Version/ { next }
# ! /<!-- Copyright/ && ! /<!-- SPDX/ { print }' RELEASE_NOTES.md)
fi
deploy:
- provider: pages
edge: true # Use bleeding edge (dplv2)
token: $GITHUB_TOKEN # Set in the repo settings page as a secure variable
local_dir: $BUILD_DIR/docs/html
on:
#branch: master
tags: true
condition: $DEPLOY_DOCS = YES
# ----------------------- dpl v2 -------------------------
# dpl v2 releases provider is broken. Same named but different releases
# are created each time a job in the build triggers this deploy. This
# may be because draft is true and the GitHub API returns 404 when
# querying a draft release by name (you can only query by id) causing
# it to use create_release every time instead of update_release. Some
# of these releases are called "Draft". To avoid this name is specified
# here. See https://github.com/travis-ci/dpl/issues/1213.
# - provider: releases
# edge: true
# token: $GITHUB_TOKEN # Set in the repo settings page as a secure variable
# name: $TRAVIS_TAG
# file_glob: true
# file:
# - $BUILD_DIR/KTX-Software-*-*
# release_notes_file: REL_DESC_FILE.md
# #release_notes: $RELNOTES
# draft: true
# prerelease: true
# on:
# tags: true
# #branch: master
# condition: $PACKAGE = YES
# ----------------------- dpl v1 -------------------------
- provider: releases
token: $GITHUB_TOKEN # Set in the repo settings page as a secure variable
name: $TRAVIS_TAG
skip_cleanup: true
# We can't use
#body: $RELNOTES
# because a bug in v1's backing Ruby code does not allow passing it
# command line option arguments that contain newlines leading to an
# error on Travis when we try.
# See https://github.com/travis-ci/dpl/issues/155.
#
# The obvious workarounds of literal "\n" or "<br />" do not work.
# The text is passed to GitHub but "\n" is shown literally. While "<br />"
# causes a newline in the rendering, the markdown interpreter does not
# recognize it as an actual newline so never changes the format from
# the initial heading format.
#
# Since we can't use either this or v2 to deply the release notes, we've
# rolled our own provider script for the body.
file_glob: true
file:
- $BUILD_DIR/KTX-Software-*-*
draft: true
prerelease: true
on:
tags: true
#branch: master
condition: $PACKAGE = YES
- provider: script
edge: true
script: ruby ci_scripts/github_release.rb -s ${GITHUB_TOKEN} -r ${TRAVIS_REPO_SLUG} -c $REL_DESC_FILE -t ${TRAVIS_TAG} --draft true --prerelease true
on:
tags: true
#branch: master
condition: $PACKAGE = YES
# ---------------------------------------------------------
# vim:ai:ts=4:sts=2:sw=2:expandtab