[misc] add cmake stuff and version.hpp #148
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux CI | |
on: | |
push: | |
branches: | |
# Push events to branches matching refs/heads/master | |
- 'main' | |
# Trigger after PR was unlabeled | |
pull_request: | |
# Enables a manual trigger, may run on any branch | |
workflow_dispatch: | |
concurrency: | |
group: linux-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
TZ: Europe/Berlin | |
defaults: | |
run: | |
shell: bash -ex {0} | |
jobs: | |
build: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os == '' && 'ubuntu-22.04' || matrix.os }} | |
timeout-minutes: 120 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: "Unit clang17 (libstdc++)" | |
cxx: "clang++-17" | |
cc: "clang-17" | |
pkg: "clang-17 g++-12" | |
cxx_flags: "-std=c++20" | |
build: unit | |
build_type: Debug | |
- name: "Unit clang17 (libc++)" | |
cxx: "clang++-17" | |
cc: "clang-17" | |
pkg: "clang-17 libc++-17-dev libc++abi-17-dev libc++1-17 libc++abi1-17" | |
cxx_flags: "-std=c++20 -stdlib=libc++" | |
build: unit | |
build_type: Debug | |
- name: "Unit clang18 (libc++)" | |
cxx: "clang++-18" | |
cc: "clang-18" | |
pkg: "clang-18 libc++-18-dev libc++abi-18-dev libc++1-18 libc++abi1-18" | |
cxx_flags: "-std=c++20 -stdlib=libc++" | |
build: unit | |
build_type: Debug | |
- name: "Unit clang19 (libc++, c++23)" | |
cxx: "clang++-19" | |
cc: "clang-19" | |
pkg: "clang-19 libc++-19-dev libc++abi-19-dev libc++1-19 libc++abi1-19" | |
cxx_flags: "-std=c++23 -stdlib=libc++" | |
build: unit | |
build_type: Debug | |
- name: "Unit gcc11 Release" | |
cxx: "g++-11" | |
cc: "gcc-11" | |
pkg: "gcc-11 g++-11" | |
cxx_flags: "-std=c++20" | |
build: unit | |
build_type: Release | |
- name: "Unit gcc12 ASAN+UBSAN" | |
cxx: "g++-12" | |
cc: "gcc-12" | |
pkg: "gcc-12 g++-12" | |
build: unit | |
build_type: Debug | |
cxx_flags: "-std=c++20 -fsanitize=address,undefined" | |
- name: "Unit gcc13" | |
cxx: "g++-13" | |
cc: "gcc-13" | |
pkg: "gcc-13 g++-13" | |
cxx_flags: "-std=c++20" | |
build: unit | |
build_type: Debug | |
- name: "Unit gcc14 c++20" | |
os: "ubuntu-24.04" | |
cxx: "g++-14" | |
cc: "gcc-14" | |
pkg: "gcc-14 g++-14" | |
cxx_flags: "-std=c++20" | |
build: unit | |
build_type: Debug | |
- name: "Unit gcc14 c++23" | |
os: "ubuntu-24.04" | |
cxx: "g++-14" | |
cc: "gcc-14" | |
pkg: "gcc-14 g++-14" | |
cxx_flags: "-std=c++23" | |
build: unit | |
build_type: Debug | |
- name: "benchmark gcc13" | |
cxx: "g++-13" | |
cc: "gcc-13" | |
pkg: "gcc-13 g++-13 libbenchmark-dev" | |
cxx_flags: "-std=c++20" | |
build: benchmark | |
build_type: Release | |
- name: "benchmark clang18" | |
cxx: "clang++-18" | |
cc: "clang-18" | |
pkg: "clang-18 libc++-18-dev libc++abi-18-dev libc++1-18 libc++abi1-18 libbenchmark-dev" | |
cxx_flags: "-std=c++20 -stdlib=libc++" | |
build: benchmark | |
build_type: Release | |
- name: "Clang Format" | |
pkg: "clang-format-17" | |
build: clang_format | |
build_type: Debug | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@v4 | |
- name: Configure APT (llvm) | |
continue-on-error: true | |
if: contains(matrix.pkg, 'clang') | |
run: | | |
sudo apt-add-repository --no-update --yes "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | |
sudo apt-add-repository --no-update --yes "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | |
sudo apt-add-repository --no-update --yes "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main" | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - | |
- name: Configure APT | |
continue-on-error: true | |
run: | | |
echo 'APT::Acquire::Retries "5";' | sudo tee -a /etc/apt/apt.conf.d/80-retries > /dev/null | |
sudo add-apt-repository --no-update --yes ppa:ubuntu-toolchain-r/ppa | |
sudo add-apt-repository --no-update --yes ppa:ubuntu-toolchain-r/test | |
sudo apt-get update | |
- name: Install CMake | |
run: sudo apt-get install --yes cmake | |
- name: Install ccache | |
run: sudo apt-get install --yes ccache | |
- name: Install compiler/tool ${{ matrix.pkg }} | |
run: sudo apt-get install --yes ${{ matrix.pkg }} | |
- name: Load ccache | |
if: matrix.build != 'documentation' | |
uses: actions/cache@v4 | |
with: | |
path: .ccache | |
key: ${{ runner.os }}-${{ matrix.name }}-ccache-${{ github.ref }}-${{ github.run_number }} | |
# Restoring: From current branch, otherwise from base branch, otherwise from any branch. | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.name }}-ccache-${{ github.ref }} | |
${{ runner.os }}-${{ matrix.name }}-ccache-${{ github.base_ref }} | |
${{ runner.os }}-${{ matrix.name }}-ccache- | |
- name: Tool versions | |
run: | | |
env cmake --version | |
env ${{ matrix.cxx }} --version | |
- name: Configure tests | |
env: | |
CXX: ${{ matrix.cxx }} | |
CC: ${{ matrix.cc }} | |
run: | | |
mkdir -p ../radr-build | |
cd ../radr-build | |
cmake ../radr/tests/${{ matrix.build }} -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" | |
- name: Build tests | |
env: | |
CCACHE_BASEDIR: ${{ github.workspace }} | |
CCACHE_DIR: ${{ github.workspace }}/.ccache | |
CCACHE_COMPRESS: true | |
CCACHE_COMPRESSLEVEL: 12 | |
CCACHE_MAXSIZE: ${{ matrix.build == 'coverage' && '525M' || '75M' }} | |
CCACHE_IGNOREOPTIONS: "-fprofile-abs-path" | |
run: | | |
ccache -z | |
cd ../radr-build | |
make -k -j2 | |
ccache -sv | |
- name: Run tests | |
if: ${{ matrix.build != 'coverage' && matrix.build != 'clang_format' }} | |
run: | | |
cd ../radr-build | |
ctest . -j2 --output-on-failure |