Skip to content

Commit

Permalink
Merge branch 'main' into codespace
Browse files Browse the repository at this point in the history
  • Loading branch information
wusatosi authored Nov 10, 2024
2 parents 24b10ba + 2393743 commit 69c7c94
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 51 deletions.
62 changes: 25 additions & 37 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ jobs:
strategy:
matrix:
preset: ["gcc-debug", "gcc-release"]
name: "Preset Test: ${{ matrix.preset }}"
steps:
- uses: actions/checkout@v4
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
- name: Setup build environment
uses: lukka/get-cmake@latest
with:
cmake-version: '3.25.x'
- uses: seanmiddleditch/gha-setup-ninja@v5
cmakeVersion: "~3.25.0"
ninjaVersion: "^1.11.1"
- name: Run preset
run: cmake --workflow --preset ${{ matrix.preset }}

Expand All @@ -36,43 +37,33 @@ jobs:
c: gcc
- cpp: clang++
c: clang
cpp_version: [17, 20, 23, 26]
cmake_args:
- description: "Static default"
- description: "Default"
args: ""
- description: "Dynamic default"
args: "-DBUILD_SHARED_LIBS=on"
- description: "static C++17"
args: "-DCMAKE_CXX_STANDARD=17"
- description: "static C++20"
args: "-DCMAKE_CXX_STANDARD=20"
- description: "static C++23"
args: "-DCMAKE_CXX_STANDARD=23"
- description: "static C++26"
args: "-DCMAKE_CXX_STANDARD=26"
- description: "TSan"
args: "-DCMAKE_CXX_FLAGS=-fsanitize=thread"
- description: "ASan"
args: "-DCMAKE_CXX_FLAGS='-fsanitize=address -fsanitize=undefined'"
include:
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cpp_version: 17
cmake_args:
description: "Werror"
cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'"
args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'"
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cpp_version: 17
cmake_args:
description: "A-San"
cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=address -fsanitize=undefined"
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cmake_args:
description: "T-San"
cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=thread"
description: "Dynamic"
args: "-DBUILD_SHARED_LIBS=on"

name: "Bulid & Test: ${{ matrix.compiler.c }} ${{ matrix.cmake_args.description }}"
name: "Bulid & Test: ${{ matrix.compiler.c }} ${{ matrix.cpp_version }} ${{ matrix.cmake_args.description }}"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
Expand All @@ -87,31 +78,28 @@ jobs:
g++ --version
cmake --version
ninja --version
- name: Configure CMake
run: |
cmake -B build -S . -DCMAKE_CXX_STANDARD=${{ matrix.cpp_version }} ${{ matrix.cmake_args.args }}
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
CMAKE_GENERATOR: "Ninja Multi-Config"
- name: Build Release
run: |
cmake -B build -S . "${{ matrix.cmake_args.args }}"
cmake --build build --config Release --verbose
cmake --build build --config Release --target all_verify_interface_header_sets
cmake --install build --config Release --prefix /opt/beman.exemplar
find /opt/beman.exemplar -type f
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
CMAKE_GENERATOR: "Ninja Multi-Config"
- name: Test Release
run: ctest --test-dir build --build-config Release
- name: Build Debug
run: |
cmake -B build -S . "${{ matrix.cmake_args.args }}"
cmake --build build --config Debug --verbose
cmake --build build --config Debug --target all_verify_interface_header_sets
cmake --install build --config Debug --prefix /opt/beman.exemplar
find /opt/beman.exemplar -type f
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
CMAKE_GENERATOR: "Ninja Multi-Config"
- name: Test Release
- name: Test Debug
run: ctest --test-dir build --build-config Debug

create-issue-when-fault:
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ endif()

add_subdirectory(src/beman/exemplar)

if(BUILD_TESTING)
add_subdirectory(tests/beman/exemplar)
endif()

add_subdirectory(examples)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

![Continuous Integration Tests](https://github.com/beman-project/exemplar/actions/workflows/ci_tests.yml/badge.svg)

`beman.exemplar` is a minimal C++ library conforming to [The Beman Standard](https://github.com/beman-project/beman/blob/main/docs/beman-standard.md).
`beman.exemplar` is a minimal C++ library conforming to [The Beman Standard](https://github.com/beman-project/beman/blob/main/docs/BEMAN_STANDARD.md).
This can be used as a template for those intending to write Beman libraries.
It may also find use as a minimal and modern C++ project structure.

Expand Down
13 changes: 0 additions & 13 deletions src/beman/exemplar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,3 @@ install(
RUNTIME DESTINATION $<$<CONFIG:Debug>:debug/>${CMAKE_INSTALL_BINDIR}
FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

if(BUILD_TESTING)
include(GoogleTest)

add_executable(beman.exemplar.tests)
target_sources(beman.exemplar.tests PRIVATE identity.t.cpp)
target_link_libraries(
beman.exemplar.tests
PRIVATE beman::exemplar GTest::gtest GTest::gtest_main
)

gtest_add_tests(beman.exemplar.tests "" AUTO)
endif()
12 changes: 12 additions & 0 deletions tests/beman/exemplar/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

include(GoogleTest)

add_executable(beman.exemplar.tests.identity)
target_sources(beman.exemplar.tests.identity PRIVATE identity.test.cpp)
target_link_libraries(
beman.exemplar.tests.identity
PRIVATE beman::exemplar GTest::gtest GTest::gtest_main
)

gtest_add_tests(beman.exemplar.tests.identity "" AUTO)
File renamed without changes.

0 comments on commit 69c7c94

Please sign in to comment.