From 777dcf477baccfbe694c85d1b55d48dcbc1e4b8b Mon Sep 17 00:00:00 2001 From: Avinal Kumar Date: Sun, 28 Feb 2021 14:24:56 +0530 Subject: [PATCH] ci: Add Codecov to GitHub Actions (#564) Delete coverage.sh as unused Closes #565 --- .ci/coverage.sh | 7 ----- .github/workflows/coverage.yml | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 7 deletions(-) delete mode 100644 .ci/coverage.sh create mode 100644 .github/workflows/coverage.yml diff --git a/.ci/coverage.sh b/.ci/coverage.sh deleted file mode 100644 index 42ff3e703f..0000000000 --- a/.ci/coverage.sh +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/bash -set -e -lcov --directory bin.v2 --capture --no-external --directory $(pwd) --output-file coverage.info > /dev/null 2>&1 -lcov --extract coverage.info $(pwd)'/boost/gil/*' --output-file coverage.info > /dev/null -lcov --list coverage.info -cd libs/gil -bash <(curl -s https://codecov.io/bash) -f ../../coverage.info || echo "Codecov did not collect coverage reports" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000000..c538be936d --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,55 @@ +name: Code Coverage + +on: + pull_request: + push: + branches: + - master + - develop + +env: + LIBRARY: gil + UBSAN_OPTIONS: print_stacktrace=1 + +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: install packages + run: | + sudo apt update + sudo apt install g++ libpng-dev libjpeg-dev libtiff5-dev libraw-dev lcov python -y + + - name: Setup Boost + run: | + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + ./bootstrap.sh + ./b2 -d0 headers + + - name: Create user-config.jam + run: | + echo "using gcc : : g++ ;" > ~/user-config.jam + + - name: Run tests + run: | + cd ../boost-root + ./b2 -j3 libs/$LIBRARY/test coverage=on toolset=gcc cxxstd=11 variant=debug + lcov --directory bin.v2 --capture --no-external --directory $(pwd) --output-file coverage.info > /dev/null 2>&1 + lcov --extract coverage.info $(pwd)'/boost/gil/*' --output-file coverage.info > /dev/null + lcov --list coverage.info + + - name: Upload to Codecov + uses: codecov/codecov-action@v1.2.1 + with: + files: ../boost-root/coverage.info + \ No newline at end of file