mirror of
https://github.com/KhronosGroup/KTX-Software.git
synced 2026-01-18 17:41:19 +01:00
Previously this was only done on macOS - using `libtool`. Changed to a simple, though hard to find, cross-platform way to do this via CMake. Add CI test of build and use of a static library. Remove macOS 13 build from CI as these runner images have been retired from GitHub Actions.
138 lines
5.1 KiB
YAML
138 lines
5.1 KiB
YAML
# Copyright 2015-2020 The Khronos Group Inc.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
name: Check Config and Build of libktx as top-level project and sub-project
|
|
|
|
# The purpose of this is to smoke test building just libktx using its
|
|
# CMakeLists.txt as both a top-level project and sub-project that is
|
|
# not related to the KTX-Software project. Testing of various build
|
|
# options and running of tests on the library is left to the various
|
|
# KTX-Software platform workflows.
|
|
|
|
# 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-mkvk.yml
|
|
- .github/workflows/check-reuse.yml
|
|
- .github/workflows/docs.yml
|
|
- .github/workflows/formatting.yml
|
|
- .github/workflows/linux.yml
|
|
- .github/workflows/macos.yml
|
|
- .github/workflows/manual.yml
|
|
- .github/workflows/mingw.yml
|
|
- .github/workflows/publish-pyktx.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*
|
|
- vcpkg.json
|
|
- vcpkg-configuration.json
|
|
|
|
# Allow manual trigger
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
check-libktx-only:
|
|
strategy:
|
|
matrix:
|
|
os: [ macos-latest, ubuntu-latest, windows-latest ]
|
|
config: [ Release ]
|
|
static: [ OFF, ON ]
|
|
generator: [ 'Ninja Multi-Config' ]
|
|
exclude:
|
|
- os: windows-latest
|
|
generator: 'Ninja Multi-Config'
|
|
include:
|
|
# The NMC generator defaults to using GCC and GCC names dlls with
|
|
# a "lib" prefix and the import files with both the prefix and a
|
|
# ".dll.a" extension. I have neither the time nor energy to find out
|
|
# how to change the behaviour. Use VS.
|
|
- os: windows-latest
|
|
generator: 'Visual Studio 17 2022'
|
|
config: Release
|
|
static: OFF
|
|
- os: windows-latest
|
|
generator: 'Visual Studio 17 2022'
|
|
config: Release
|
|
static: ON
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
GIT_LFS_SKIP_SMUDGE: 1
|
|
BUILD_DIR_TL: "build/tl"
|
|
BUILD_DIR_UKP: "build/ukp"
|
|
SOURCE_DIR_LIB: "lib"
|
|
SOURCE_DIR_UKP: "tests/use-ktx"
|
|
# In theory it should not matter, but this image is chosen to exercise
|
|
# some of the functions in one of the library dependencies.
|
|
KTX2_TEST_FILE: "tests/testimages/kodim17_basis.ktx2"
|
|
WERROR: ON
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
# Fetch all history to make sure tags are
|
|
# included (used for version creation)
|
|
fetch-depth: 0
|
|
|
|
- name: Fetch test image from LFS and check it out
|
|
run: git lfs fetch ${{ env.KTX2_TEST_FILE }} && git lfs checkout ${{ env.KTX2_TEST_FILE }}
|
|
|
|
- name: Configure as top-level project
|
|
run: cmake -S ${{ env.SOURCE_DIR_LIB }} -B ${{ env.BUILD_DIR_TL }} -G "${{ matrix.generator }}" -DLIBKTX_WERROR=${{ env.WERROR }} -DLIBKTX_VERSION_READ_ONLY=ON
|
|
- name: Build libktx with top-level project
|
|
run: cmake --build ${{ env.BUILD_DIR_TL }} --config=Release
|
|
|
|
- name: Configure as sub-project, static library is ${{ matrix.static }}
|
|
run: cmake -S ${{ env.SOURCE_DIR_UKP }} -B ${{ env.BUILD_DIR_UKP }} -G "${{ matrix.generator }}" -DLIBKTX_WERROR=${{ env.WERROR }} -DUSE_STATIC_LIBRARY=${{ matrix.static }}
|
|
- name: Build use-ktx and libktx projects, static library is ${{ matrix.static }}
|
|
run: cmake --build ${{ env.BUILD_DIR_UKP }} --config=Release
|
|
|
|
- name: Prepare version number and architecture for artifact
|
|
id: libktx-version
|
|
shell: bash
|
|
# Arch set up is to match arch to names used in releases and platforms.
|
|
# N.B. If `>> ${{ github.env }} is used here variables are not seen in
|
|
# following step on Windows runners. Linux and macOS have no problem.
|
|
run: |
|
|
echo KTX_VERSION=$(grep -A 1 -m 1 "Code version" lib/src/version.h | tail -n 1) >> $GITHUB_ENV
|
|
arch=$(echo ${{ runner.arch }} | tr '[:upper:]' '[:lower:]')
|
|
if [ "$arch" = "x64" ]; then arch=x86_64; fi
|
|
echo ARCH=$arch >> $GITHUB_ENV
|
|
|
|
- name: Check content of output directory from top-level build
|
|
run: scripts/check_lib_build_output.sh ${{ env.BUILD_DIR_TL }}/${{ matrix.config }}
|
|
|
|
- name: Test run use-ktx program
|
|
run: ${{ env.BUILD_DIR_UKP }}/Release/use-ktx ${{ env.KTX2_TEST_FILE }}
|
|
|
|
- name: Upload artifact libktx
|
|
if: matrix.static == 'OFF'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: libktx-${{ env.KTX_VERSION }}-${{ runner.os }}-${{ env.ARCH }}
|
|
path: ${{env.BUILD_DIR_TL}}/Release/*ktx*
|
|
|