Skip to content

Commit

Permalink
Merge pull request #29 from ckormanyos/coverage
Browse files Browse the repository at this point in the history
Add coverage support
  • Loading branch information
ckormanyos authored Aug 17, 2024
2 parents 61cd8cf + 9a65cd1 commit 2cbe153
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .gcov/make/cover.sh
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions .github/workflows/gamma_f77_codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# ------------------------------------------------------------------------------
# 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)
# ------------------------------------------------------------------------------

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: update-tools
run: sudo apt install lcov
- 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

0 comments on commit 2cbe153

Please sign in to comment.