Skip to content

Commit f316d69

Browse files
committed
Update workflows
1 parent ab440f0 commit f316d69

File tree

6 files changed

+13
-28
lines changed

6 files changed

+13
-28
lines changed

.github/workflows/examples.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,8 @@ jobs:
4646
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
4747
-S ${{ github.workspace }}/examples
4848
49-
- name: Build and run examples
50-
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target examples
49+
- name: Build
50+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
51+
52+
- name: Run tests
53+
run: ctest --test-dir ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: release
22
permissions:
33
contents: write
44

.github/workflows/tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ jobs:
4646
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
4747
-S ${{ github.workspace }}
4848
49-
- name: Build and run tests
50-
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target tests
49+
- name: Build
50+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
51+
52+
- name: Run tests
53+
run: ctest --test-dir ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
5154

5255
lint:
5356
runs-on: ubuntu-latest

CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,13 @@ endif()
2828
option(TRAITS_BUILD_EXAMPLES "whether or not examples should be built" ON)
2929
option(TRAITS_BUILD_TESTS "whether or not tests should be built" ON)
3030

31-
if(TRAITS_BUILD_EXAMPLES OR TRAITS_BUILD_TESTS)
32-
enable_testing()
33-
add_custom_target(check COMMENT "build and run tests and examples")
34-
endif()
35-
3631
if(TRAITS_BUILD_EXAMPLES)
3732
add_subdirectory(examples)
38-
add_dependencies(check examples)
3933
endif()
4034

4135
if(TRAITS_BUILD_TESTS)
36+
enable_testing()
4237
add_subdirectory(tests)
43-
add_dependencies(check tests)
4438
endif()
4539

4640
set(package_files examples/ include/ tests/ CMakeLists.txt LICENSE README.md)

examples/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,11 @@ endif()
1212

1313
enable_testing()
1414

15-
add_custom_target(examples
16-
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
17-
COMMENT "build and run examples"
18-
USES_TERMINAL
19-
)
20-
2115
set (EXAMPLES quickstart readme)
2216

2317
foreach(EXAMPLE IN LISTS EXAMPLES)
24-
add_executable(${EXAMPLE} EXCLUDE_FROM_ALL "${EXAMPLE}.cpp")
18+
add_executable(${EXAMPLE} "${EXAMPLE}.cpp")
2519
target_link_libraries(${EXAMPLE} PRIVATE Traits::traits)
2620

2721
add_test(NAME ${EXAMPLE} COMMAND $<TARGET_FILE:${EXAMPLE}>)
28-
add_dependencies(examples ${EXAMPLE})
2922
endforeach()

tests/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ FetchContent_MakeAvailable(googletest)
1111

1212
enable_testing()
1313

14-
add_custom_target(tests
15-
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
16-
COMMENT "build and run all unit tests"
17-
USES_TERMINAL
18-
)
19-
2014
set (TESTS
2115
function_type
2216
)
@@ -28,8 +22,6 @@ foreach(TEST IN LISTS TESTS)
2822
PRIVATE GTest::gtest_main
2923
)
3024

31-
add_dependencies(tests ${TEST})
32-
3325
gtest_discover_tests(${TEST})
3426
endforeach()
3527

0 commit comments

Comments
 (0)