Skip to content

Commit

Permalink
[C++] Extended codecov for tiledbsoma library
Browse files Browse the repository at this point in the history
  • Loading branch information
beroy committed Dec 12, 2023
1 parent 1b6688b commit ddaa1b3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/libtiledb-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: libTileDB-SOMA CodeCov

on:
pull_request:
paths-ignore:
- "apis/python/**"
- "apis/r/**"
- ".pre-commit-config.yaml"
push:
branches:
- main
- 'release-*'
workflow_dispatch:

jobs:
codecov:
runs-on: macos-latest
steps:
- name: Checkout TileDB-SOMA
uses: actions/checkout@v3
- name: Build libTileDB-SOMA
run: TILEDBSOMA_COVERAGE="--coverage" ./scripts/bld
- name: Run libTileDB-SOMA unittests
run: ctest --test-dir build/libtiledbsoma -C Release --verbose --rerun-failed --output-on-failur
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
gcov: true
flags: libtiledbsoma
gcov_include: $(find libtiledbsoma/src -name "*.cc")
7 changes: 7 additions & 0 deletions libtiledbsoma/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ message(STATUS "Starting TileDB-SOMA build.")

set(TILEDBSOMA_INSTALL_TARGETS "")

# ###########################################################
# Adding coverage flags
# ###########################################################

set(CMAKE_CXX_FLAGS "$ENV{TILEDBSOMA_COVERAGE}")
set(CMAKE_C_FLAGS "$ENV{TILEDBSOMA_COVERAGE}")

# ###########################################################
# Find required dependencies
# See ../cmake/Modules/*.cmake for provenance/version info
Expand Down
6 changes: 6 additions & 0 deletions libtiledbsoma/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
get_filename_component(TILEDBSOMA_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../" ABSOLUTE)
add_compile_definitions(TILEDBSOMA_SOURCE_ROOT="${TILEDBSOMA_SOURCE_ROOT}")

# ###########################################################
# Adding coverage flags
# ###########################################################
set(CMAKE_CXX_FLAGS "$ENV{TILEDBSOMA_COVERAGE}")
set(CMAKE_C_FLAGS "$ENV{TILEDBSOMA_COVERAGE}")

############################################################
# Dependencies
############################################################
Expand Down
11 changes: 7 additions & 4 deletions scripts/bld
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ cd "$(dirname "$0")/.."

rm -rf build
mkdir -p build
cmake -B build -S libtiledbsoma -DCMAKE_BUILD_TYPE=${build} ${extra_opts}
cmake --build build -j ${nproc}
cmake --build build --target install-libtiledbsoma
cmake --build build/libtiledbsoma --target build_tests -j ${nproc}

if [ -z ${TILEDBSOMA_COVERAGE+x} ]; then TILEDBSOMA_COVERAGE=""; fi

TILEDBSOMA_COVERAGE="${TILEDBSOMA_COVERAGE}" cmake -B build -S libtiledbsoma -DCMAKE_BUILD_TYPE=${build} ${extra_opts}
TILEDBSOMA_COVERAGE="${TILEDBSOMA_COVERAGE}" cmake --build build -j ${nproc}
TILEDBSOMA_COVERAGE="${TILEDBSOMA_COVERAGE}" cmake --build build --target install-libtiledbsoma
TILEDBSOMA_COVERAGE="${TILEDBSOMA_COVERAGE}" cmake --build build/libtiledbsoma --target build_tests -j ${nproc}

0 comments on commit ddaa1b3

Please sign in to comment.