From 62f9f4e7a80cde6100098d54891bd0a842cfb4f3 Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Sat, 17 Aug 2024 13:59:46 +0200 Subject: [PATCH 1/2] Add coverage support --- .gcov/make/cover.sh | 66 +++++++++++++++++++++++++ .github/workflows/gamma_f77_codecov.yml | 45 +++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100755 .gcov/make/cover.sh create mode 100644 .github/workflows/gamma_f77_codecov.yml diff --git a/.gcov/make/cover.sh b/.gcov/make/cover.sh new file mode 100755 index 0000000..aadd3ec --- /dev/null +++ b/.gcov/make/cover.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# +# Copyright Christopher Kormanyos 2024. +# Distributed under the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt +# or copy at http://www.boost.org/LICENSE_1_0.txt) +# + +# cd /mnt/c/Users/ckorm/Documents/Ks/PC_Software/Fortran/gamma/.gcov/make +# ./cover.sh + +if [[ "$1" != "" ]]; then + STD="$1" +else + STD=f2018 +fi + +echo 'clean and create temporary directories' +echo +mkdir -p bin +mkdir -p obj + +rm -rf bin +rm -rf obj + +mkdir -p bin +mkdir -p obj + +echo +echo 'compile and link bin/gamma' +echo +g++ -O0 -std=$STD -x f77 -c -fprofile-arcs -ftest-coverage ../../gamma.f -o obj/gamma.o +g++ -x none -fprofile-arcs -ftest-coverage obj/gamma.o -lquadmath -lgfortran -o bin/gamma + +echo +echo 'verify existence of bin/gamma' +echo +ls -la bin/gamma +res_00=$? + +echo +echo 'execute bin/gamma' +echo +bin/gamma +res_01=$? + +echo +echo 'run gcov, lcov and htmlgen' +echo +gcov obj/gamma.f +lcov --capture --directory . --output-file coverage.info +genhtml coverage.info --output-directory bin/report +res_02=$? + + +result_total=$((res_00+res_01+res_02)) + +echo +echo "res_00 : " "$res_00" +echo "res_01 : " "$res_01" +echo "res_02 : " "$res_02" +echo "result_total : " "$result_total" +echo "gamma_tests" +echo + +exit $result_total diff --git a/.github/workflows/gamma_f77_codecov.yml b/.github/workflows/gamma_f77_codecov.yml new file mode 100644 index 0000000..cecee7a --- /dev/null +++ b/.github/workflows/gamma_f77_codecov.yml @@ -0,0 +1,45 @@ +# ------------------------------------------------------------------------------ +# Copyright Christopher Kormanyos 2022 - 2024. +# Distributed under the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt +# or copy at http://www.boost.org/LICENSE_1_0.txt) +# ------------------------------------------------------------------------------ + +name: gamma_f77_codecov +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + gnumake-gcc-gcov-native: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + standard: [ f2018 ] + compiler: [ g++ ] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: '0' + - name: gnumake-gcc-gcov-native + run: | + cd .gcov/make + echo "build and run gcov/lcov/genhtml" + ./cover.sh + echo + echo "return to gamma_f77 root directory" + cd ../.. + - name: upload-codecov + uses: codecov/codecov-action@v4 + with: + plugin: gcov + file: ${{ runner.workspace }}/gamma_f77/.gcov/make/coverage.info + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + verbose: false From 9a65cd185d4e6d66c6c4abc5babaa694abe2318a Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Sat, 17 Aug 2024 14:04:45 +0200 Subject: [PATCH 2/2] install lcov on pipeline --- .github/workflows/gamma_f77_codecov.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gamma_f77_codecov.yml b/.github/workflows/gamma_f77_codecov.yml index cecee7a..466a836 100644 --- a/.github/workflows/gamma_f77_codecov.yml +++ b/.github/workflows/gamma_f77_codecov.yml @@ -1,5 +1,5 @@ # ------------------------------------------------------------------------------ -# Copyright Christopher Kormanyos 2022 - 2024. +# Copyright Christopher Kormanyos 2024. # Distributed under the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt # or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -27,6 +27,8 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: '0' + - name: update-tools + run: sudo apt install lcov - name: gnumake-gcc-gcov-native run: | cd .gcov/make