Skip to content

Commit

Permalink
replace codecov wiith coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
ygj6 committed Feb 2, 2020
1 parent d045200 commit 585f796
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .github/depends/boost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ EOL

build_boost()
{
BASE=`pwd`/..
./b2 -j4 --toolset=$1 --prefix=${BASE}/usr --libdir="${BASE}/usr/$1/lib$2" --with-chrono --with-context --with-filesystem --with-system --with-timer address-model=$2 install
prefix=$HOME/boost
./b2 -j4 --toolset=$1 --prefix=$prefix --libdir="$prefix/$1/lib$2" --with-chrono --with-context --with-filesystem --with-system --with-timer address-model=$2 install
}

bit="64"
Expand Down
34 changes: 34 additions & 0 deletions .github/depends/gtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

usage()
{
cat <<EOL
-b - 32-bit or 64-bit library, maybe 32, 64 or both
EOL
}

bit="64"

while getopts "b:" c; do
case "$c" in
b)
bit="$OPTARG"
[ "$bit" != "32" ] && [ "$bit" != "64" ] && [ "$bit" != "both" ] && usage && exit 1
;;
?*)
echo "invalid arguments." && exit 1
;;
esac
done

[ -z "$CXX" ] && CXX=g++

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
$CXX -m$bit src/gtest-all.cc -I. -Iinclude -c -fPIC
$CXX -m$bit src/gtest_main.cc -I. -Iinclude -c -fPIC
ar -rv libgtest.a gtest-all.o
ar -rv libgtest_main.a gtest_main.o
cp -r include/gtest /usr/local/include
mv *.a /usr/local/lib
57 changes: 24 additions & 33 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,45 @@
name: coverage

on: push
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- master
tags:
- '*'

jobs:

codecov:
coveralls:
timeout-minutes: 30
runs-on: ubuntu-latest
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2.0.0
- name: install depends
run: |
sudo apt-get update
sudo apt-get install g++-multilib lcov
sudo apt-get install g++-multilib lcov
- name: Cache boost
id: cache-boost
uses: actions/cache@v1
uses: actions/cache@v1.1.0
with:
path: usr
key: ${{ runner.os }}-boost-20200107
path: ~/boost
key: ${{ runner.os }}-boost-20200130
- 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 ..
# install gtest to /usr/local
sudo ./.github/depends/gtest.sh -b 64
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 ..
cmake -DCMAKE_PREFIX_PATH="${HOME}/boost/gcc/lib64/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 .
make coverage
- name: Coveralls GitHub Action
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./build/coverage.info.cleaned
54 changes: 14 additions & 40 deletions .github/workflows/gha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
matrix:
pattern: [0, 1, 2, 3]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2.0.0
- name: Cache boost
id: cache-boost
uses: actions/cache@v1
uses: actions/cache@v1.1.0
with:
path: usr
key: ${{ runner.os }}-boost-20200107
path: ~/boost
key: ${{ runner.os }}-boost-20200130
- name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: ./.github/depends/boost.sh -b 64 -t clang
Expand All @@ -32,8 +32,6 @@ jobs:
CXX: clang++
shell: bash
run: |
BASE=`pwd`;
# matrix config
if [ ${{ matrix.pattern }} == 0 ]; then
ACTION="ci/build_cmake.sh"
Expand Down Expand Up @@ -69,22 +67,11 @@ jobs:
export API_VERSION="2"
fi
# install gtest
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
$CXX -m${ARCH} src/gtest-all.cc -I. -Iinclude -c
$CXX -m${ARCH} src/gtest_main.cc -I. -Iinclude -c
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 ..
# install gtest to /usr/local
sudo ./.github/depends/gtest.sh -b ${ARCH}
# build and test
CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" CMAKE_PREFIX_PATH="${BASE}/usr/clang/lib${ARCH}/cmake" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" ${ACTION}
CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_PREFIX_PATH="${HOME}/boost/clang/lib${ARCH}/cmake" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" ${ACTION}
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
linux:
Expand All @@ -93,7 +80,7 @@ jobs:
matrix:
pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2.0.0
- name: install g++-multilib
run: |
sudo apt-get install g++-multilib
Expand All @@ -107,18 +94,16 @@ jobs:
sudo apt-get install valgrind
- name: Cache boost
id: cache-boost
uses: actions/cache@v1
uses: actions/cache@v1.1.0
with:
path: usr
key: ${{ runner.os }}-boost-20200107
path: ~/boost
key: ${{ runner.os }}-boost-20200130
- name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: ./.github/depends/boost.sh -b both -t gcc
- name: build and test
shell: bash
run: |
BASE=`pwd`;
# matrix config
if [ ${{ matrix.pattern }} == 0 ]; then
export CC=clang
Expand Down Expand Up @@ -237,27 +222,16 @@ jobs:
export ARCH="64"
fi
# install gtest
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
$CXX -m${ARCH} src/gtest-all.cc -I. -Iinclude -c -fPIC
$CXX -m${ARCH} 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 ..
# install gtest to /usr/local
sudo ./.github/depends/gtest.sh -b ${ARCH}
# install zlib
if [ ${ARCH} == 32 ]; then
sudo apt-get install lib32z1-dev
fi
# build and test
CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" CMAKE_PREFIX_PATH="${BASE}/usr/gcc/lib${ARCH}/cmake" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" MSGPACK_SAN="${SAN}" ${ACTION}
CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_PREFIX_PATH="${HOME}/boost/gcc/lib${ARCH}/cmake" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" MSGPACK_SAN="${SAN}" ${ACTION}
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
windows:
runs-on: windows-2016
Expand Down

0 comments on commit 585f796

Please sign in to comment.