Skip to content

Commit c0fb6b3

Browse files
committed
integrate coverage in github actions
1 parent 19df331 commit c0fb6b3

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.github/workflows/coverage.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: coverage
2+
3+
on: push
4+
5+
jobs:
6+
7+
codecov:
8+
timeout-minutes: 30
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: install depends
14+
run: |
15+
sudo apt-get update
16+
sudo apt-get install g++-multilib lcov
17+
- name: Cache boost
18+
id: cache-boost
19+
uses: actions/cache@v1
20+
with:
21+
path: usr
22+
key: ${{ runner.os }}-boost-20200107
23+
- name: Build boost
24+
if: steps.cache-boost.outputs.cache-hit != 'true'
25+
run: ./.github/depends/boost.sh -b both -t gcc
26+
- name: Compile tests
27+
run: |
28+
# install gtest
29+
BASE=`pwd`
30+
wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
31+
unzip -q googletest-release-1.7.0.zip
32+
cd googletest-release-1.7.0
33+
g++ -m64 src/gtest-all.cc -I. -Iinclude -c -fPIC
34+
g++ -m64 src/gtest_main.cc -I. -Iinclude -c -fPIC
35+
ar -rv libgtest.a gtest-all.o
36+
ar -rv libgtest_main.a gtest_main.o
37+
mkdir -p ${BASE}/usr/include
38+
cp -r include/gtest ${BASE}/usr/include
39+
mkdir -p ${BASE}/usr/lib
40+
mv *.a ${BASE}/usr/lib
41+
cd ..
42+
43+
mkdir build && cd build
44+
CMAKE_LIBRARY_PATH="${BASE}/build" GTEST_ROOT="${BASE}/usr" CMAKE_PREFIX_PATH="${BASE}/usr/gcc/lib64/cmake" cmake -DMSGPACK_CXX17=ON -DMSGPACK_32BIT=OFF -DMSGPACK_BOOST=ON -DBUILD_SHARED_LIBS=ON -DMSGPACK_CHAR_SIGN=signed -DMSGPACK_USE_X3_PARSE=ON -DMSGPACK_ENABLE_CXX=ON -DMSGPACK_BUILD_EXAMPLES=ON -DMSGPACK_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DMSGPACK_GEN_COVERAGE=ON ..
45+
make -j4
46+
make test
47+
- name: Upload coverage to Codecov
48+
working-directory: build
49+
env:
50+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
51+
run: |
52+
wget https://codecov.io/bash -O codecov
53+
chmod +x codecov
54+
./codecov -t $CODECOV_TOKEN -B $GITHUB_REF -s .

README.md

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

44
Version 3.2.1 [![Build Status](https://travis-ci.org/msgpack/msgpack-c.svg?branch=master)](https://travis-ci.org/msgpack/msgpack-c) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/master)
5+
[![codecov](https://codecov.io/gh/msgpack/msgpack-c/branch/master/graph/badge.svg)](https://codecov.io/gh/msgpack/msgpack-c)
56

67
It's like JSON but smaller and faster.
78

0 commit comments

Comments
 (0)