Skip to content

feat(ci): move Linux CI to UBI 10 container images #244

feat(ci): move Linux CI to UBI 10 container images

feat(ci): move Linux CI to UBI 10 container images #244

Workflow file for this run

name: ci
on:
pull_request:
release:
types: [published]
push:
tags:
branches:
- master
- main
- develop
env:
CLANG_TIDY_VERSION: "19.1.1"
VERBOSE: 1
jobs:
# ---------------------------------------------------------------------------
# Compute lowercase container image names (GHCR requires lowercase)
# ---------------------------------------------------------------------------
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
ci-image: ${{ steps.images.outputs.ci }}
ci-intel-image: ${{ steps.images.outputs.ci-intel }}
steps:
- id: images
run: |
REPO="${{ github.repository }}"
REPO_LC="${REPO,,}"
echo "ci=ghcr.io/${REPO_LC}/ci:latest" >> $GITHUB_OUTPUT
echo "ci-intel=ghcr.io/${REPO_LC}/ci-intel:latest" >> $GITHUB_OUTPUT
# ---------------------------------------------------------------------------
# Linux — UBI 10 container, all tools pre-installed
# ---------------------------------------------------------------------------
Linux:
name: Linux ${{ matrix.compiler }} ${{ matrix.build_type }} ${{ matrix.packaging_maintainer_mode == 'ON' && '(maintainer)' || '' }} ${{ matrix.generator == 'Unix Makefiles' && '(Make)' || '' }}
needs: setup
runs-on: ubuntu-latest
container:
image: ${{ (matrix.compiler == 'intel' && needs.setup.outputs.ci-intel-image) || needs.setup.outputs.ci-image }}
strategy:
fail-fast: false
matrix:
compiler:
- gcc-14
- gcc-15
- clang-19
- intel
build_type:
- Release
- Debug
packaging_maintainer_mode:
- ON
- OFF
include:
# Per-compiler settings
- compiler: gcc-14
cc: gcc
cxx: g++
gcov_executable: gcov
enable_ipo: On
- compiler: gcc-15
cc: gcc
cxx: g++
gcov_executable: gcov
enable_ipo: On
- compiler: clang-19
cc: clang
cxx: clang++
gcov_executable: "llvm-cov gcov"
enable_ipo: Off
- compiler: intel
cc: icx
cxx: icpx
gcov_executable: "llvm-cov gcov"
enable_ipo: Off
# Release packaging
- build_type: Release
packaging_maintainer_mode: ON
package_generator: TBZ2
# Non-multiconfig build (verifies Unix Makefiles still work)
- compiler: gcc-14
cc: gcc
cxx: g++
generator: "Unix Makefiles"
build_type: Debug
gcov_executable: gcov
packaging_maintainer_mode: ON
enable_ipo: Off
steps:
- uses: actions/checkout@v6
- name: Setup Cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
packaging_maintainer_mode: ${{ matrix.packaging_maintainer_mode }}
generator: ${{ matrix.generator || 'Ninja Multi-Config' }}
- name: Project Name
uses: cardinalby/export-env-action@v2
with:
envFile: '.github/constants.env'
- name: Enable GCC 15 toolset
if: matrix.compiler == 'gcc-15'
run: |
source /opt/rh/gcc-toolset-15/enable
echo "PATH=$PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}" >> $GITHUB_ENV
- name: Set compiler environment
run: |
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
- name: Configure Conan for Intel ICX
if: matrix.compiler == 'intel'
run: |
ICX_CLANG_VER=$(icx -dM -E -x c /dev/null 2>/dev/null | grep __clang_major__ | awk '{print $3}')
echo "ICX underlying Clang version: $ICX_CLANG_VER"
CC=clang CXX=clang++ conan profile detect --force
sed -i "s/compiler.version=.*/compiler.version=$ICX_CLANG_VER/" ~/.conan2/profiles/default
sed -i "s/compiler.cppstd=.*/compiler.cppstd=23/" ~/.conan2/profiles/default
cat ~/.conan2/profiles/default
conan install . --output-folder=build --build=missing -s build_type=Debug
conan install . --output-folder=build --build=missing -s build_type=Release
conan install . --output-folder=build --build=missing -s build_type=RelWithDebInfo
- name: Configure CMake
run: |
GENERATOR="${{ matrix.generator || 'Ninja Multi-Config' }}"
EXTRA_CMAKE_ARGS=""
if [[ "${{ matrix.compiler }}" == "intel" ]]; then
EXTRA_CMAKE_ARGS="-D${{ env.PROJECT_NAME }}_SKIP_CONAN_PROVIDER=ON -DCMAKE_PREFIX_PATH=$PWD/build"
fi
cmake -S . -B ./build -G "$GENERATOR" \
$EXTRA_CMAKE_ARGS \
-D${{ env.PROJECT_NAME }}_ENABLE_IPO=${{ matrix.enable_ipo }} \
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} \
-D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{ matrix.packaging_maintainer_mode }} \
-D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} \
-D${{ env.PROJECT_NAME }}_ENABLE_BLOATY:BOOL=ON \
-D${{ env.PROJECT_NAME }}_ENABLE_INCLUDE_WHAT_YOU_USE:BOOL=ON \
-DGIT_SHA:STRING=${{ github.sha }}
- name: Build
run: cmake --build ./build --config ${{ matrix.build_type }}
- name: Test and coverage
working-directory: ./build
run: |
ctest -C ${{ matrix.build_type }}
gcovr -j $(nproc) --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}'
- name: CPack
if: matrix.package_generator != ''
working-directory: ./build
run: |
cpack -C ${{ matrix.build_type }} -G ${{ matrix.package_generator }}
- name: Publish Tagged Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.package_generator != '' }}
with:
files: |
build/*-*${{ matrix.build_type }}*-*.*
- name: Publish to codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
flags: ${{ runner.os }}
name: ${{ runner.os }}-coverage
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/coverage.xml
# ---------------------------------------------------------------------------
# macOS — bare runner with setup-cpp
# ---------------------------------------------------------------------------
macOS:
name: macOS ${{ matrix.compiler }} ${{ matrix.build_type }} ${{ matrix.packaging_maintainer_mode == 'ON' && '(maintainer)' || '' }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
compiler:
- llvm-19.1.1
- gcc-14
build_type:
- Release
- Debug
packaging_maintainer_mode:
- ON
- OFF
include:
- compiler: llvm-19.1.1
gcov_executable: "llvm-cov gcov"
enable_ipo: Off
- compiler: gcc-14
gcov_executable: gcov-14
enable_ipo: Off
# Release packaging
- build_type: Release
packaging_maintainer_mode: ON
package_generator: TBZ2
steps:
- name: Check for llvm version mismatches
if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }}
uses: actions/github-script@v8
with:
script: |
core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen')
- uses: actions/checkout@v6
- name: Setup Cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
packaging_maintainer_mode: ${{ matrix.packaging_maintainer_mode }}
generator: "Ninja Multi-Config"
- name: Project Name
uses: cardinalby/export-env-action@v2
with:
envFile: '.github/constants.env'
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
cmake: true
ninja: true
vcpkg: false
ccache: true
clangtidy: ${{ env.CLANG_TIDY_VERSION }}
cppcheck: true
gcovr: true
- name: Install Conan and Lizard
run: pip install conan lizard
- name: Pre-install Conan deps for macOS GCC
if: ${{ contains(matrix.compiler, 'gcc') }}
run: |
conan profile detect --force
GCC_VER=$(echo "${{ matrix.compiler }}" | grep -o '[0-9]*')
cat > ~/.conan2/profiles/default << PROFILE
[settings]
arch=armv8
build_type=Release
compiler=gcc
compiler.cppstd=23
compiler.libcxx=libstdc++11
compiler.version=$GCC_VER
os=Macos
[conf]
tools.build:compiler_executables={"c": "gcc-$GCC_VER", "cpp": "g++-$GCC_VER"}
PROFILE
cat ~/.conan2/profiles/default
conan install . --output-folder=build --build=missing -s build_type=Debug
conan install . --output-folder=build --build=missing -s build_type=Release
conan install . --output-folder=build --build=missing -s build_type=RelWithDebInfo
- name: Configure CMake
run: |
EXTRA_CMAKE_ARGS=""
if [[ "${{ matrix.compiler }}" =~ gcc ]]; then
EXTRA_CMAKE_ARGS="-D${{ env.PROJECT_NAME }}_SKIP_CONAN_PROVIDER=ON -DCMAKE_PREFIX_PATH=$PWD/build"
fi
cmake -S . -B ./build -G "Ninja Multi-Config" \
$EXTRA_CMAKE_ARGS \
-D${{ env.PROJECT_NAME }}_ENABLE_IPO=${{ matrix.enable_ipo }} \
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} \
-D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{ matrix.packaging_maintainer_mode }} \
-D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} \
-D${{ env.PROJECT_NAME }}_ENABLE_BLOATY:BOOL=OFF \
-D${{ env.PROJECT_NAME }}_ENABLE_INCLUDE_WHAT_YOU_USE:BOOL=OFF \
-DGIT_SHA:STRING=${{ github.sha }}
- name: Build
run: cmake --build ./build --config ${{ matrix.build_type }}
- name: Test and coverage
working-directory: ./build
run: |
ctest -C ${{ matrix.build_type }}
# macOS GCC coverage broken — libgcov link failure (issue #5)
if [[ ! "${{ matrix.compiler }}" =~ gcc ]]; then
gcovr -j $(sysctl -n hw.ncpu) --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}'
fi
- name: CPack
if: matrix.package_generator != ''
working-directory: ./build
run: |
cpack -C ${{ matrix.build_type }} -G ${{ matrix.package_generator }}
- name: Publish Tagged Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.package_generator != '' }}
with:
files: |
build/*-*${{ matrix.build_type }}*-*.*
- name: Publish to codecov
if: ${{ !contains(matrix.compiler, 'gcc') }}
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
flags: ${{ runner.os }}
name: ${{ runner.os }}-coverage
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/coverage.xml
# ---------------------------------------------------------------------------
# Windows — bare runner with setup-cpp
# ---------------------------------------------------------------------------
Windows:
name: Windows ${{ matrix.compiler }} ${{ matrix.build_type }} ${{ matrix.packaging_maintainer_mode == 'ON' && '(maintainer)' || '' }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
# MSVC builds
- compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Debug
packaging_maintainer_mode: ON
enable_ipo: On
- compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Release
packaging_maintainer_mode: ON
enable_ipo: On
- compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Debug
packaging_maintainer_mode: OFF
- compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Release
packaging_maintainer_mode: OFF
package_generator: ZIP
- compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Release
packaging_maintainer_mode: ON
enable_ipo: On
build_shared: ON
# Clang builds (clang-cl via LLVM)
- compiler: llvm-19.1.1
generator: "Ninja Multi-Config"
build_type: Debug
packaging_maintainer_mode: ON
enable_ipo: Off
- compiler: llvm-19.1.1
generator: "Ninja Multi-Config"
build_type: Release
packaging_maintainer_mode: ON
enable_ipo: Off
- compiler: llvm-19.1.1
generator: "Ninja Multi-Config"
build_type: Debug
packaging_maintainer_mode: OFF
enable_ipo: Off
- compiler: llvm-19.1.1
generator: "Ninja Multi-Config"
build_type: Release
packaging_maintainer_mode: OFF
enable_ipo: Off
steps:
- name: Check for llvm version mismatches
if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }}
uses: actions/github-script@v8
with:
script: |
core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen')
- uses: actions/checkout@v6
- name: Setup Cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
packaging_maintainer_mode: ${{ matrix.packaging_maintainer_mode }}
generator: ${{ matrix.generator }}
- name: Project Name
uses: cardinalby/export-env-action@v2
with:
envFile: '.github/constants.env'
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: true
cmake: true
ninja: true
vcpkg: false
ccache: true
clangtidy: ${{ env.CLANG_TIDY_VERSION }}
cppcheck: true
opencppcoverage: true
- name: Install Conan and Lizard
run: pip install conan lizard
- name: Configure CMake
run: |
cmake -S . -B ./build -G "${{ matrix.generator }}" -D${{ env.PROJECT_NAME }}_ENABLE_IPO=${{ matrix.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} -D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{ matrix.packaging_maintainer_mode }} -D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -D${{ env.PROJECT_NAME }}_ENABLE_BLOATY:BOOL=OFF -D${{ env.PROJECT_NAME }}_ENABLE_INCLUDE_WHAT_YOU_USE:BOOL=OFF -DGIT_SHA:STRING=${{ github.sha }}
- name: Build
run: cmake --build ./build --config ${{ matrix.build_type }}
- name: Test and coverage
working-directory: ./build
run: |
OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{ matrix.build_type }}
- name: CPack
if: matrix.package_generator != ''
working-directory: ./build
run: |
cpack -C ${{ matrix.build_type }} -G ${{ matrix.package_generator }}
- name: Publish Tagged Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.package_generator != '' }}
with:
files: |
build/*-*${{ matrix.build_type }}*-*.*
- name: Publish to codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
flags: ${{ runner.os }}
name: ${{ runner.os }}-coverage
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/coverage.xml