Skip to content

Commit

Permalink
Report test coverage using gcovr (#380)
Browse files Browse the repository at this point in the history
Report test coverage using gcovr

The workflow uploads test-coverage.html and stores it as an artifact which can be manually downloaded on the Actions page.

Fix NCEPLIBS caching in Action
  • Loading branch information
kgerheiser authored Mar 3, 2021
1 parent 414dc5a commit 7d5aed9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:
key: nceplibs-${{ runner.os }}-1.3.0

- name: build-nceplibs
if: steps.cache-nceplibs.outputs.cache-hit != 'true'
run: |
set -x
export ESMFMKFILE=~/esmf/lib/esmf.mk
Expand All @@ -125,9 +126,4 @@ jobs:
cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper;~/nceplibs' -DENABLE_DOCS=On
make -j2
make test


31 changes: 24 additions & 7 deletions .github/workflows/esmf-8.0.1_jasper-2.0.22_nceplibs-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
sudo ln -sf /usr/local/bin/gfortran-10 /usr/local/bin/gfortran
fi
fi
export PATH="~/.local/bin:$PATH"
python3 -m pip install gcovr
- name: cache-esmf
id: cache-esmf
Expand Down Expand Up @@ -94,13 +96,26 @@ jobs:
repository: NOAA-EMC/NCEPLIBS
path: nceplibs

- name: get-git-hash
run: |
cd nceplibs
git rev-parse HEAD > hash.txt
- name: cache-nceplibs-develop
id: cache-nceplibs-develop
uses: actions/cache@v2
with:
path: ~/nceplibs
key: nceplibs-develop-${{ runner.os }}-${{ hashFiles('nceplibs/hash.txt') }}

- name: build-nceplibs
if: steps.cache-nceplibs-develop.outputs.cache-hit != 'true'
run: |
set -x
export ESMFMKFILE=~/esmf/lib/esmf.mk
cd nceplibs
mkdir build && cd build
cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper' -DCMAKE_INSTALL_PREFIX='~' -DFLAT=ON
cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON
make -j2
- name: checkout-ufs-utils
Expand All @@ -113,12 +128,14 @@ jobs:
export ESMFMKFILE=~/esmf/lib/esmf.mk
cd ufs_utils
mkdir build && cd build
cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper' -DENABLE_DOCS=On
cmake .. -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs' -DENABLE_DOCS=On -DCMAKE_Fortran_FLAGS="-g -fprofile-arcs -ftest-coverage -O0"
make -j2
make test
export PATH="/home/runner/.local/bin:$PATH"
gcovr -r .. --html -o test-coverage.html


- uses: actions/upload-artifact@v2
if: ${{ matrix.os == 'ubuntu-20.04' }}
with:
name: test-coverage
path: ufs_utils/build/test-coverage.html

0 comments on commit 7d5aed9

Please sign in to comment.