Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ jobs:
fail-fast: false
matrix:
config:
- {name: "Ubuntu Clang 21", tag: "clang:21", toolchain: "clang-21", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu Clang 20", tag: "clang:20", toolchain: "clang-20", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu Clang 21", tag: "clang:21", toolchain: "clang-21", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "}
- {name: "Ubuntu Clang 20", tag: "clang:20", toolchain: "clang-20", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "}
# Note: clang-19 + Asan setup causes errors on some platforms. Temporary skip some checks via .asan_options.
- {name: "Ubuntu Clang 19", tag: "clang:19", toolchain: "clang-19", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" ", asan_options: "new_delete_type_mismatch=0"}
- {name: "Ubuntu Clang 18", tag: "clang:18", toolchain: "clang-18", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu Clang 17", tag: "clang:17", toolchain: "clang-17", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu GCC 14", tag: "gcc:14", toolchain: "gcc-14", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan;Gcov\" ", coverage: true}
- {name: "Ubuntu GCC 13", tag: "gcc:13", toolchain: "gcc-13", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu GCC 12", tag: "gcc:12", toolchain: "gcc-12", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" "}
- {name: "Ubuntu Clang 19", tag: "clang:19", toolchain: "clang-19", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" ", asan_options: "new_delete_type_mismatch=0"}
- {name: "Ubuntu Clang 18", tag: "clang:18", toolchain: "clang-18", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "}
- {name: "Ubuntu Clang 17", tag: "clang:17", toolchain: "clang-17", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "}
- {name: "Ubuntu GCC 14", tag: "gcc:14", toolchain: "gcc-14", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan;Gcov\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" ", coverage: true}
- {name: "Ubuntu GCC 13", tag: "gcc:13", toolchain: "gcc-13", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "}
- {name: "Ubuntu GCC 12", tag: "gcc:12", toolchain: "gcc-12", cmake_args: "-G \"Ninja Multi-Config\" -DCMAKE_CONFIGURATION_TYPES=\"RelWithDebInfo;Asan\" -DCMAKE_PREFIX_PATH=\"./infra/cmake\" "}
steps:
- uses: actions/checkout@v3
with:
Expand Down
130 changes: 130 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: Continuous Integration Tests

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

jobs:
beman-submodule-check:
uses: bemanproject/infra-workflows/.github/workflows/[email protected]

preset-test:
uses: bemanproject/infra-workflows/.github/workflows/[email protected]
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/[email protected]
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"]}]
}
]
},
{
"versions": ["12"],
"tests": [
{ "cxxversions": ["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"]}
]
}
]
}
],
"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:
needs: [preset-test, build-and-test]
if: failure() && github.event_name == 'schedule'
uses: bemanproject/infra-workflows/.github/workflows/[email protected]
13 changes: 13 additions & 0 deletions .github/workflows/pre-commit-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Lint Check (pre-commit)

on:
# We have to use pull_request_target here as pull_request does not grant
# enough permission for reviewdog
pull_request_target:
push:
branches:
- main

jobs:
pre-commit:
uses: bemanproject/infra-workflows/.github/workflows/[email protected]
15 changes: 15 additions & 0 deletions .github/workflows/pre-commit-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: Weekly pre-commit autoupdate

on:
workflow_dispatch:
schedule:
- cron: "0 16 * * 0"

jobs:
auto-update-pre-commit:
uses: bemanproject/infra-workflows/.github/workflows/[email protected]
secrets:
APP_ID: ${{ secrets.AUTO_PR_BOT_APP_ID }}
PRIVATE_KEY: ${{ secrets.AUTO_PR_BOT_PRIVATE_KEY }}
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ repos:
# This brings in a portable version of clang-format.
# See also: https://github.com/ssciwr/clang-format-wheel
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.2
rev: v21.1.7
hooks:
- id: clang-format
types_or: [c++, c]

# CMake linting and formatting
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.22.3
rev: 0.24.0
hooks:
- id: gersemi
name: CMake linting
Expand All @@ -44,3 +44,5 @@ repos:
(?x)^(
papers/.*
)$

exclude: 'infra/'
37 changes: 11 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# CMakeLists.txt -*-CMake-*-
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.27)

project(beman_optional VERSION 0.0.0 LANGUAGES CXX)
project(beman.optional VERSION 0.0.0 LANGUAGES CXX)

# Includes
include(CTest)
Expand All @@ -20,28 +19,30 @@ option(

set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON)

# Create the library target and named header set for beman_optional
add_library(beman_optional INTERFACE)
# Create the library target and named header set for beman.optional
add_library(beman.optional INTERFACE)
target_sources(
beman_optional
beman.optional
PUBLIC FILE_SET beman_optional_headers TYPE HEADERS BASE_DIRS include
)

if(OPTIONAL_ENABLE_TESTING)
find_package(GTest QUIET)
if(GTest_FOUND)
# Create the library target and named header set for testing beman_optional
# Create the library target and named header set for testing beman.optional
# and mark the set private
add_executable(beman_optional_test)
add_executable(beman.optional.test)
target_sources(
beman_optional_test
beman.optional.test
PRIVATE
FILE_SET beman_optional_test_headers
TYPE HEADERS
BASE_DIRS tests
)
# Tests
add_subdirectory(tests/beman/optional)
include(GoogleTest)
gtest_discover_tests(beman.optional.test)
else()
message(
WARNING
Expand All @@ -57,24 +58,8 @@ add_subdirectory(include/beman/optional)

add_subdirectory(examples)

include(CMakePackageConfigHelpers)

# This will be used to replace @PACKAGE_cmakeModulesDir@
set(cmakeModulesDir cmake/beman)
configure_package_config_file(
cmake/Config.cmake.in
BemanOptionalConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman/optional/
PATH_VARS cmakeModulesDir
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/BemanOptionalConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman/optional/
COMPONENT beman_optional_development
)
find_package(beman-install-library REQUIRED)
beman_install_library(beman.optional FILE_SET beman_optional_headers)

# Coverage
configure_file("cmake/gcovr.cfg.in" gcovr.cfg @ONLY)
Expand Down
Loading