From 55312de7077d41fd557df721dc39282d7ce4ade3 Mon Sep 17 00:00:00 2001 From: Edward Hartnett <38856240+edwardhartnett@users.noreply.github.com> Date: Fri, 29 Mar 2024 09:17:45 -0600 Subject: [PATCH] now generate test code coverage report in developer workflow (#104) * turning on code coverage * turning on code coverage * updated workflow --- .github/workflows/developer.yml | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index 7f06cad0..0ea81f62 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -10,6 +10,11 @@ on: branches: - develop +# Cancel in-progress workflows when pushing to a branch +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: developer: runs-on: ubuntu-latest @@ -23,10 +28,10 @@ jobs: run: | sudo apt-get update sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config - sudo apt-get install libpng-dev autotools-dev autoconf + sudo apt-get install libpng-dev autotools-dev autoconf gcovr - name: checkout-jasper - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: jasper-software/jasper path: jasper @@ -41,7 +46,7 @@ jobs: make install - name: checkout-sp - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: NOAA-EMC/NCEPLIBS-sp path: sp @@ -57,7 +62,7 @@ jobs: make install - name: checkout-ip2 - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: NOAA-EMC/NCEPLIBS-ip2 path: ip2 @@ -73,15 +78,27 @@ jobs: make install - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: wgrib2 - name: build run: | cd wgrib2 - mkdir b - cd b + mkdir build + cd build + export CFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0' + export FCFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0' + export FFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0' cmake .. make VERBOSE=1 - make test + ctest --verbose --output-on-failure --rerun-failed + gcovr --root .. -v --html-details --exclude ../tests --exclude CMakeFiles --print-summary -o test-coverage.html &> /dev/null + + - name: upload-test-coverage + uses: actions/upload-artifact@v4 + with: + name: wgrib2-test-coverage + path: | + wgrib2/build/*.html + wgrib2/build/*.css