Skip to content

Commit 30854b1

Browse files
author
Rastislav Turanyi
committed
Compile only tests in test CI
1 parent 61abf72 commit 30854b1

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

.github/workflows/run_tests.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,24 @@ jobs:
6565
BREW_PREFIX="$(brew --prefix)"
6666
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:"/opt/homebrew/opt/openblas"
6767
if [ $CC = "gcc" ]; then
68-
cmake -DCMAKE_C_COMPILER=${BREW_PREFIX}/bin/gcc-13 -DBLA_VENDOR=$BLAS_VENDOR -DBUILD_TESTING=ON -DBUILD_OPENMP_TESTS=ON -S . -B /tmp/build
68+
cmake \
69+
-DCMAKE_C_COMPILER=${BREW_PREFIX}/bin/gcc-13 \
70+
-DBLA_VENDOR=$BLAS_VENDOR \
71+
-DBUILD_TESTING=ON \
72+
-DBUILD_DOCS=OFF \
73+
-DBUILD_OPENMP_TESTS=ON \
74+
-DBUILD_REAL_DATA_TESTS=OFF \
75+
-DDISABLE_LIBRARY_BUILD \
76+
-S . -B /tmp/build
6977
else
70-
cmake -DBLA_VENDOR=$BLAS_VENDOR -DBUILD_TESTING=ON -DBUILD_OPENMP_TESTS=ON -S . -B /tmp/build
78+
cmake \
79+
-DBLA_VENDOR=$BLAS_VENDOR \
80+
-DBUILD_TESTING=ON \
81+
-DBUILD_DOCS=OFF \
82+
-DBUILD_OPENMP_TESTS=ON \
83+
-DBUILD_REAL_DATA_TESTS=OFF \
84+
-DDISABLE_LIBRARY_BUILD \
85+
-S . -B /tmp/build
7186
fi
7287
cmake --build /tmp/build
7388

CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ option(BUILD_DOCS "Build documentation" ON)
1717
include(CMakeDependentOption)
1818
include(CTest)
1919

20+
cmake_dependent_option(
21+
DISABLE_LIBRARY_BUILD
22+
"Disables building of the main library - only builds the tests"
23+
OFF
24+
BUILD_TESTING
25+
OFF
26+
)
27+
2028
cmake_dependent_option(
2129
BUILD_OPENMP_TESTS
2230
"In addition to normal tests, also builds and runs tests with OpenMP"
@@ -70,7 +78,7 @@ if(BUILD_TESTING)
7078
add_subdirectory(tests)
7179
endif()
7280

73-
message(STATUS "building ${PROJECT_NAME}, version ${PROJECT_VERSION}")
81+
message(STATUS "Building ${PROJECT_NAME}, version ${PROJECT_VERSION}")
7482

7583
include(GNUInstallDirs)
7684

@@ -79,8 +87,12 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
7987
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
8088

8189
##### MAIN #####
82-
add_subdirectory(src)
83-
add_subdirectory(dev)
90+
if(DISABLE_LIBRARY_BUILD)
91+
message(STATUS "Library build disabled - only building tests")
92+
else()
93+
add_subdirectory(src)
94+
add_subdirectory(dev)
95+
endif()
8496

8597
if(BUILD_DOCS)
8698
add_subdirectory(docs)

0 commit comments

Comments
 (0)