-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Add a workflow for the code coverage
- Loading branch information
1 parent
b2db864
commit 6371820
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Coverage | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y ninja-build gcc gfortran lcov libhwloc-dev | ||
pip install meson gcovr | ||
- name: Set the environment variables | ||
shell: bash | ||
run: | | ||
echo "GALAHAD=$GITHUB_WORKSPACE" >> $GITHUB_ENV | ||
- name: Set environment variables for OpenMP | ||
shell: bash | ||
run: | | ||
echo "OMP_CANCELLATION=TRUE" >> $GITHUB_ENV | ||
echo "OMP_PROC_BIND=TRUE" >> $GITHUB_ENV | ||
- name: Setup | ||
run: | | ||
meson setup builddir --buildtype=debug \ | ||
-Db_coverage=true \ | ||
-Dsingle=true \ | ||
-Ddouble=true \ | ||
-Dquadruple=true \ | ||
-Dtests=true | ||
- name: Compilation | ||
run: | | ||
meson compile -C builddir | ||
- name: Tests | ||
run: meson test -C builddir --timeout-multiplier 8 | ||
|
||
- name: Generate coverage report | ||
run: | | ||
gcovr -r . --html --html-details -o builddir/coverage.html | ||
gcovr -r . --xml -o builddir/coverage.xml | ||
- name: Upload coverage report to GitHub | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-report | ||
path: builddir/coverage.html | ||
|
||
- name: Upload coverage report to Codecov | ||
uses: codecov/codecov-action@v5 | ||
with: | ||
files: builddir/coverage.xml | ||
token: ${{ secrets.CODECOV_TOKEN }} |