This is an automated email from the ASF dual-hosted git repository.
wangwei pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/singa.git
The following commit(s) were added to refs/heads/dev by this push:
new 0c86657 Add code coverage for C++
new a93aaee Merge pull request #782 from moazreyad/dev
0c86657 is described below
commit 0c8665740379dc91343e72a2e43b0c2f2cb0666e
Author: Moaz Reyad <[email protected]>
AuthorDate: Thu Aug 27 17:13:19 2020 +0200
Add code coverage for C++
---
.github/workflows/cpp.yaml | 6 ++++--
CMakeLists.txt | 1 +
README.md | 1 +
src/CMakeLists.txt | 5 +++++
4 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/cpp.yaml b/.github/workflows/cpp.yaml
index cdd7268..8c03db9 100644
--- a/.github/workflows/cpp.yaml
+++ b/.github/workflows/cpp.yaml
@@ -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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd67c9f..ba3102c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/README.md b/README.md
index 12ff207..b11fb5a 100644
--- a/README.md
+++ b/README.md
@@ -45,6 +45,7 @@ Distributed deep learning system


+[](https://codecov.io/gh/apache/singa)
[](https://starchart.cc/apache/singa)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0752496..5f30299 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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")