Skip to content

refactor: update to copier-cpp template v0.4.2 #222

refactor: update to copier-cpp template v0.4.2

refactor: update to copier-cpp template v0.4.2 #222

Workflow file for this run

name: C++ CI
on:
push:
branches:
- master
- releases/v*
pull_request:
merge_group:
jobs:
build-and-test:
name: Test ${{ matrix.os }}-${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-2025]
compiler: [gcc, clang, msvc]
exclude:
- os: ubuntu-24.04
compiler: msvc
- os: windows-2025
compiler: gcc
include:
- os: macos-15-intel
compiler: gcc
triplet: x64-macos
- os: macos-15
compiler: clang
triplet: arm64-macos
install: |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install llvm@19
- os: ubuntu-24.04
triplet: x64-linux
- os: ubuntu-24.04
triplet: x64-linux
compiler: clang
install: |
sudo cp tools/llvm-snapshot.gpg.key.asc /etc/apt/trusted.gpg.d/llvm-snapshot.asc
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main"
sudo apt-get -qq update
sudo apt-get -qq -y install clang-19
- os: windows-2025
triplet: x64-windows
permissions:
actions: read
env:
CTEST_OUTPUT_ON_FAILURE: "1"
steps:
- uses: actions/checkout@v6
- name: Install required packages / compilers
if: ${{ matrix.install }}
run: ${{ matrix.install }}
- uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.31.7
- name: Restore vcpkg cache
id: vcpkg-cache
uses: TAServers/vcpkg-cache@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
prefix: vcpkg/${{ matrix.triplet }}-${{ matrix.compiler }}/
- name: Initialize vcpkg
uses: lukka/run-vcpkg@b3dd708d38df5c856fe1c18dc0d59ab771f93921
with:
vcpkgDirectory: ${{ github.workspace }}/build/vcpkg
- name: Build ${{ matrix.triplet }}-${{ matrix.compiler }}-ci preset
uses: lukka/run-cmake@v10
with:
configurePreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci
buildPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci
testPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci
env:
CC: ''
CXX: ''
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
- name: Build ${{ matrix.triplet }}-${{ matrix.compiler }}-ci-release preset
uses: lukka/run-cmake@v10
with:
configurePreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci
buildPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci-release
testPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci-release
env:
CC: ''
CXX: ''
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
check-format:
name: clang-tidy & clang-format
runs-on: ubuntu-24.04
permissions:
actions: read
steps:
- uses: actions/checkout@v6
- name: "Install clang-tools-20"
run: |
sudo cp ${{ github.workspace }}/tools/llvm-snapshot.gpg.key.asc /etc/apt/trusted.gpg.d/llvm-snapshot.asc
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main"
sudo apt-get -qq update
sudo apt-get -qq -y install clang-20 clang-tidy-20 clang-format-20
- uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.31.7
- name: Restore vcpkg cache
id: vcpkg-cache
uses: TAServers/vcpkg-cache@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
prefix: vcpkg/lint/
- name: Initialize vcpkg
uses: lukka/run-vcpkg@b3dd708d38df5c856fe1c18dc0d59ab771f93921
with:
vcpkgDirectory: ${{ github.workspace }}/../vcpkg
- name: Configure x64-linux-ci-lint preset
uses: lukka/run-cmake@v10
with:
configurePreset: x64-linux-ci-lint
env:
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
- uses: cpp-linter/cpp-linter-action@v2
name: Lint with clang-format and clang-tidy
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: 20
style: file # use .clang-format settings
tidy-checks: '' # use .clang-tidy settings
extensions: cpp,hpp
ignore: '.github|build|external'
files-changed-only: true
database: build/x64-linux-ci-lint
- name: Fail if issues have been raised
if: steps.linter.outputs.checks-failed > 0
run: exit 1