mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-07-03 01:05:22 +02:00
54 lines
1.8 KiB
YAML
54 lines
1.8 KiB
YAML
name: coverage
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
push:
|
|
branches:
|
|
- c_master
|
|
tags:
|
|
- '*'
|
|
|
|
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: 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_32BIT=OFF -DBUILD_SHARED_LIBS=ON -DMSGPACK_CHAR_SIGN=signed -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
|
|
run: |
|
|
# Create lcov report
|
|
lcov --capture --directory . --output-file coverage.info
|
|
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files
|
|
lcov --list coverage.info # debug info
|
|
# Uploading report to CodeCov
|
|
bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
|