Skip to content

Commit bc8d0c2

Browse files
authored
Add workflow to check determinism (#1164)
A manually dispatched workflow to that runs the CTS, set to require exact matches to golden files, on macOS, Ubuntu and Windows using arm64 and x86_86 processors, with ktx and libktx compiled with clang and gcc and, in addition, on macOS AppleClang and on Windows ClangCL and msvc. Of necessity to avoid a build failure on the macos-15-intel runner, update the version of zstd included in external/basis_universal/zstd. The failure arose due to a combination of three factors: zstd_errors.h was not in `external/basis_universal/zstd` but in `other_Include` which is marked as a system directory; macos-15-intel has a newer version installed in `/usr/local/include` which omits declaration of a function _libktx_ uses; the AppleClang version on that runner was searching `/usr/local/include` before directories specified with `-isystem`, in what looks like a bug. The updated version, from basis_universal 2.0, declares the function that _libktx_ uses in `zstd.h`. Furthermore it includes `zstd_errors.h` in the same directory nullifying the `-isystem` and conflicting version problems.
1 parent b516347 commit bc8d0c2

7 files changed

Lines changed: 47496 additions & 29135 deletions

File tree

.github/workflows/check-determinism.yml

Lines changed: 67 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,102 @@
33
name: Check Determinism of Encoder Results Across Plaforms and Compilers
44

55
# The purpose of this is to show whether the encoding results are
6-
# deterministic across platforms and compilers. Do this by building
7-
# and running the library and tools then running the CTS with an
8-
# option set so it will expect an exact match and won't use ktxdiff.
6+
# deterministic across platforms and compilers. It does this by building
7+
# the library and tools then running the CTS with an option set that
8+
# requires an exact match and won't use ktxdiff.
9+
#
10+
# The test is run across macOS, Ubuntu and Windows on both arm64 and x86_64
11+
# processors using ktx and libktx compiled with clang and gcc. They are,
12+
# in addition, compiled with AppleClang on macOS and with ClangCL and msvc
13+
# on Windows.
914

1015
on:
1116
workflow_dispatch:
1217

18+
# macOS runners: clang 17, clang 18 available on $(brew --prefix llvm@18)/bin/clang & gcc-{13,14,15}
19+
# Linux runners: clang 16, 17, 18 & gcc-{12,13,14}
20+
# Windows runners:
1321
jobs:
1422
check-determinism:
1523
strategy:
24+
fail-fast: false
1625
matrix:
17-
os: [ macos-latest, macos-15-intel, ubuntu-latest, ubuntu-22.04-arm, windows-latest, windows-11-arm ]
26+
os: [ macos-latest, macos-15-intel, ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm ]
27+
compiler:
28+
- [ clang, clang++ ]
29+
- [ gcc, g++ ]
1830
config: [ Release ]
1931
generator: [ 'Ninja Multi-Config' ]
2032
exclude:
21-
#- os: [ windows-latest, windows-11-arm ]
22-
- os: windows-latest
23-
generator: 'Ninja Multi-Config'
33+
- os: macos-latest
34+
compiler: [ gcc, g++ ] # Here gcc is an alias for clang
35+
- os: macos-15-intel
36+
compiler: [ gcc, g++ ] # ditto
2437
include:
25-
# The NMC generator defaults to using GCC and GCC names dlls with
26-
# a "lib" prefix and the import files with both the prefix and a
27-
# ".dll.a" extension. I have neither the time nor energy to find out
28-
# how to change the behaviour. Use VS.
29-
#- os: [ windows-latest, windows-11-arm ]
38+
- os: macos-latest
39+
compiler: [ gcc-15, g++-15 ]
40+
config: Release
41+
generator: 'Ninja Multi-Config'
42+
- os: macos-latest
43+
compiler: [ $(brew --prefix llvm@18)/bin/clang, $(brew --prefix llvm@18)/bin/clang++ ]
44+
config: Release
45+
generator: 'Ninja Multi-Config'
46+
- os: macos-15-intel
47+
compiler: [ gcc-15, g++-15 ]
48+
config: Release
49+
generator: 'Ninja Multi-Config'
50+
- os: macos-15-intel
51+
compiler: [ $(brew --prefix llvm@18)/bin/clang, $(brew --prefix llvm@18)/bin/clang++ ]
52+
config: Release
53+
generator: 'Ninja Multi-Config'
3054
- os: windows-latest
55+
config: Release
3156
generator: 'Visual Studio 17 2022'
57+
toolset: v143
58+
- os: windows-latest
3259
config: Release
33-
static: OFF
60+
generator: 'Visual Studio 17 2022'
61+
toolset: CLangCL
62+
- os: windows-11-arm
63+
config: Release
64+
generator: 'Visual Studio 17 2022'
65+
toolset: v143
66+
- os: windows-11-arm
67+
config: Release
68+
generator: 'Visual Studio 17 2022'
69+
toolset: CLangCL
3470

3571
runs-on: ${{ matrix.os }}
3672
env:
3773
GIT_LFS_SKIP_SMUDGE: 1
38-
BUILD_DIR: "build"
39-
WERROR: ON
74+
BUILD_DIR: build
75+
STANDARD_OPTIONS: '-D KTX_WERROR=OFF -D LIBKTX_VERSION_READ_ONLY=OFF -D KTX_FEATURE_TOOLS=ON -D KTX_FEATURE_TOOLS_CTS=ON -D KTX_TOOLS_CTS_PRIMARY_PLATFORM=ON -D KTX_FEATURE_TESTS=ON'
4076

4177
steps:
4278
- uses: actions/checkout@v6
4379
with:
4480
# Fetch all history to make sure tags are
4581
# included (used for version creation)
4682
fetch-depth: 0
83+
# For the CTS submodule.
84+
submodules: true
85+
86+
- name: Set macOS astcenc ISA override for x86_64
87+
if: matrix.os == 'macos-15-intel'
88+
run: echo ISA_OVERRIDE='-D ASTCENC_ISA_SSE41=ON' >> $GITHUB_ENV
89+
90+
- name: Configure KTX software build for all but Visual Studio
91+
# Without the ${{ }}, this line generates a YAML syntax error. Do not understand why.
92+
if: ${{ !startsWith(matrix.generator, 'Visual Studio') }}
93+
run: cmake -B ${{ env.BUILD_DIR }} -G "${{ matrix.generator }}" -D CMAKE_C_COMPILER=${{ matrix.compiler[0] }} -D CMAKE_CXX_COMPILER=${{ matrix.compiler[1] }} ${{ env.STANDARD_OPTIONS }} ${{ env.ISA_OVERRIDE }}
4794

48-
- name: Configure KTX software
49-
run: echo 'cmake -B ${{ env.BUILD_DIR }} -G "${{ matrix.generator }}" -D KTX_WERROR=${{ env.WERROR }} -D LIBKTX_VERSION_READ_ONLY=OFF -D KTX_FEATURE_TOOLS=ON -D KTX_FEATURE_TOOLS_CTS=ON -D KTX_TOOLS_CTS_PRIMARY_PLATFORM=ON -D KTX_FEATURE_TESTS ${{ matrix.os }}'
95+
- name: Configure KTX software build for Visual Studio build
96+
if: startsWith(matrix.generator, 'Visual Studio')
97+
run: cmake -B ${{ env.BUILD_DIR }} -G "${{ matrix.generator }}" -T ${{ matrix.toolset }} ${{ env.STANDARD_OPTIONS }}
5098

5199
- name: Build KTX software
52-
run: echo 'cmake --build ${{ env.BUILD_DIR }} --config=${{ matrix.config }} --target=ktxtools'
100+
run: cmake --build ${{ env.BUILD_DIR }} --config=${{ matrix.config }} --target=ktxtools
53101

54102
- name: Run KTX tools CTS
55-
continue-on-error: true
56-
run: echo 'ctest --output-on-failure --test-dir ${{ BUILD_DIR }} -C Release -R ktxToolsTest'
103+
run: ctest --output-on-failure --test-dir ${{ env.BUILD_DIR }} -C Release -R ktxToolsTest
57104

0 commit comments

Comments
 (0)