Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate weekly coverage report for C++ code #2786

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@

name: Weekly Coverage Analysis

on:
workflow_dispatch:
# Run this every Sunday at midnight
schedule:
- cron: "0 0 * * 0"
# IMPORTANT: remove this before merging
pull_request:

jobs:
linux-clang-build:
runs-on: ubuntu-latest

env:
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_SIZE: "2G"

steps:
- uses: actions/checkout@v1
with:
submodules: true
ref: dev

- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install gcovr libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3

- name: Get CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: '3.16.3'

- name: Print CMake version
run: cmake --version

- name: configure
run: >
cmake
-B build
-G Ninja
-D CMAKE_BUILD_TYPE=Debug
-D MRTRIX_BUILD_TESTS=ON
-D CMAKE_CXX_FLAGS="--coverage"

- name: build
run: cmake --build build

- name: Unit tests
run: cd build && ctest -R unit --output-on-failure

- name: Binary tests
run: cd build && ctest -R bin --output-on-failure

- name: Report coverage
run: >
gcovr ${{ github.workspace }}/build
--root ${{ github.workspace }}
--exclude ${{ github.workspace }}/build

- name: Generate html report
run: >
mkdir report &&
gcovr ${{ github.workspace }}/build
--root ${{ github.workspace }}
--exclude ${{ github.workspace }}/build
--html --html-details
-o report/coverage.html

- name: Upload html report
uses: actions/upload-artifact@v2
with:
name: mrtrix3-coverage-report
path: ${{ github.workspace }}/report