Skip to content

Commit 59a323a

Browse files
authored
Merge pull request #163 from mutouyun/genspark_ai_developer
feat(ci): Add CodeCov test coverage to master branch
2 parents 5dd16c1 + a8e6c7e commit 59a323a

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

.github/workflows/codecov.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Upload CodeCov Report
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout Code
16+
uses: actions/checkout@v2
17+
18+
- name: Configure
19+
run: cmake -DCMAKE_BUILD_TYPE=Debug -DLIBIPC_BUILD_TESTS=ON -DLIBIPC_CODECOV=ON .
20+
21+
- name: Build
22+
run: make -j
23+
24+
- name: Test
25+
env:
26+
LD_LIBRARY_PATH: ./bin
27+
run: ./bin/test-ipc
28+
29+
- name: Upload coverage to Codecov
30+
uses: codecov/[email protected]
31+
with:
32+
verbose: true
33+
env:
34+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ option(LIBIPC_BUILD_TESTS "Build all of libipc's own tests."
55
option(LIBIPC_BUILD_DEMOS "Build all of libipc's own demos." OFF)
66
option(LIBIPC_BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
77
option(LIBIPC_USE_STATIC_CRT "Set to ON to build with static CRT on Windows (/MT)." OFF)
8+
option(LIBIPC_CODECOV "Build with unit test coverage." OFF)
89

910
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
1011
set(CMAKE_CXX_STANDARD 17)
@@ -13,6 +14,12 @@ if(NOT MSVC)
1314
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
1415
endif()
1516

17+
# Code coverage support
18+
if (LIBIPC_CODECOV AND NOT MSVC)
19+
add_compile_options(--coverage)
20+
add_link_options(-lgcov --coverage)
21+
endif()
22+
1623
if (MSVC)
1724
set(CompilerFlags
1825
CMAKE_CXX_FLAGS

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mutouyun/cpp-ipc/blob/master/LICENSE)
44
[![Build Status](https://github.com/mutouyun/cpp-ipc/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/mutouyun/cpp-ipc/actions)
5+
[![CodeCov](https://codecov.io/github/mutouyun/cpp-ipc/graph/badge.svg?token=MNOAOLNELH)](https://codecov.io/github/mutouyun/cpp-ipc)
56
[![Build status](https://ci.appveyor.com/api/projects/status/github/mutouyun/cpp-ipc?branch=master&svg=true)](https://ci.appveyor.com/project/mutouyun/cpp-ipc)
67
[![Vcpkg package](https://img.shields.io/badge/Vcpkg-package-blueviolet)](https://github.com/microsoft/vcpkg/tree/master/ports/cpp-ipc)
78

0 commit comments

Comments
 (0)