-
Notifications
You must be signed in to change notification settings - Fork 294
331 lines (301 loc) · 14.4 KB
/
macos.yml
File metadata and controls
331 lines (301 loc) · 14.4 KB
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
# Copyright 2025 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
name: macOS & iOS CI
# Seems no way to avoid duplicating this on logic in each .yml file.
# See https://github.com/actions/starter-workflows/issues/245.
on:
# Trigger the workflow on a pull request,
pull_request:
push:
# And on pushes to main, which will occur when a PR is merged.
branches:
- main
# Also trigger on push of release tags to any branch. Useful
# for testing release builds before merging to main.
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
paths-ignore:
- .appveyor.yml
- .github/workflows/android.yml
- .github/workflows/check-libktx-only.yml
- .github/workflows/check-mkvk.yml
- .github/workflows/check-reuse.yml
- .github/workflows/docs.yml
- .github/workflows/formatting.yml
- .github/workflows/linux.yml
- .github/workflows/mingw.yml
- .github/workflows/publish-pyktx.yml
- .github/workflows/manual.yml
- .github/workflows/web.yml
- .github/workflows/windows.yml
- .travis.yml
- README.md
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- LICENSE.md
- LICENSES
- RELEASE_NOTES.md
- REUSE.toml
- install-gitconfig*
# Allow manual trigger
workflow_dispatch:
workflow_call:
jobs:
#formatting:
# uses: ./.github/workflows/formatting.yml
macos:
permissions:
packages: write
contents: write
# Shortcircuit and don't burn CI time when formatting will reject
#needs: formatting
strategy:
matrix:
os: [ macos-latest ]
generator: [ Xcode ]
arch: [ arm64 ]
vulkan_sdk_version: ['1.4.313.1']
options: [
{config: 'Debug,Release', platform: macOS,
doc: ON, jni: ON, loadtests: OpenGL+Vulkan, py: ON, tools: ON, tools_cts: ON,
package: YES, sse: ON, opencl: OFF},
{config: Release, platform: macOS,
doc: OFF, jni: OFF, loadtests: OFF, py: OFF, tools: OFF, tools_cts: OFF,
sse: ON, opencl: ON},
{config: Release, platform: macOS,
doc: OFF, jni: OFF, loadtests: OFF, py: OFF, tools: OFF, tools_cts: OFF,
sse: OFF, opencl: ON},
{config: Release, platform: macOS,
doc: OFF, jni: OFF, loadtests: OFF, py: OFF, tools: OFF, tools_cts: OFF,
sse: OFF, opencl: OFF}
]
exclude:
# Disable this when package: YES because the Python and Java interface
# libraries built for x86_64 will not run on arm64. Have not investigated
# why Rosetta does not work in this case.
- arch: x86_64
options: { package: YES }
include:
- name: Build x86_64 package on Intel runner
os: macos-15-intel
arch: x86_64
options: {
config: 'Debug,Release', platform: macOS,
doc: ON, jni: ON, loadtests: OpenGL+Vulkan, py: ON, tools: ON, tools_cts: ON,
package: YES, sse: ON, opencl: OFF
}
- name: Build for iOS
os: macos-latest
generator: Xcode
arch: arm64
options: {
config: Release, platform: iOS,
doc: OFF, jni: OFF, loadtests: OpenGL+Vulkan, py: OFF, tests: OFF, tools: OFF, tools_cts: OFF,
package: YES, sse: OFF, opencl: OFF
}
# ': ' within the format string causes a "mapping values are not
# allowed in this context" YAML syntax error. Replacement {1} is
# a workaround.
name: ${{ matrix.name && matrix.name || format('{0} ({1}) Package,SSE,OpenCL:{2}{3},{4},{5}', matrix.os, matrix.arch, ' ', matrix.options.package && matrix.options.package || 'NO', matrix.options.sse, matrix.options.opencl) }}
runs-on: ${{ matrix.os }}
env:
# To avoid bandwidth charges skip downloading source and golden images
# for texturetests etc., loadtests and legacy tool tests. They will be
# pulled later as necessary
GIT_LFS_SKIP_SMUDGE: 1
HOMEBREW_NO_AUTO_UPDATE: 1
APPLE_ID: ${{ secrets.APPLE_ID }}
DEVELOPMENT_TEAM: ${{ secrets.APPLE_DEVELOPMENT_TEAM }}
PKG_SIGN_IDENTITY: ${{ secrets.APPLE_PKG_SIGN_IDENTITY }}
CODE_SIGN_IDENTITY: ${{ secrets.APPLE_CODE_SIGN_IDENTITY }}
BUILD_DIR: build
REL_DESC_FILE: "build/rel_desc.md"
# Map test matrix elements to environmental variables, so that scripts launched from CI scripts may react to them.
# Some matrix variables have defaults if unspecified by the matrix
CMAKE_GEN: ${{ matrix.generator }}
ARCH: ${{ matrix.arch }} # iOS uses ARCH
ARCHS: ${{ matrix.arch }} # macOS uses ARCHS
CONFIGURATION: ${{ matrix.options.config }}
PLATFORM: ${{ matrix.options.platform }}
FEATURE_DOC: ${{ matrix.options.doc }}
FEATURE_JNI: ${{ matrix.options.jni }}
FEATURE_LOADTESTS: ${{ matrix.options.loadtests }}
FEATURE_PY: ${{ matrix.options.py }}
FEATURE_TESTS: ${{ matrix.options.tests && matrix.options.tests || 'ON' }}
FEATURE_TOOLS: ${{ matrix.options.tools }}
FEATURE_TOOLS_CTS: ${{ matrix.options.tools_cts }}
PACKAGE: ${{ matrix.options.package && matrix.options.package || 'NO' }}
SUPPORT_OPENCL: ${{ matrix.options.opencl }}
SUPPORT_SSE: ${{ matrix.options.sse }}
WASM_BUILD: ${{ matrix.options.wasm && matrix.options.wasm || 'OFF' }}
# Virtual env (ON) is needed because pre-installed python is "externally managed."
PY_USE_VENV: ${{ matrix.options.py.use_venv && matrix.options.py_use_venv || 'ON' }}
WERROR: ${{ matrix.options.werror && matrix.options.werror || 'ON' }}
# CC Handled by job step
# CXX Handled by job step
PYTHON_DIST_DIR: interface/python_binding/dist
VCPKG_INSTALL_OPTIONS: ${{ matrix.vcpkg_install_options && matrix.vcpkg_install_options || '' }}
VULKAN_SDK_VERSION: ${{ matrix.vulkan_sdk_version }}
# This is just to tell the Vulkan install script where to install.
# NOTE: Hardcoded $HOME expansion, due to 'env' context being unavailble in env:
VULKAN_INSTALL_DIR: /Users/runner/VulkanSDK/${{ matrix.vulkan_sdk_version }}
VULKAN_SDK: /Users/runner/VulkanSDK/${{ matrix.vulkan_sdk_version }}/macOS
steps:
- uses: actions/checkout@v4
with:
# Fetch all history to make sure tags are
# included (used for version creation)
fetch-depth: 0
- name: Add certificates to macOS keychain
env:
MACOS_CERTIFICATES_P12: ${{ secrets.MACOS_CERTIFICATES_P12 }}
MACOS_CERTIFICATES_PASSWORD: ${{ secrets.MACOS_CERTIFICATES_PASSWORD }}
ALTOOL_PASSWORD: ${{ secrets.ALTOOL_PASSWORD }}
ALTOOL_PW_LABEL: ${{ secrets.ALTOOL_PW_LABEL }}
run: ./scripts/before_build_macos.sh
- name: Force fetch provoking tag's annotation.
# Work around https://github.com/actions/checkout/issues/290.
if: github.ref_type == 'tag' && matrix.check_mkvk != 'ONLY'
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }}
- name: before_install
run: |
echo -n "Running on the following GitHub Actions CI runner: " && uname -a
echo -n "CMake version on the runner is " && cmake --version
- name: Install Doxygen
if: matrix.options.doc == 'ON'
uses: ssciwr/doxygen-install@v1
- name: Install Graphviz
if: matrix.options.doc == 'ON'
uses: ts-graphviz/setup-graphviz@v2
# Should a specific version of Python ever be wanted, use this.
# - name: Set up Python
# if: matrix.options.py == 'ON' && matrix.check_mkvk != 'ONLY'
# uses: actions/setup-python@v5
# with:
# python-version: '3.14'
# If the selected Python does not have virtualenv installed, use this.
# It is included currently in the runner's pre-installed Pythons.
#
# Note that the builds, via sdist and wheel, require a virtual env.
# regardless of whether the in-use Python is externally managed.
# Installing the explicit dependencies of pyktx only needs virtualenv
# and PY_USE_VENV: ON when Python is externally managed.
# - name: Install Python virtualenv
# if: matrix.options.py == 'ON' && matrix.check_mkvk != 'ONLY'
# run: pip install virtualenv
# A brute-force hack to enable installation of nuget on Intel runners.
# nuget, installed by Brew, requires Python 3.14 which Brew, naturally,
# tries to install as the runner has only 3.13 which was not installed
# by Brew leading to failure when Brew tries to update these links.
# Apple Silicon runners have Brew-installed 3.14.
- name: Remove Python links to enable Brew Install of nuget
if: matrix.options.loadtests != 'OFF' && matrix.os == 'macos-15-intel'
run: sudo rm -f /usr/local/bin/idle3 /usr/local/bin/idle3.13 /usr/local/bin/pip3 -> /Library/Frameworks/Python.framework/Versions/3.13/bin/pip3 /usr/local/bin/pip3.13 /usr/local/bin/pydoc3 /usr/local/bin/pydoc3.13 /usr/local/bin/python3 /usr/local/bin/python3-config /usr/local/bin/python3.13 /usr/local/bin/python3.13-config
- name: Install nuget and mono
# nuget & mono were removed from macos 15 runners because mono is
# unsupported and nuget needs mono. This will install both.
if: matrix.options.loadtests != 'OFF'
run: |
Echo "Python3 version $(python3 --version) is installed at $(which python3)"
which nuget || brew install nuget -q
- name: Run install script
run: ./scripts/install_macos.sh
- name: Export environment variables for vcpkg binary caching
if: matrix.options.loadtests != 'OFF'
# actions/github-script is used primarily because it is the only
# way to access VCPKG_INSTALLATION_ROOT outside of the runner's shell.
# Maintaining cross-platform access is desirable so the code can be
# easily copied to a multi-platform workflow. NUGET_FEED_URL is set
# here to keep the vcpkg cache environment variables together.
uses: actions/github-script@v7
with:
# JSON in use here. #<comments> in the script will break it.
# Pre-installed vcpkg location is indicated by a non-standard env.
# var.
script: |
core.exportVariable('VCPKG_ROOT', process.env.VCPKG_INSTALLATION_ROOT || '');
core.exportVariable('VCPKG_EXE', process.env.VCPKG_INSTALLATION_ROOT + '/vcpkg' || '');
core.exportVariable('NUGET_FEED_URL', 'https://nuget.pkg.github.com/KhronosGroup/index.json' || '');
- name: Add NuGet sources for vcpkg binary caching
if: matrix.options.loadtests != 'OFF'
env:
USERNAME: KhronosGroup
shell: bash
run: |
nuget sources add \
-Source "${{ env.NUGET_FEED_URL }}" \
-StorePasswordInClearText \
-Name GitHubPackages \
-UserName "${{ env.USERNAME }}" \
-Password "${{ secrets.GITHUB_TOKEN }}"
nuget setapikey "${{ secrets.GITHUB_TOKEN }}" \
-Source "${{ env.NUGET_FEED_URL }}"
- name: before_script
run: |
if [ "$FEATURE_TOOLS_CTS" = "ON" ]; then
git submodule update --init --recursive tests/cts
fi
if [ "$FEATURE_TESTS" = "ON" ]; then
git lfs pull --include=tests/resources
fi
# Make sure embedded dates are correct.
./install-gitconfig.sh
scripts/smudge_date.sh
- name: script
env:
VCPKG_BINARY_SOURCES: clear;nuget,${{ env.NUGET_FEED_URL }},readwrite
run: |
set -e # Instead of trying to chain everything together with &&
# otherwise subsequent commands will swallow bad exit status.
if [ "$PLATFORM" = "macOS" ]; then
./scripts/build_macos.sh
else
./scripts/build_ios.sh
fi
set +e
# Re. packaging, note that the build script only creates packages for
# the Release configuration. If this is changed work will be needed
# here to prevent failures from uploading same-named artifacts from both
# Release and Debug configs. Only uploading artifacts from macos-latest
# prevents the same failure with artifacts from builds on older OSes.
# Notarization can only run if secrets were set (upstream repo)
- name: Notarize
env:
ALTOOL_PASSWORD: ${{ secrets.ALTOOL_PASSWORD }}
ALTOOL_PW_LABEL: ${{ secrets.ALTOOL_PW_LABEL }}
if: matrix.options.platform == 'macOS' && matrix.options.package == 'YES' && env.APPLE_ID
run: ./scripts/notarize.sh $BUILD_DIR/KTX-Software-*.pkg $APPLE_ID $DEVELOPMENT_TEAM $ALTOOL_PASSWORD
- name: Prepare KTX artifacts
if: matrix.options.package == 'YES'
id: ktx-version
run: |
KTX_VERSION=`cat $BUILD_DIR/ktx.version`
echo "PACKAGE_NAME_SUFFIX=${KTX_VERSION}-${{matrix.options.platform}}-${{matrix.arch}}" >> $GITHUB_ENV
# For these artifact uploads, need to take care that only one CLangCL
# "package" job for each architecture produces artifacts. A second
# job would attempt to upload a same-named artifact.
- name: Upload artifact Install Package
if: matrix.options.package == 'YES' && (matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel')
uses: actions/upload-artifact@v4
with:
name: KTX-Software-${{env.PACKAGE_NAME_SUFFIX}}
path: ${{env.BUILD_DIR}}/KTX-Software-*-*
compression-level: 0 # Installer already compressed.
- name: Upload artifact pyktx
if: matrix.options.py == 'ON' && matrix.options.package == 'YES' && (matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel')
uses: actions/upload-artifact@v4
with:
name: pyktx-${{env.PACKAGE_NAME_SUFFIX}}
path: ${{env.BUILD_DIR}}/${{env.PYTHON_DIST_DIR}}
- name: Upload to Release
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag' && github.event_name == 'push' && matrix.options.package == 'YES' && (matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel')
with:
draft: true
prerelease: true
files: |
${{env.BUILD_DIR}}/KTX-Software-*-*
${{env.BUILD_DIR}}/${{env.PYTHON_DIST_DIR}}/pyktx-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}