Skip to content

Commit

Permalink
Add code coverage for C++
Browse files Browse the repository at this point in the history
  • Loading branch information
moazreyad committed Aug 27, 2020
1 parent da34a59 commit 0c86657
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ jobs:
- name: get-oneDNN
run: wget https://github.com/oneapi-src/oneDNN/releases/download/v1.1/dnnl_lnx_1.1.0_cpu_gomp.tgz -P /tmp/ && tar zxf /tmp/dnnl_lnx_1.1.0_cpu_gomp.tgz -C /tmp
- name: install-build-dependencies
run: sudo apt-get install -y libgoogle-glog-dev libprotobuf-dev protobuf-compiler libncurses-dev libopenblas-dev gfortran libblas-dev liblapack-dev libatlas-base-dev swig libcurl3-dev cmake dh-autoreconf
run: sudo apt-get install -y libgoogle-glog-dev libprotobuf-dev protobuf-compiler libncurses-dev libopenblas-dev gfortran libblas-dev liblapack-dev libatlas-base-dev swig dh-autoreconf lcov
- name: configure
run: mkdir build && cd build && cmake -DUSE_PYTHON=NO -DENABLE_TEST=YES -DUSE_DNNL=YES ..
run: mkdir build && cd build && cmake -DUSE_PYTHON=NO -DENABLE_TEST=YES -DCODE_COVERAGE=YES -DUSE_DNNL=YES ..
env:
DNNL_ROOT: /tmp/dnnl_lnx_1.1.0_cpu_gomp/
- name: build
run: cd build && make
- name: C++ test
run: build/bin/test_singa
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ INCLUDE_DIRECTORIES(${SINGA_INCLUDE_DIR})

OPTION(USE_CUDA "Use Cuda libs" OFF)
OPTION(ENABLE_TEST "Enable unit test" OFF)
option(CODE_COVERAGE "Enable coverage reporting" OFF)
OPTION(USE_PYTHON "Generate py wrappers" ON)
OPTION(USE_PYTHON3 "Python 3x" OFF)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Distributed deep learning system

![LGTM C++ Grade](https://img.shields.io/lgtm/grade/cpp/github/apache/incubator-singa)
![LGTM Python Grade](https://img.shields.io/lgtm/grade/python/github/apache/incubator-singa)
[![codecov](https://codecov.io/gh/apache/singa/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/singa)

[![Stargazers over time](https://starchart.cc/apache/singa.svg)](https://starchart.cc/apache/singa)

Expand Down
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ IF(UNIX OR APPLE)
SET_TARGET_PROPERTIES(singa PROPERTIES LINK_FLAGS "")
ENDIF()

IF(CODE_COVERAGE)
MESSAGE("-- Enabling Code Coverage")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g --coverage")
ENDIF(CODE_COVERAGE)

#pass configure infor to swig
FILE(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/api/config.i")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/api/config.i.in" "${CMAKE_CURRENT_SOURCE_DIR}/api/config.i")
Expand Down

0 comments on commit 0c86657

Please sign in to comment.