integrate coverage in github actions

This commit is contained in:
yuangongji 2020-01-11 13:36:01 +08:00
parent 19df3314f4
commit c0fb6b3b8c
2 changed files with 55 additions and 0 deletions

54
.github/workflows/coverage.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: coverage
on: push
jobs:
codecov:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install depends
run: |
sudo apt-get update
sudo apt-get install g++-multilib lcov
- name: Cache boost
id: cache-boost
uses: actions/cache@v1
with:
path: usr
key: ${{ runner.os }}-boost-20200107
- name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: ./.github/depends/boost.sh -b both -t gcc
- name: Compile tests
run: |
# install gtest
BASE=`pwd`
wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
unzip -q googletest-release-1.7.0.zip
cd googletest-release-1.7.0
g++ -m64 src/gtest-all.cc -I. -Iinclude -c -fPIC
g++ -m64 src/gtest_main.cc -I. -Iinclude -c -fPIC
ar -rv libgtest.a gtest-all.o
ar -rv libgtest_main.a gtest_main.o
mkdir -p ${BASE}/usr/include
cp -r include/gtest ${BASE}/usr/include
mkdir -p ${BASE}/usr/lib
mv *.a ${BASE}/usr/lib
cd ..
mkdir build && cd build
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 ..
make -j4
make test
- name: Upload coverage to Codecov
working-directory: build
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
wget https://codecov.io/bash -O codecov
chmod +x codecov
./codecov -t $CODECOV_TOKEN -B $GITHUB_REF -s .

View File

@ -2,6 +2,7 @@
===================
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)
[![codecov](https://codecov.io/gh/msgpack/msgpack-c/branch/master/graph/badge.svg)](https://codecov.io/gh/msgpack/msgpack-c)
It's like JSON but smaller and faster.