From 539a5137256d2ecc567165e025ec2b272a5623d4 Mon Sep 17 00:00:00 2001 From: Daljit Singh <129752264+daljit46@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:13:50 +0000 Subject: [PATCH 1/2] Add coverage workflow --- .github/workflows/coverage.yml | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000000..7d971cbf14 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,76 @@ + +name: Weekly Coverage Analysis + +on: + workflow_dispatch: + # Run this every Sunday at midnight + schedule: + - cron: "0 0 * * 0" + +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 \ No newline at end of file From 4a0e77d3fc781ae7b29cb4c5c7c458d9139c82a8 Mon Sep 17 00:00:00 2001 From: Daljit Singh <129752264+daljit46@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:53:08 +0000 Subject: [PATCH 2/2] REMOVE BEFORE MERGE: trigger on pull request --- .github/workflows/coverage.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7d971cbf14..c32705be38 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -6,7 +6,9 @@ on: # 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 @@ -24,7 +26,8 @@ jobs: - 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 + sudo apt-get install gcovr qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build + - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 @@ -73,4 +76,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: mrtrix3-coverage-report - path: ${{ github.workspace }}/report \ No newline at end of file + path: ${{ github.workspace }}/report