Skip to content

Commit a07c986

Browse files
Discover tests in CMake to be found by workflow
1 parent 25982da commit a07c986

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

.github/workflows/cmake-multi-platform.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
- name: Install Clang 20
4747
if: matrix.os == 'ubuntu-latest' && matrix.c_compiler == 'clang'
4848
run: |
49+
wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
4950
sudo add-apt-repository "deb http://apt.llvm.org/plucky/ llvm-toolchain-plucky-20 main"
5051
sudo apt-get update
5152
sudo apt-get install -y clang-20
@@ -56,7 +57,7 @@ jobs:
5657
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
5758
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
5859
run: >
59-
cmake -B ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_CXX_COMPILER=${{ env.CXX_COMPILER }} -DCMAKE_C_COMPILER=${{ env.C_COMPILER }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -S ${{ github.workspace }}
60+
cmake -B ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_CXX_COMPILER=${{ env.CXX_COMPILER }} -DCMAKE_C_COMPILER=${{ env.C_COMPILER }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSIMPLY_INSTALL_PRE_COMMIT_HOOKS=OFF -S ${{ github.workspace }}
6061
6162
- name: Build
6263
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ target_compile_features(simply INTERFACE cxx_std_26)
2525

2626
target_include_directories(simply INTERFACE include)
2727

28+
enable_testing()
29+
2830
add_subdirectory(tests)

tests/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include(FetchContent)
2+
include(GoogleTest)
23

34
FetchContent_Declare(
45
googletest
@@ -12,3 +13,4 @@ target_link_libraries(counters simply)
1213

1314
add_executable(stream stream.cpp)
1415
target_link_libraries(stream simply GTest::gtest_main)
16+
gtest_discover_tests(stream)

0 commit comments

Comments
 (0)