Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
354 changes: 115 additions & 239 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,253 +4,129 @@ name: Continuous Integration Tests

on:
push:
branches:
- main
pull_request:
workflow_dispatch:
schedule:
- cron: '30 15 * * *'

jobs:
beman-submodule-test:
runs-on: ubuntu-latest
name: "Check beman submodules for consistency"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: beman submodule consistency check
run: |
(set -o pipefail; ./infra/tools/beman-submodule/beman-submodule status | grep -qvF '+')
beman-submodule-check:
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.1.0

preset-test:
strategy:
fail-fast: false
matrix:
presets:
- preset: "gcc-debug"
platform: "ubuntu-latest"
- preset: "gcc-release"
platform: "ubuntu-latest"
- preset: "llvm-debug"
platform: "ubuntu-latest"
- preset: "llvm-release"
platform: "ubuntu-latest"
- preset: "appleclang-debug"
platform: "macos-latest"
- preset: "appleclang-release"
platform: "macos-latest"
- preset: "msvc-debug"
platform: "windows-latest"
- preset: "msvc-release"
platform: "windows-latest"
name: "Preset: ${{ matrix.presets.preset }} on ${{ matrix.presets.platform }}"
runs-on: ${{ matrix.presets.platform }}
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0"
ninjaVersion: "^1.11.1"
- name: Setup MSVC
if: startsWith(matrix.presets.platform, 'windows')
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
- name: Run preset
run: cmake --workflow --preset ${{ matrix.presets.preset }}

gtest-test:
strategy:
fail-fast: false
matrix:
platform:
- description: "Ubuntu GNU"
os: ubuntu-latest
toolchain: "infra/cmake/gnu-toolchain.cmake"
- description: "Ubuntu LLVM"
os: ubuntu-latest
toolchain: "infra/cmake/llvm-toolchain.cmake"
- description: "Windows MSVC"
os: windows-latest
toolchain: "infra/cmake/msvc-toolchain.cmake"
- description: "Macos Appleclang"
os: macos-latest
toolchain: "infra/cmake/appleclang-toolchain.cmake"
cpp_version: [17, 20, 23, 26]
cmake_args:
- description: "Default"
- description: "TSan"
args: "-DBEMAN_BUILDSYS_SANITIZER=TSan"
- description: "MaxSan"
args: "-DBEMAN_BUILDSYS_SANITIZER=MaxSan"
include:
- platform:
description: "Ubuntu GCC"
os: ubuntu-latest
toolchain: "infra/cmake/gnu-toolchain.cmake"
cpp_version: 17
cmake_args:
description: "Werror"
args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'"
- platform:
description: "Ubuntu GCC"
os: ubuntu-latest
toolchain: "infra/cmake/gnu-toolchain.cmake"
cpp_version: 17
cmake_args:
description: "Dynamic"
args: "-DBUILD_SHARED_LIBS=on"
exclude:
# MSVC does not support thread sanitizer
- platform:
description: "Windows MSVC"
cmake_args:
description: "TSan"

name: "Unit:
${{ matrix.platform.description }}
${{ matrix.cpp_version }}
${{ matrix.cmake_args.description }}"
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v4
- name: Install Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0"
ninjaVersion: "^1.11.1"
- name: Setup MSVC
if: startsWith(matrix.platform.os, 'windows')
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
- name: Build and Test
uses: ./.github/actions/cmake-build-test
with:
cpp_version: ${{ matrix.cpp_version }}
toolchain_file: ${{ matrix.platform.toolchain }}
cmake_extra_args: ${{ matrix.cmake_args.args }}

configuration-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
args:
- name: "Disable build testing"
arg: "-DBEMAN_CSTRING_VIEW_BUILD_TESTS=OFF"
- name: "Disable example building"
arg: "-DBEMAN_CSTRING_VIEW_BUILD_EXAMPLES=OFF"
- name: "Disable config-file package creation"
arg: "-DBEMAN_CSTRING_VIEW_INSTALL_CONFIG_FILE_PACKAGE=OFF"
name: "CMake: ${{ matrix.args.name }}"
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0"
ninjaVersion: "^1.11.1"
- name: Build and Test
uses: ./.github/actions/cmake-build-test
with:
cpp_version: 17
toolchain_file: "infra/cmake/gnu-toolchain.cmake"
cmake_extra_args: ${{ matrix.args.arg }}
disable_test: true

compiler-test:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
compilers:
- class: GNU
version: 14
toolchain: "infra/cmake/gnu-toolchain.cmake"
- class: GNU
version: 13
toolchain: "infra/cmake/gnu-toolchain.cmake"
- class: GNU
version: 12
toolchain: "infra/cmake/gnu-toolchain.cmake"
- class: LLVM
version: 20
toolchain: "infra/cmake/llvm-toolchain.cmake"
- class: LLVM
version: 19
toolchain: "infra/cmake/llvm-toolchain.cmake"
- class: LLVM
version: 18
toolchain: "infra/cmake/llvm-toolchain.cmake"
- class: LLVM
version: 17
toolchain: "infra/cmake/llvm-toolchain.cmake"
name: "Compiler: ${{ matrix.compilers.class }} ${{ matrix.compilers.version }}"
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0"
ninjaVersion: "^1.11.1"
- name: Install Compiler
id: install-compiler
run: |
sudo add-apt-repository universe
sudo apt-get update

if [ "${{ matrix.compilers.class }}" = "GNU" ]; then
CC=gcc-${{ matrix.compilers.version }}
CXX=g++-${{ matrix.compilers.version }}

sudo apt-get install -y $CC
sudo apt-get install -y $CXX

$CC --version
$CXX --version
else
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo bash llvm.sh ${{ matrix.compilers.version }}

CC=clang-${{ matrix.compilers.version }}
CXX=clang++-${{ matrix.compilers.version }}

$CC --version
$CXX --version
fi

echo "CC=$CC" >> "$GITHUB_OUTPUT"
echo "CXX=$CXX" >> "$GITHUB_OUTPUT"
- name: Build and Test
uses: ./.github/actions/cmake-build-test
with:
cpp_version: 20
toolchain_file: ${{ matrix.compilers.toolchain }}
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.1.0
with:
matrix_config: >
[
{"preset": "gcc-debug", "image": "ghcr.io/bemanproject/infra-containers-gcc:latest"},
{"preset": "gcc-release", "image": "ghcr.io/bemanproject/infra-containers-gcc:latest"},
{"preset": "llvm-debug", "image": "ghcr.io/bemanproject/infra-containers-clang:latest"},
{"preset": "llvm-release", "image": "ghcr.io/bemanproject/infra-containers-clang:latest"},
{"preset": "appleclang-debug", "runner": "macos-latest"},
{"preset": "appleclang-release", "runner": "macos-latest"},
{"preset": "msvc-debug", "runner": "windows-latest"},
{"preset": "msvc-release", "runner": "windows-latest"}
]

build-and-test:
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.1.0
with:
matrix_config: >
{
"gcc": [
{ "versions": ["15"],
"tests": [
{ "cxxversions": ["c++26"],
"tests": [
{ "stdlibs": ["libstdc++"],
"tests": [
"Debug.Default", "Release.Default", "Release.TSan",
"Release.MaxSan", "Debug.Werror", "Debug.Dynamic",
"Debug.Coverage"
]
}
]
},
{ "cxxversions": ["c++23", "c++20"],
"tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
}
]
},
{ "versions": ["14", "13"],
"tests": [
{ "cxxversions": ["c++26", "c++23", "c++20"],
"tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
}
]
}
],
"clang": [
{ "versions": ["21"],
"tests": [
{"cxxversions": ["c++26"],
"tests": [
{ "stdlibs": ["libstdc++", "libc++"],
"tests": [
"Debug.Default", "Release.Default", "Release.TSan",
"Release.MaxSan", "Debug.Werror", "Debug.Dynamic"
]
}
]
},
{ "cxxversions": ["c++23", "c++20"],
"tests": [
{"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]}
]
}
]
},
{ "versions": ["20", "19", "18"],
"tests": [
{ "cxxversions": ["c++26", "c++23", "c++20"],
"tests": [
{"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]}
]
}
]
},
{ "versions": ["17"],
"tests": [
{ "cxxversions": ["c++26", "c++23", "c++20"],
"tests": [{"stdlibs": ["libc++"], "tests": ["Release.Default"]}]
},
{ "cxxversions": ["c++20"],
"tests": [{"stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
}
]
}
],
"appleclang": [
{ "versions": ["latest"],
"tests": [
{ "cxxversions": ["c++26", "c++23", "c++20"],
"tests": [{ "stdlibs": ["libc++"], "tests": ["Release.Default"]}]
}
]
}
],
"msvc": [
{ "versions": ["latest"],
"tests": [
{ "cxxversions": ["c++23"],
"tests": [
{ "stdlibs": ["stl"],
"tests": ["Debug.Default", "Release.Default", "Release.MaxSan"]
}
]
}
]
}
]
}

create-issue-when-fault:
runs-on: ubuntu-latest
needs: [preset-test, gtest-test, configuration-test, compiler-test]
needs: [preset-test, build-and-test]
if: failure() && github.event_name == 'schedule'
steps:
# See https://github.com/cli/cli/issues/5075
- uses: actions/checkout@v4
- name: Create issue
run: |
issue_num=$(gh issue list -s open -S "[SCHEDULED-BUILD] Build & Test failure" -L 1 --json number | jq 'if length == 0 then -1 else .[0].number end')

body="**Build-and-Test Failure Report**
- **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z')
- **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
- **Action Run**: [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})

The scheduled build-and-test triggered by cron has failed.
Please investigate the logs and recent changes associated with this commit or rerun the workflow if you believe this is an error."

if [[ $issue_num -eq -1 ]]; then
gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] Build & Test failure" --body "$body"
else
gh issue comment --repo ${{ github.repository }} $issue_num --body "$body"
fi
env:
GH_TOKEN: ${{ github.token }}
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.1.0
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.25)
cmake_minimum_required(VERSION 3.25...4.2)

set(CMAKE_CXX_STANDARD 23)
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 20) # NEEDED! for std::type_identity, std::format, std::char8_t, ...!
endif()

project(
beman.cstring_view # CMake Project Name, which is also the name of the top-level
Expand Down
1 change: 0 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_CXX_STANDARD": "20",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "./infra/cmake/use-fetch-content.cmake"
}
Expand Down
Loading