Skip to content

Commit

Permalink
Simplify workflow, use CTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
stripe2933 committed Dec 25, 2023
1 parent 2d3a723 commit 23a6fdf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
37 changes: 18 additions & 19 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,29 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: macos-latest

steps:
- name: Checkout code
- name: checkout
uses: actions/checkout@v4

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: 17

- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Get LLVM 17 via Homebrew
run: |
brew install llvm@17
- name: Build project
- name: configure
run: |
mkdir build
cmake -S . -B build -G Ninja \
-DCMAKE_CXX_COMPILER=${{ env.LLVM_PATH }}/bin/clang++ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -stdlib=libc++ -v" \
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi"
ninja -C build
cmake -S . -B build \
-DCMAKE_C_COMPILER=$(brew --prefix llvm@17)/bin/clang \
-DCMAKE_CXX_COMPILER=$(brew --prefix llvm@17)/bin/clang++ \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -stdlib=libc++ -v" \
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi"
- name: build
run: |
cmake --build build --config Release -j4
- name: Run tests
- name: test
run: |
cd build/test
./mdspan_formatter_test
ctest --test-dir build/test --build-config Release
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ target_link_libraries(${PROJECT_NAME} INTERFACE std::mdspan)

# Set MDSPAN_FORMATTER_BUILD_TEST flag if it is unset and project is top-level project.
if (NOT DEFINED MDSPAN_FORMATTER_BUILD_TEST)
set(MDSPAN_FORMATTER_BUILD_TEST (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR))
set(MDSPAN_FORMATTER_BUILD_TEST ${PROJECT_IS_TOP_LEVEL})
endif()

if (MDSPAN_FORMATTER_BUILD_TEST)
Expand Down
8 changes: 7 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@ FetchContent_Declare(
FIND_PACKAGE_ARGS NAMES ut
)
FetchContent_MakeAvailable(ut)
target_compile_definitions(ut INTERFACE BOOST_UT_DISABLE_MODULE)

add_executable(mdspan_formatter_test main.cpp)
target_link_libraries(mdspan_formatter_test
PRIVATE
mdspan_formatter
fmt::fmt Boost::ut
)
)

include(CTest)
enable_testing()

add_test(add_test mdspan_formatter_test)

0 comments on commit 23a6fdf

Please sign in to comment.