Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
os:
- ubuntu-latest
include:
- julia-version: 1
os: ubuntu-latest
cxx-coverage: true
# Add a few windows and macOS jobs (not too many, the number we can run in parallel is limited)
- julia-version: lts
os: macOS-latest
Expand All @@ -53,6 +56,8 @@ jobs:
update_packager_index: false
- name: "Build package"
uses: julia-actions/julia-buildpkg@v1
env:
NORMALIZ_JL_CXX_COVERAGE: ${{ matrix.cxx-coverage == true && 'true' || 'false' }}
- name: "Run tests"
uses: julia-actions/julia-runtest@v1
with:
Expand All @@ -70,11 +75,30 @@ jobs:

- name: "Process code coverage"
uses: julia-actions/julia-processcoverage@v1
- name: "Install gcovr"
if: ${{ matrix.cxx-coverage == true }}
run: python -m pip install gcovr
- name: "Process C++ coverage"
if: ${{ matrix.cxx-coverage == true }}
run: |
gcovr --version
gcovr \
--root "$PWD" \
--filter deps/src/normaliz.cpp \
--gcov-object-directory deps/src/build \
--exclude-throw-branches \
--xml-pretty \
--output coverage.xml \
--print-summary
- name: "Upload coverage data to Codecov"
continue-on-error: true
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
disable_search: true
fail_ci_if_error: true
verbose: true

docs:
name: Documentation
Expand Down
8 changes: 6 additions & 2 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ using normaliz_jll

# Parse some basic command-line arguments
const verbose = "--verbose" in ARGS
const cxx_coverage =
lowercase(get(ENV, "NORMALIZ_JL_CXX_COVERAGE", "false")) in
("1", "true", "yes", "on")

jlcxx_cmake_dir = joinpath(CxxWrap.prefix_path(), "lib", "cmake", "JlCxx")
julia_exec = joinpath(Sys.BINDIR, Base.julia_exename())
Expand Down Expand Up @@ -48,7 +51,8 @@ CMake_jll.cmake() do exe
run(`$exe
-DJulia_EXECUTABLE=$julia_exec
-DJlCxx_DIR=$jlcxx_cmake_dir
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_BUILD_TYPE=$(cxx_coverage ? "Debug" : "Release")
-DNORMALIZ_JULIA_ENABLE_COVERAGE=$(cxx_coverage ? "ON" : "OFF")
-Dnormaliz_prefix=$(jll_artifact_dir(normaliz_jll))
-Dgmp_prefix=$(jll_artifact_dir(normaliz_jll.GMP_jll))
-Dmpfr_prefix=$(jll_artifact_dir(normaliz_jll.MPFR_jll))
Expand All @@ -67,7 +71,7 @@ CMake_jll.cmake() do exe

run(`$exe
--build $(builddir)
--config Release
--config $(cxx_coverage ? "Debug" : "Release")
--
-j$(div(Sys.CPU_THREADS,2))
`)
Expand Down
14 changes: 14 additions & 0 deletions deps/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ set(CMAKE_CXX_STANDARD 14)

set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${JlCxx_location}")

option(NORMALIZ_JULIA_ENABLE_COVERAGE
"Build libnormaliz_julia with C++ coverage instrumentation" OFF)

include_directories(
${gmp_prefix}/include
${normaliz_prefix}/include
Expand All @@ -28,6 +31,17 @@ include_directories(

add_library(${JL_TARGET} SHARED normaliz.cpp)

if(NORMALIZ_JULIA_ENABLE_COVERAGE)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
message(STATUS "Building ${JL_TARGET} with C++ coverage flags")
target_compile_options(${JL_TARGET} PRIVATE --coverage -O0 -g)
target_link_libraries(${JL_TARGET} --coverage)
else()
message(FATAL_ERROR
"C++ coverage is only supported with GCC or Clang")
endif()
endif()

target_link_libraries(${JL_TARGET}
JlCxx::cxxwrap_julia
JlCxx::cxxwrap_julia_stl
Expand Down
15 changes: 15 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,21 @@ end
@test occursin("Complex", err.value.msg)
end

@testset "cone property output types" begin
@test String(Normaliz._cone_property_output_type("HilbertBasis")) == "Matrix"
@test String(Normaliz._cone_property_output_type("ExtremeRaysFloat")) == "MatrixFloat"
@test String(Normaliz._cone_property_output_type("Grading")) == "Vector"
@test String(Normaliz._cone_property_output_type("TriangulationDetSum")) == "Integer"
@test String(Normaliz._cone_property_output_type("ExternalIndex")) == "GMPInteger"
@test String(Normaliz._cone_property_output_type("Multiplicity")) == "Rational"
@test String(Normaliz._cone_property_output_type("RenfVolume")) == "FieldElem"
@test String(Normaliz._cone_property_output_type("EuclideanVolume")) == "Float"
@test String(Normaliz._cone_property_output_type("EmbeddingDim")) == "MachineInteger"
@test String(Normaliz._cone_property_output_type("IsPointed")) == "Bool"
@test String(Normaliz._cone_property_output_type("Triangulation")) == "Complex"
@test String(Normaliz._cone_property_output_type("DefaultMode")) == "Void"
end

# TODO: reactivate these tests once Renf support is back
#@testset "basic renf test" begin
# r = Normaliz.RenfClass("a4-5a2+5", "a", "1.9021+/-0.01")
Expand Down
Loading