Skip to content

Commit

Permalink
Move code coverage to GitHub Actions (#176)
Browse files Browse the repository at this point in the history
First step to move the build to GitHub Actions: move the coverage
generation from Travis to Actions. It doesn't generate additional
information with lcov anymore, and now always runs on the latest
available Ubuntu.

[ci skip]
  • Loading branch information
Morwenn committed Nov 23, 2020
1 parent a9c55e9 commit a030e31
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 23 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Coverage Upload to Codecov

on:
push:
branches:
- coverage-action
- master
- develop
- 2.0.0-develop
paths:
- 'include/**'
- 'testsuite/**'

env:
BUILD_TYPE: Debug

jobs:
upload-coverage:
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}
run: >
cmake -H${{github.event.repository.name}} -Bbuild
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
-DENABLE_COVERAGE=true
-G"Unix Makefiles"
- name: Build with coverage
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2

- name: Run the test suite
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C Release --output-on-failure

- name: Create coverage info
shell: bash
working-directory: ${{runner.workspace}}/build
run: make gcov

- name: Upload coverage info
shell: bash
working-directory: ${{runner.workspace}}/build
run: bash <(curl -s https://codecov.io/bash) -X gcov || echo "Codecov did not collect coverage reports";
23 changes: 0 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,6 @@ matrix:
env: BUILD_TYPE=Release CMAKE_GENERATOR="MinGW Makefiles"
compiler: gcc

# Code coverage
- os: linux
sudo: false
if: branch in (master, develop)
env: BUILD_TYPE=Debug CMAKE_GENERATOR="Unix Makefiles" ENABLE_COVERAGE=true
addons:
apt:
<<: *apt-common
packages:
- *gcc
- lcov
compiler: gcc

before_install:
- if [[ $TRAVIS_OS_NAME = "linux" && $CXX = "clang++" ]]; then
sudo ln -s $(which ccache) /usr/lib/ccache/clang++;
Expand Down Expand Up @@ -199,16 +186,6 @@ script:
cd ..;
fi

after_success:
- if [[ $TRAVIS_OS_NAME = "windows" ]]; then
cd build;
fi
- if [[ $ENABLE_COVERAGE = true ]]; then
make gcov;
make lcov;
bash <(curl -s https://codecov.io/bash) -X gcov || echo "Codecov did not collect coverage reports";
fi

after_failure:
- if [[ $TRAVIS_OS_NAME = "windows" ]]; then
cd build;
Expand Down

0 comments on commit a030e31

Please sign in to comment.