File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Coverage
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+
8+ jobs :
9+ coverage :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - uses : actions/checkout@v4
14+
15+ - name : Install tools
16+ run : sudo apt-get update && sudo apt-get install -y lcov gcovr
17+
18+ # ---- BUILD ----
19+ - name : Configure
20+ run : cmake -DCOVERAGE=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON .
21+
22+ - name : Build
23+ run : make -j
24+
25+ # ---- RUN TESTS ----
26+ - name : Run tests
27+ run : |
28+ if [ -f "CTestTestfile.cmake" ]; then
29+ ctest --output-on-failure
30+ else
31+ bin/all_tests
32+ fi
33+
34+ # ---- GENERATE COVERAGE ----
35+ - name : Generate coverage
36+ run : |
37+ gcovr \
38+ --root . \
39+ --xml-pretty \
40+ --output coverage.xml \
41+ --exclude 'test/*' \
42+ --exclude 'build/*'
43+
44+ # ---- SEND TO COVERALLS ----
45+ - name : Upload to Coveralls
46+ uses : coverallsapp/github-action@v2
47+ with :
48+ github-token : ${{ secrets.GITHUB_TOKEN }}
49+ path-to-lcov : coverage.xml
Original file line number Diff line number Diff line change 1- #CMakeLists.txt file for cvx_presolver
21cmake_minimum_required (VERSION 3.20 )
32project (PSLP
4- LANGUAGES C CXX
3+ LANGUAGES C CXX # The library is written in C, but we also have some C++ test files
54 VERSION 0.1.0
65 DESCRIPTION "PSLP — A Lightweight C Presolver for Linear Programs"
76)
9594endif ()
9695
9796# Create PSLP library
98- add_library (PSLP ${CORE_SOURCES} )# ${PRIVATE_HEADERS})
97+ add_library (PSLP ${CORE_SOURCES} )
9998target_include_directories (PSLP
10099 PUBLIC
101100 $<BUILD_INTERFACE :${CMAKE_CURRENT_SOURCE_DIR } /include /PSLP >
@@ -126,7 +125,7 @@ else()
126125endif ()
127126
128127# Testing
129- option (BUILD_TESTING "Build tests" ON )
128+ option (BUILD_TESTING "Build tests" OFF )
130129if (BUILD_TESTING)
131130 include (CTest )
132131 enable_testing ()
@@ -158,6 +157,15 @@ else()
158157 message (STATUS "Testing disabled" )
159158endif ()
160159
160+ option (COVERAGE "Enable coverage reporting" OFF )
161+
162+ if (COVERAGE)
163+ message (STATUS "Building with coverage flags" )
164+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS } -O0 -g --coverage" )
165+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS } --coverage" )
166+ set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS } --coverage" )
167+ endif ()
168+
161169add_executable (test_cpp EXCLUDE_FROM_ALL tests/test_cpp.cpp )
162170target_link_libraries (test_cpp PRIVATE PSLP )
163171
Original file line number Diff line number Diff line change 3535#define HUGE_BOUND_ARG , huge_bound_ok
3636#endif
3737
38- // OBS: The macros should be wrapped inside a DEBUG when use
39-
4038#ifndef NDEBUG
4139#define DEBUG (code ) \
4240 do \
You can’t perform that action at this time.
0 commit comments