Skip to content

Commit 520dc8f

Browse files
Linux and MacOS workflows (#1004)
Port Linux, macOS and web workflows from Travis to GitHub Actions. Splits the Travis workflow into separate Linux, iOS & macOS, web and check-reuse workflows. Adds a new `manual` workflow for requesting build of all platforms. Incorporates PR #1010 for fixes to build CMake 3.29+ as runners have recent CMake versions. Co-authored-by: Mark Callow <[email protected]>
1 parent 70ed9b9 commit 520dc8f

16 files changed

+862
-514
lines changed

.github/workflows/android.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ on:
3939

4040
# Allow manual trigger
4141
workflow_dispatch:
42+
workflow_call:
4243

4344
jobs:
4445
linux:

.github/workflows/check-reuse.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2015-2020 The Khronos Group Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
name: KTX-Software Check reuse CI
4+
5+
# Seems no way to avoid duplicating this on logic in each .yml file.
6+
# See https://github.com/actions/starter-workflows/issues/245.
7+
on:
8+
# Trigger the workflow on a pull request,
9+
pull_request:
10+
11+
push:
12+
# And on pushes to main, which will occur when a PR is merged.
13+
branches:
14+
- main
15+
# Also trigger on push of release tags to any branch. Useful
16+
# for testing release builds before merging to main.
17+
tags:
18+
- 'v[0-9]+.[0-9]+.[0-9]+'
19+
- 'v[0-9]+.[0-9]+.[0-9]+-*'
20+
21+
# Allow manual trigger
22+
workflow_dispatch:
23+
24+
jobs:
25+
check-reuse:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: REUSE Compliance Check
33+
uses: fsfe/reuse-action@v5
34+

.github/workflows/linux.yml

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
# Copyright 2025 The Khronos Group Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
name: KTX-Software Linux CI
4+
5+
# Seems no way to avoid duplicating this on logic in each .yml file.
6+
# See https://github.com/actions/starter-workflows/issues/245.
7+
on:
8+
# Trigger the workflow on a pull request,
9+
pull_request:
10+
11+
push:
12+
# And on pushes to main, which will occur when a PR is merged.
13+
branches:
14+
- main
15+
# Also trigger on push of release tags to any branch. Useful
16+
# for testing release builds before merging to main.
17+
tags:
18+
- 'v[0-9]+.[0-9]+.[0-9]+'
19+
- 'v[0-9]+.[0-9]+.[0-9]+-*'
20+
paths-ignore:
21+
- .appveyor.yml
22+
- .github/workflows/android.yml
23+
- .github/workflows/check-mkvk.yml
24+
- .github/workflows/docs.yml
25+
- .github/workflows/formatting.yml
26+
- .github/workflows/publish-pyktx.yml
27+
- .github/workflows/windows.yml
28+
- .travis.yml
29+
- README.md
30+
- CODE_OF_CONDUCT.md
31+
- CONTRIBUTING.md
32+
- LICENSE.md
33+
- LICENSES
34+
- RELEASE_NOTES.md
35+
- REUSE.toml
36+
- install-gitconfig*
37+
# Allow manual trigger
38+
workflow_dispatch:
39+
workflow_call:
40+
41+
jobs:
42+
#formatting:
43+
# uses: ./.github/workflows/formatting.yml
44+
linux:
45+
# Shortcircuit and don't burn CI time when formatting will reject
46+
#needs: formatting
47+
strategy:
48+
matrix:
49+
include:
50+
- name: Default
51+
os: ubuntu-22.04
52+
generator: Ninja
53+
arch: x86_64
54+
compiler: gcc
55+
vk_sdk_ver: '1.3.290'
56+
options: {
57+
config: Debug,
58+
doc: OFF, jni: ON, loadtests: OpenGL+Vulkan, py: ON, tools: ON, tools_cts: ON,
59+
sse: ON, opencl: OFF
60+
}
61+
- name: Package (x86_64)
62+
os: ubuntu-22.04
63+
generator: Ninja
64+
arch: x86_64
65+
compiler: gcc
66+
vk_sdk_ver: '1.3.290'
67+
options: {
68+
config: Release,
69+
doc: ON, jni: ON, loadtests: OpenGL+Vulkan, py: ON, tools: ON, tools_cts: ON,
70+
package: YES, sse: ON, opencl: OFF
71+
}
72+
- name: Package (aarch64)
73+
os: ubuntu-22.04-arm
74+
generator: Ninja
75+
arch: aarch64
76+
compiler: gcc
77+
vk_sdk_ver: '1.3.290'
78+
options: {
79+
config: Release,
80+
doc: ON, jni: ON, loadtests: OpenGL, py: ON, tools: ON, tools_cts: ON,
81+
package: YES, sse: OFF, opencl: OFF
82+
}
83+
- name: OpenCL,SSE
84+
os: ubuntu-22.04
85+
generator: Ninja
86+
arch: x86_64
87+
compiler: gcc
88+
vk_sdk_ver: '1.3.290'
89+
options: {
90+
config: Release,
91+
doc: OFF, jni: OFF, loadtests: OFF, py: OFF, tools: OFF, tools_cts: OFF,
92+
sse: ON, opencl: ON
93+
}
94+
- name: OpenCL
95+
os: ubuntu-22.04
96+
generator: Ninja
97+
arch: x86_64
98+
compiler: gcc
99+
vk_sdk_ver: '1.3.290'
100+
options: {
101+
config: Release,
102+
doc: OFF, jni: OFF, loadtests: OFF, py: OFF, tools: OFF, tools_cts: OFF,
103+
sse: OFF, opencl: ON
104+
}
105+
- name: All OFF
106+
os: ubuntu-22.04
107+
generator: Ninja
108+
arch: x86_64
109+
compiler: gcc
110+
vk_sdk_ver: '1.3.290'
111+
options: {
112+
config: Release,
113+
doc: OFF, jni: OFF, loadtests: OFF, py: OFF, tools: OFF, tools_cts: OFF,
114+
sse: OFF, opencl: OFF
115+
}
116+
117+
name: ${{ matrix.name && matrix.name || format('{0} SSE,OpenCL:{1},{2}', matrix.os, matrix.options.sse, matrix.options.opencl) }}
118+
runs-on: ${{ matrix.os }}
119+
env:
120+
GIT_LFS_SKIP_SMUDGE: 1
121+
122+
BUILD_DIR: build
123+
REL_DESC_FILE: "build/rel_desc.md"
124+
125+
# Map test matrix elements to environmental variables, so that scripts launched from CI scripts may react to them.
126+
# Some matrix variables have defaults if unspecified by the matrix
127+
CMAKE_GEN: ${{ matrix.generator }}
128+
ARCH: ${{ matrix.arch }}
129+
CONFIGURATION: ${{ matrix.options.config }}
130+
PLATFORM: ${{ matrix.options.platform }}
131+
FEATURE_DOC: ${{ matrix.options.doc }}
132+
FEATURE_JNI: ${{ matrix.options.jni }}
133+
FEATURE_LOADTESTS: ${{ matrix.options.loadtests }}
134+
FEATURE_PY: ${{ matrix.options.py }}
135+
FEATURE_TESTS: ${{ matrix.options.tests && matrix.options.tests || 'ON' }}
136+
FEATURE_TOOLS: ${{ matrix.options.tools }}
137+
FEATURE_TOOLS_CTS: ${{ matrix.options.tools_cts }}
138+
PACKAGE: ${{ matrix.options.package && matrix.options.package || 'NO' }}
139+
SUPPORT_OPENCL: ${{ matrix.options.opencl }}
140+
SUPPORT_SSE: ${{ matrix.options.sse }}
141+
WERROR: ${{ matrix.options.werror && matrix.options.werror || 'ON' }}
142+
# CC Handled by job step
143+
# CXX Handled by job step
144+
145+
PYTHON_DIST_DIR: interface/python_binding/dist
146+
147+
VULKAN_SDK_VER: ${{ matrix.vk_sdk_ver }}
148+
149+
steps:
150+
- uses: actions/checkout@v4
151+
with:
152+
# Fetch all history to make sure tags are
153+
# included (used for version creation)
154+
fetch-depth: 0
155+
156+
- name: Set compiler
157+
if: matrix.compiler
158+
run: |
159+
if [ "${{ matrix.compiler }}" = "gcc" ]; then
160+
echo "CC=gcc" >> $GITHUB_ENV
161+
echo "CXX=g++" >> $GITHUB_ENV
162+
elif [ "${{ matrix.compiler }}" = "clang" ]; then
163+
echo "CC=clang" >> $GITHUB_ENV
164+
echo "CXX=clang++" >> $GITHUB_ENV
165+
else
166+
echo "Unknown compiler toolchain set"
167+
exit 1
168+
fi
169+
170+
- name: before_install
171+
run: |
172+
echo -n "Running on the following GitHub Actions CI runner: " && uname -a
173+
echo -n "CMake version on the runner is " && cmake --version
174+
echo -e "machine github.com\n login $GITHUB_TOKEN" >> ~/.netrc # Prevent rate limiting on Git LFS.
175+
cat ~/.netrc
176+
sudo apt-get update
177+
178+
- name: install
179+
run: |
180+
echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
181+
./scripts/install_linux.sh
182+
183+
- name: Set up Python 3.11
184+
if: matrix.options.py == 'ON'
185+
uses: actions/setup-python@v5
186+
with:
187+
python-version: '3.11.4'
188+
189+
- name: before_script
190+
run: |
191+
if [ "$FEATURE_TOOLS_CTS" = "ON" ]; then
192+
git submodule update --init --recursive tests/cts
193+
fi
194+
# Make sure embedded dates are correct.
195+
./install-gitconfig.sh
196+
scripts/smudge_date.sh
197+
198+
- name: script
199+
run: |
200+
./scripts/build_linux.sh
201+
202+
- name: Sanitize release notes
203+
if: matrix.options.package == 'YES' && github.event_name == 'push' && github.ref_type == 'tag'
204+
run: |
205+
if [ ! -f $REL_DESC_FILE -a -f RELEASE_NOTES.md ]; then
206+
# Remove lines that are unnecessary in the context of a GitHub
207+
# release description.
208+
awk '/^Release Notes/,/^## Version/ { next }
209+
! /<!-- Copyright/ && ! /<!-- SPDX/ { print }' RELEASE_NOTES.md \
210+
> $REL_DESC_FILE
211+
fi
212+
213+
- name: Prepare KTX artifacts
214+
if: matrix.options.package == 'YES'
215+
id: ktx-version
216+
run: |
217+
KTX_VERSION=`cat $BUILD_DIR/ktx.version`
218+
echo "PACKAGE_NAME_SUFFIX=${KTX_VERSION}-${{runner.os}}-${{matrix.arch}}" >> $GITHUB_ENV
219+
220+
# For these artifact uploads, need to take care that only one CLangCL
221+
# "package" job for each architecture produces artifacts. A second
222+
# job would attempt to upload a same-named artifact.
223+
- name: Upload artifact Install Package
224+
if: matrix.options.package == 'YES'
225+
uses: actions/upload-artifact@v4
226+
with:
227+
name: KTX-Software-${{env.PACKAGE_NAME_SUFFIX}}
228+
path: ${{env.BUILD_DIR}}/KTX-Software-*-*
229+
compression-level: 0 # Installer already compressed.
230+
231+
- name: Upload artifact pyktx
232+
if: matrix.options.package == 'YES' && matrix.options.py == 'ON'
233+
uses: actions/upload-artifact@v4
234+
with:
235+
name: pyktx-${{env.PACKAGE_NAME_SUFFIX}}
236+
path: ${{env.BUILD_DIR}}/${{env.PYTHON_DIST_DIR}}
237+
238+
- name: Upload to Release
239+
uses: softprops/action-gh-release@v2
240+
if: matrix.options.package == 'YES' && github.event_name == 'push' && github.ref_type == 'tag'
241+
with:
242+
draft: true
243+
prerelease: true
244+
files: |
245+
${{env.BUILD_DIR}}/KTX-Software-*-*
246+
${{env.BUILD_DIR}}/${{env.PYTHON_DIST_DIR}}/pyktx-*
247+
body_path: ${{env.REL_DESC_FILE}}
248+
env:
249+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)