Skip to content

Commit 7dc2fb6

Browse files
authored
new workflow (#10)
* code dump * workflows * ran formatter * readme * workflow * removed old workflows * new workflow * c++ workflow * C++ workflow * new line at eof to formatter * improved interface * new workflow * new workflow * new workflow
1 parent 8be3dd6 commit 7dc2fb6

3 files changed

Lines changed: 61 additions & 6 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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

CMakeLists.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
#CMakeLists.txt file for cvx_presolver
21
cmake_minimum_required(VERSION 3.20)
32
project(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
)
@@ -95,7 +94,7 @@ else()
9594
endif()
9695

9796
# Create PSLP library
98-
add_library(PSLP ${CORE_SOURCES})# ${PRIVATE_HEADERS})
97+
add_library(PSLP ${CORE_SOURCES})
9998
target_include_directories(PSLP
10099
PUBLIC
101100
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/PSLP>
@@ -126,7 +125,7 @@ else()
126125
endif()
127126

128127
# Testing
129-
option(BUILD_TESTING "Build tests" ON)
128+
option(BUILD_TESTING "Build tests" OFF)
130129
if(BUILD_TESTING)
131130
include(CTest)
132131
enable_testing()
@@ -158,6 +157,15 @@ else()
158157
message(STATUS "Testing disabled")
159158
endif()
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+
161169
add_executable(test_cpp EXCLUDE_FROM_ALL tests/test_cpp.cpp)
162170
target_link_libraries(test_cpp PRIVATE PSLP)
163171

include/core/debug_macros.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
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 \

0 commit comments

Comments
 (0)