Skip to content

Commit abcbadc

Browse files
sleepdefic1tfaustbrian
authored andcommitted
ci: add coverage workflow (#146)
1 parent f084247 commit abcbadc

File tree

6 files changed

+92
-11
lines changed

6 files changed

+92
-11
lines changed

.codeclimate.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
version: "2"
12
plugins:
23
cppcheck:
34
enabled: true
5+
config:
6+
check: all
7+
language: c++
8+
stds:
9+
- c++11
10+
includes:
11+
- src/
12+
- src/include/cpp-client
13+
exclude_patterns:
14+
- "extern/"
15+
- "test/"

.github/workflows/coverage.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- 'develop'
8+
pull_request:
9+
types: [ready_for_review, synchronize, opened]
10+
11+
jobs:
12+
codeclimate:
13+
runs-on: macOS-latest
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name: Set compiler to clang++
18+
run: COMPILER=clang++
19+
- name: Install Dependencies
20+
run: brew install cmake lcov
21+
- name: Make scripts executable
22+
run: sudo chmod +x ./.github/workflows/test/clang_tidy.sh
23+
- name: Setup Code Climate test-reporter
24+
run: |
25+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter
26+
chmod +x ./cc-test-reporter
27+
- name: Build & Run Coverage Tests
28+
run: |
29+
./cc-test-reporter before-build
30+
cmake -DCMAKE_BUILD_TYPE=Coverage -DUNIT_TEST=ON .
31+
cmake --build .
32+
./test/ark_cpp_client_tests
33+
lcov --directory . --include "*/src/*" --include "*/test/*" --exclude "*/src/lib/*" --exclude "*/extern/*" --capture --output-file coverage.info --ignore-errors gcov
34+
./cc-test-reporter format-coverage --input-type lcov coverage.info
35+
./cc-test-reporter upload-coverage
36+
env:
37+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
38+
39+
codecov:
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- uses: actions/checkout@v1
44+
- name: Install Dependencies
45+
run: |
46+
sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
47+
sudo apt-get update
48+
sudo apt-get -y install g++-7 gcc-7 lcov
49+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
50+
sudo update-alternatives --config gcc
51+
- name: Create Build directory
52+
run: mkdir build
53+
- name: Build
54+
run: |
55+
cd build
56+
cmake -DCMAKE_BUILD_TYPE=Coverage -DUNIT_TEST=ON ..
57+
cmake --build .
58+
- name: Run Coverage Tests
59+
run: ./build/test/ark_cpp_client_tests
60+
- name: Upload Coverage Report
61+
run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}

.github/workflows/test.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Test
33
on:
44
push:
55
branches:
6-
- "*"
7-
- "*/*"
6+
- 'master'
7+
- 'develop'
88
pull_request:
99
types: [ready_for_review, synchronize, opened]
1010

@@ -44,16 +44,14 @@ jobs:
4444
run: |
4545
sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
4646
sudo apt-get update
47-
sudo apt-get -y install g++-7 lcov cmake openssl
47+
sudo apt-get -y install g++-7 cmake openssl
4848
- name: Build
4949
run: |
5050
mkdir build && cd build
51-
cmake -DCMAKE_BUILD_TYPE=Coverage -DUNIT_TEST=ON ..
51+
cmake -DUNIT_TEST=ON ..
5252
cmake --build .
5353
- name: Run Tests
5454
run: ./build/test/ark_cpp_client_tests
55-
- name: Codecov upload
56-
run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}
5755

5856
linux-clang-5:
5957
runs-on: ubuntu-latest

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ endif()
2929

3030
# ------------------------------------------------------------------------------
3131

32+
# ------------------------------------------------------------------------------
33+
# Coverage 1:2
34+
# ------------------------------------------------------------------------------
35+
36+
if (CMAKE_BUILD_TYPE STREQUAL "Coverage")
37+
add_definitions(-Wno-unused-command-line-argument)
38+
endif() #CMAKE_BUILD_TYPE STREQUAL "Coverage"
39+
40+
# ------------------------------------------------------------------------------
41+
3242
# ------------------------------------------------------------------------------
3343
# Clang Tidy
3444
# ------------------------------------------------------------------------------

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
> A simple C++ API client for the Ark Blockchain.
88
9-
[![Build Status](https://badgen.now.sh/circleci/github/ArkEcosystem/cpp-client)](https://circleci.com/gh/ArkEcosystem/cpp-client)
10-
[![Codecov](https://badgen.now.sh/codecov/c/github/arkecosystem/cpp-client)](https://codecov.io/gh/arkecosystem/cpp-client)
11-
[![Latest Version](https://badgen.now.sh/github/release/ArkEcosystem/cpp-client)](https://github.com/ArkEcosystem/cpp-client/releases)
12-
[![License: MIT](https://badgen.now.sh/badge/license/MIT/green)](https://opensource.org/licenses/MIT)
9+
[![Test Actions](https://github.com/ArkEcosystem/cpp-client/workflows/Test/badge.svg)](https://github.com/ArkEcosystem/cpp-client/actions)
10+
[![Coverage Actions](https://github.com/ArkEcosystem/cpp-client/workflows/Coverage/badge.svg)](https://github.com/ArkEcosystem/cpp-client/actions)
11+
[![Latest Version](https://badgen.now.sh/github/release/ArkEcosystem/cpp-client?labelColor=black)](https://github.com/ArkEcosystem/cpp-client/releases)
12+
[![License: MIT](https://badgen.now.sh/badge/license/MIT/green?labelColor=black)](https://opensource.org/licenses/MIT)
1313

1414
> Lead Maintainer: [Simon Downey](https://github.com/sleepdefic1t)
1515

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ add_test(NAME test COMMAND ${PROJECT_NAME})
8989
# ------------------------------------------------------------------------------
9090

9191
# ------------------------------------------------------------------------------
92-
# Coverage
92+
# Coverage 2:2
9393
# ------------------------------------------------------------------------------
9494

9595
if (CMAKE_BUILD_TYPE STREQUAL "Coverage")

0 commit comments

Comments
 (0)