Skip to content

Commit 0d94bba

Browse files
committed
ci: fix ci pipeline and update cmake to just verify criterion is already installed
1 parent ad015a7 commit 0d94bba

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ jobs:
2323
sudo apt-get update
2424
sudo apt-get install -y \
2525
build-essential \
26-
cmake
26+
cmake \
27+
libcriterion-dev
2728
2829
- name: Configure CMake
2930
run: |
@@ -32,7 +33,7 @@ jobs:
3233
cmake ..
3334
3435
- name: Build
35-
run: cmake --build build
36+
run: cmake --build build --target xpscan_tests
3637

3738
- name: Run tests
38-
run: cd build && make test
39+
run: cd build && ./xpscan_tests

CMakeLists.txt

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,9 @@ set(CMAKE_CXX_STANDARD 17)
55
set(SOURCES src/Scanner.cpp src/Exporter.cpp src/Printer.cpp)
66
set(TEST_SOURCES tests/ExporterTest.cpp tests/ScannerTest.cpp tests/PrinterTest.cpp)
77

8-
# Fetch Criterion (Testing library)
9-
include(FetchContent)
10-
FetchContent_Declare(criterion
11-
GIT_REPOSITORY https://github.com/Snaipe/Criterion.git
12-
GIT_TAG v2.4.2
13-
GIT_SHALLOW TRUE
14-
GIT_PROGRESS TRUE
15-
)
16-
set(FETCHCONTENT_QUIET FALSE)
17-
FetchContent_MakeAvailable(criterion)
8+
# Find Criterion (Testing library)
9+
find_package(PkgConfig REQUIRED)
10+
pkg_check_modules(CRITERION REQUIRED criterion)
1811

1912
# Look for threads
2013
find_package(Threads REQUIRED)
@@ -28,7 +21,8 @@ target_link_libraries(xpscan PRIVATE Threads::Threads)
2821

2922
# Tests runner
3023
add_executable(xpscan_tests EXCLUDE_FROM_ALL ${TEST_SOURCES} ${SOURCES})
31-
target_link_libraries(xpscan_tests PRIVATE Threads::Threads criterion)
24+
target_include_directories(xpscan_tests PRIVATE ${CRITERION_INCLUDE_DIRS})
25+
target_link_libraries(xpscan_tests PRIVATE Threads::Threads ${CRITERION_LIBRARIES})
3226

3327
# Test target
3428
add_custom_target(test

0 commit comments

Comments
 (0)