Skip to content

Commit

Permalink
Fix intrusive_ptr test breakage in dependencies (#131)
Browse files Browse the repository at this point in the history
* Fix intrusive_ptr test breakage in dependencies

* make tests optional, defaulted to OFF

* ensure testing is enabled across entire CI matrix

* fix ninja CI variant

* do spaces in Github expressions avoid flaky behavior?

* add build-type Release back

* resolve matrix confusion

* give global cmake flags a name
  • Loading branch information
fhackett authored Aug 20, 2024
1 parent e9e2902 commit 629bed1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ on:
pull_request:
branches: [ "main" ]

env:
global-cmake-flags: -DTRIESTE_ENABLE_TESTING=1

jobs:
build-test:
strategy:
matrix:
platform: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
build-type: [ "Release", "Debug" ]
# Note: cmake-options is missing here on purpose to let it be overridden by includes
standard: [ "", "-DTRIESTE_USE_CXX17=ON" ]
compiler: [ "", "clang" ]
variant: [""]

include:
# ensures ubuntu-latest clang uses Ninja (modifies the matrix entry)
- platform: "ubuntu-latest"
compiler: "clang"
cmake-options: "-DCMAKE_CXX_COMPILER=clang++-15 -DCMAKE_C_COMPILER=clang-15 -DTRIESTE_BUILD_PARSER_TESTS=1"
Expand Down Expand Up @@ -62,10 +67,10 @@ jobs:
- uses: actions/checkout@v3

- name: Install build dependencies
run: ${{ matrix.dependencies }}
run: ${{matrix.dependencies}}

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{matrix.generator}} ${{matrix.standard}} ${{matrix.cmake-options}}
run: cmake -B ${{github.workspace}}/build ${{env.global-cmake-flags}} -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{matrix.generator}} ${{matrix.standard}} ${{matrix.cmake-options}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build-type}}
Expand Down
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(trieste VERSION 1.0.0 LANGUAGES CXX)

# #############################################
# Options
option(TRIESTE_ENABLE_TESTING "Specifies whether to enable Trieste's tests" OFF)
option(TRIESTE_BUILD_SAMPLES "Specifies whether to build the samples" ON)
option(TRIESTE_BUILD_PARSERS "Specifies whether to build the parsers" ON)
option(TRIESTE_BUILD_PARSER_TESTS "Specifies whether to build the parser tests" OFF)
Expand Down Expand Up @@ -175,12 +176,15 @@ export(PACKAGE trieste)

# #############################################
# # Add core Trieste tests
enable_testing()
add_subdirectory(test)
if(TRIESTE_ENABLE_TESTING)
enable_testing()
add_subdirectory(test)
endif()

# #############################################
# # Add samples
if(TRIESTE_BUILD_SAMPLES)
enable_testing()
add_subdirectory(samples/infix)
endif()

Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT TRIESTE_SANITIZE)
target_link_libraries(trieste_intrusive_ptr_test -fsanitize=thread)
endif()

add_test(NAME trieste_intrusive_ptr_test COMMAND trieste_intrusive_ptr_test)
add_test(NAME trieste_intrusive_ptr_test COMMAND trieste_intrusive_ptr_test WORKING_DIRECTORY $<TARGET_FILE_DIR:trieste_intrusive_ptr_test>)

0 comments on commit 629bed1

Please sign in to comment.