Skip to content

Commit 8d158b3

Browse files
committed
CI-tests
1 parent 0af9d90 commit 8d158b3

4 files changed

Lines changed: 75 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build-and-test:
9+
name: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [ubuntu-24.04, macos-14, windows-2022]
14+
runs-on: ${{ matrix.os }}
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
# Python is needed for the pystark bindings (nanobind extension module).
20+
- name: Set up Python
21+
id: python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.12'
25+
26+
# Apple Clang ships without OpenMP; install it via Homebrew.
27+
- name: Install OpenMP (macOS)
28+
if: runner.os == 'macOS'
29+
run: brew install libomp
30+
31+
# ── Configure ──────────────────────────────────────────────────────────
32+
33+
- name: Configure CMake (Linux / Windows)
34+
if: runner.os != 'macOS'
35+
shell: bash
36+
run: |
37+
cmake -S . -B build \
38+
-DCMAKE_BUILD_TYPE=Release \
39+
-DSTARK_BUILD_EXAMPLES=ON \
40+
-DSTARK_BUILD_TESTS=ON \
41+
-DSTARK_BUILD_PYTHON_BINDINGS=ON \
42+
-DSTARK_PYTHON_EXECUTABLE="${{ steps.python.outputs.python-path }}"
43+
44+
# On macOS, CMake cannot find libomp automatically; supply the paths
45+
# that Homebrew installs it to.
46+
- name: Configure CMake (macOS)
47+
if: runner.os == 'macOS'
48+
shell: bash
49+
run: |
50+
LIBOMP="$(brew --prefix libomp)"
51+
cmake -S . -B build \
52+
-DCMAKE_BUILD_TYPE=Release \
53+
-DSTARK_BUILD_EXAMPLES=ON \
54+
-DSTARK_BUILD_TESTS=ON \
55+
-DSTARK_BUILD_PYTHON_BINDINGS=ON \
56+
-DSTARK_PYTHON_EXECUTABLE="${{ steps.python.outputs.python-path }}" \
57+
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I${LIBOMP}/include" \
58+
-DOpenMP_CXX_LIB_NAMES=omp \
59+
"-DOpenMP_omp_LIBRARY=${LIBOMP}/lib/libomp.dylib"
60+
61+
# ── Build ──────────────────────────────────────────────────────────────
62+
63+
- name: Build
64+
run: cmake --build build --config Release --parallel
65+
66+
# ── Test ───────────────────────────────────────────────────────────────
67+
68+
# --build-config is ignored by single-config generators (Make/Ninja) and
69+
# selects the Release configuration on multi-config generators (MSVC).
70+
- name: Test
71+
run: ctest --test-dir build --build-config Release --output-on-failure

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ if(STARK_BUILD_EXAMPLES)
3636
endif()
3737

3838
if(STARK_BUILD_TESTS)
39+
include(CTest)
3940
add_subdirectory(tests)
4041
endif()
4142

pystark/cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ FetchContent_Declare(
2626
nanobind
2727
GIT_REPOSITORY https://github.com/wjakob/nanobind.git
2828
GIT_TAG ${STARK_NANOBIND_GIT_TAG}
29+
GIT_SHALLOW TRUE
2930
)
3031

3132
FetchContent_MakeAvailable(nanobind)

tests/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ target_link_libraries(stark_tests PRIVATE Catch2::Catch2WithMain)
1919

2020
# Define directory paths
2121
target_compile_definitions(stark_tests PUBLIC STARK_TESTS_OUTPUT_DIR="${CMAKE_BINARY_DIR}/output")
22+
23+
add_test(NAME stark_tests COMMAND stark_tests)

0 commit comments

Comments
 (0)