-
Notifications
You must be signed in to change notification settings - Fork 231
/
.travis.yml
452 lines (426 loc) · 16.7 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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# 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: xcode14.2
language: cpp
addons:
homebrew:
update: false
packages:
- git-lfs
cache:
directories:
- $HOME/.cache/vcpkg/archives
env:
global:
- BUILD_DIR: build
- CHECK_MKVK: NO
- CHECK_REUSE: NO
- FEATURE_TESTS: ON
- GIT_LFS_SKIP_SMUDGE: 1
- HOMEBREW_NO_AUTO_UPDATE: 1
- PACKAGE: NO
- REL_DESC_FILE: "$BUILD_DIR/rel_desc.md"
- VULKAN_SDK_VER: "1.3.290.0"
# 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
- WERROR: ON
jobs:
# NOTE: As least 2 configurations must be present or no macOS job is run.
# 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.
#
# FEATURE_PY is off for arm64 macOS because we'd need a cross-compiled version
# of Python for it to correctly build the Python extensions (the CI
# runs on x86_64)
- CONFIGURATION=Debug,Release PLATFORM=macOS ARCHS=x86_64
FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_PY=ON FEATURE_LOADTESTS=OpenGL+Vulkan FEATURE_TOOLS=ON
FEATURE_TOOLS_CTS=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_PY=OFF FEATURE_LOADTESTS=OpenGL+Vulkan FEATURE_TESTS=OFF
FEATURE_TOOLS=ON FEATURE_TOOLS_CTS=OFF SUPPORT_SSE=ON SUPPORT_OPENCL=OFF PACKAGE=YES
- CONFIGURATION=Release PLATFORM=macOS ARCHS=x86_64
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OFF FEATURE_TOOLS=OFF
FEATURE_TOOLS_CTS=OFF SUPPORT_SSE=ON SUPPORT_OPENCL=ON
- CONFIGURATION=Release PLATFORM=macOS ARCHS=arm64
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OFF FEATURE_TESTS=OFF
FEATURE_TOOLS=OFF FEATURE_TOOLS_CTS=OFF SUPPORT_SSE=ON SUPPORT_OPENCL=ON
- CONFIGURATION=Release PLATFORM=macOS ARCHS=x86_64
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OFF FEATURE_TOOLS=OFF
FEATURE_TOOLS_CTS=OFF SUPPORT_SSE=OFF SUPPORT_OPENCL=ON
- CONFIGURATION=Release PLATFORM=macOS ARCHS=arm64
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OFF FEATURE_TESTS=OFF
FEATURE_TOOLS=OFF FEATURE_TOOLS_CTS=OFF SUPPORT_SSE=OFF SUPPORT_OPENCL=ON
- CONFIGURATION=Release PLATFORM=macOS ARCHS=x86_64
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OFF FEATURE_TOOLS=OFF
FEATURE_TOOLS_CTS=OFF SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF
- CONFIGURATION=Release PLATFORM=macOS ARCHS=arm64
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OFF FEATURE_TESTS=OFF
FEATURE_TOOLS=OFF FEATURE_TOOLS_CTS=OFF SUPPORT_SSE=OFF
SUPPORT_OPENCL=OFF
- CONFIGURATION=Debug,Release PLATFORM=iOS
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OpenGL+Vulkan FEATURE_TOOLS=OFF
FEATURE_TOOLS_CTS=OFF SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF PACKAGE=YES
jobs:
include:
- os: linux
dist: jammy
env:
- CHECK_REUSE: ONLY
- os: linux
dist: jammy
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.3.290"
- CMAKE_GEN: Ninja
- CONFIGURATION=Debug
FEATURE_DOC=OFF FEATURE_JNI=ON FEATURE_PY=ON FEATURE_LOADTESTS=OpenGL+Vulkan FEATURE_TOOLS=ON
SUPPORT_SSE=ON SUPPORT_OPENCL=OFF WERROR=ON
- os: linux
dist: jammy
addons:
apt:
packages:
- graphviz
compiler: gcc
#jdk: openjdk17 # Reminder to find correct way to select jdk 17
env:
# NB: This must not have the fourth component of the version number.
- VULKAN_SDK_VER: "1.3.290"
- CMAKE_GEN: Ninja
- CONFIGURATION=Release
FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_PY=ON FEATURE_LOADTESTS=OpenGL+Vulkan FEATURE_TOOLS=ON FEATURE_TOOLS_CTS=ON
SUPPORT_SSE=ON SUPPORT_OPENCL=OFF WERROR=ON PACKAGE=YES
- os: linux
arch: arm64
dist: jammy
# Suggested by Travis-CI support to workaround pyparser install
# failure due to no permission to write to system packages with
# 2024.6.25 runner image. Forces use of previous runner version.
group: previous
addons:
apt:
packages:
- graphviz
compiler: gcc
#jdk: openjdk17
env:
# NB: This must not have the fourth component of the version number.
- VULKAN_SDK_VER: "1.3.290"
- CMAKE_GEN: Ninja
- CONFIGURATION=Release
FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_PY=ON FEATURE_LOADTESTS=OpenGL
FEATURE_TOOLS=ON FEATURE_TOOLS_CTS=ON
SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF WERROR=ON PACKAGE=YES
- os: linux
dist: jammy
compiler: gcc
env:
- CMAKE_GEN: Ninja
- CONFIGURATION=Release
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OFF
FEATURE_TOOLS=OFF FEATURE_TOOLS_CTS=OFF
SUPPORT_SSE=ON SUPPORT_OPENCL=ON WERROR=ON PACKAGE=NO
- os: linux
dist: jammy
compiler: gcc
env:
- CMAKE_GEN: Ninja
- CONFIGURATION=Release
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OFF
FEATURE_TOOLS=OFF FEATURE_TOOLS_CTS=OFF
SUPPORT_SSE=OFF SUPPORT_OPENCL=ON WERROR=ON PACKAGE=NO
- os: linux
dist: jammy
compiler: gcc
env:
- CMAKE_GEN: Ninja
- CONFIGURATION=Release
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OFF
FEATURE_TOOLS=OFF FEATURE_TOOLS_CTS=OFF
SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF WERROR=ON PACKAGE=NO
- os: linux
dist: jammy
compiler: clang
services: docker
env:
- WASM_BUILD=YES
- CONFIGURATION=Debug
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OpenGL
SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF WERROR=ON
- os: linux
dist: jammy
compiler: clang
services: docker
env:
- WASM_BUILD=YES
- CONFIGURATION=Release
FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_PY=OFF FEATURE_LOADTESTS=OpenGL
SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF WERROR=ON 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 -n "Running on the following travis CI runner: " && uname -a
- |
echo -n "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" -a "$CHECK_MKVK" != "ONLY" ]; then
sudo apt-get update
fi
;;
osx)
if [[ -n "$FEATURE_LOADTESTS" && "$FEATURE_LOADTESTS" != "OFF" ]]; then
# Install vcpkg.
pushd $HOME
git clone https://github.com/microsoft/vcpkg
cd vcpkg && ./bootstrap-vcpkg.sh -disableMetrics && export VCPKG_ROOT=$(pwd)
popd
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.
# reuse available via `apt install reuse` is very old: 0.14.0.
# Therefore install via pip. Version today, 2024.7.9, is 4.0.3.
pip3 install reuse
set +e
fi
if [ "$CHECK_REUSE" != "ONLY" -a "$CHECK_MKVK" != "ONLY" -a "$WASM_BUILD" != "YES" ]; then
if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then
# JDK was not installed on arm64 runner. Kept for reference.
#sudo apt-get -qq install openjdk-17-jdk
# Must be manually set. Setting JAVA_HOME might be an alternative.
#sudo ln -s -f /usr/lib/jvm/java-1.17.0-openjdk-arm64 /usr/lib/jvm/default-java
# Runner now has JDK but is not setting JAVA_HOME or default-java.
# Delete this when fixed.
export JAVA_HOME=/usr/lib/jvm/temurin-11-jdk-arm64
fi
echo "JAVA_HOME = $JAVA_HOME"
echo "/usr/lib/jvm"
ls -l /usr/lib/jvm
echo "/usr/local/lib/jvm"
ls -l /usr/local/lib/jvm
./scripts/install_linux.sh
fi
;;
osx)
if [ "$CHECK_REUSE" != "ONLY" -a "$CHECK_MKVK" != "ONLY" ]; then
if [ "$FEATURE_DOC" = "ON" ]; then
brew install doxygen
brew install graphviz
fi
./scripts/install_macos.sh
fi
;;
esac
before_script:
- git fetch --unshallow --tags
- |
case "${TRAVIS_OS_NAME:-linux}" in
linux)
;;
osx)
./scripts/before_build_macos.sh
;;
esac
- |
if [ "$FEATURE_TOOLS_CTS" = "ON" ]; then
git submodule update --init --recursive tests/cts
fi
# Make sure embedded dates are correct.
- ./install-gitconfig.sh
- scripts/smudge_date.sh
script:
- |
set -e # Instead of trying to chain everything together with &&
# otherwise subsequent commands will swallow bad exit status.
case "${TRAVIS_OS_NAME:-linux}" in
linux)
if [ "$CHECK_REUSE" = "YES" -o "$CHECK_REUSE" = "ONLY" ]; then
echo "Calling reuse lint."
reuse lint
fi
if [ "$CHECK_REUSE" != "ONLY" -a "$CHECK_MKVK" != "ONLY" ]; then
if [ "$WASM_BUILD" = "YES" ]; then
./scripts/build_wasm_docker.sh
else
./scripts/build_linux.sh
fi
fi
;;
osx)
if [ "$CHECK_REUSE" != "ONLY" -a "$CHECK_MKVK" != "ONLY" ]; then
if [ "$PLATFORM" = "macOS" ]; then
./scripts/build_macos.sh
else
./scripts/build_ios.sh
fi
fi
;;
esac
if [ "$CHECK_MKVK" = "ONLY" ]; then
scripts/check_mkvk.sh
fi
if [ "$DEPLOY_DOCS" = "YES" ]; then
# Some files in the pyktx docs have an _ prefix so Jekyll will
# not copy them from the gh-pages branch to the website. This
# file says no Jekyll files here. Treat all as ordinary files.
touch $BUILD_DIR/docs/html/.nojekyll
fi
set +e
# See if this helps with truncated logs.
#after_script:
# - sleep 10
after_failure:
- ./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
./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 -------------------------
##### Not working on jammy runners at present. Do everything via our script.
# - 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" && $TRAVIS_TAG =~ ^v[0-9].*
- provider: script
edge: true
# nullglob is to force a null string when there are no *.whl files.
script: ruby scripts/github_release.rb -s ${GITHUB_TOKEN} -r ${TRAVIS_REPO_SLUG} -c $REL_DESC_FILE -t ${TRAVIS_TAG} --overwrite true --draft true --prerelease true $BUILD_DIR/KTX-Software-*-*
on:
tags: true
#branch: master
condition: $PACKAGE = "YES" && $TRAVIS_TAG =~ ^v[0-9].*
# Separate deploy for pyktx because the linux runners use sh not bash
# for the "script" so `shopt -s nullglob; scripts/github_release.rb ...`
# does not work to avoid passing `.../*.whl` to github_release when
# FEATURE_PY not ON.
- provider: script
edge: true
script: ruby scripts/github_release.rb -s ${GITHUB_TOKEN} -r ${TRAVIS_REPO_SLUG} -c $REL_DESC_FILE -t ${TRAVIS_TAG} --overwrite true --draft true --prerelease true $BUILD_DIR/interface/python_binding/dist/*.whl
on:
tags: true
#branch: master
condition: $PACKAGE = "YES" && $TRAVIS_TAG =~ ^v[0-9].* && $FEATURE_PY = "ON"
# ---------------------------------------------------------
# vim:ai:ts=4:sts=2:sw=2:expandtab