From 7e7368838af538f3d73f2bdb50d4011960acd3b7 Mon Sep 17 00:00:00 2001 From: jdinovi Date: Wed, 20 Dec 2023 21:36:10 -0700 Subject: [PATCH] attempt 2 at coverage.yml file --- .github/workflows/coverage.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index c881e15..5fcbafe 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -23,18 +23,15 @@ jobs: - name: Build run: | - cd make build - name: Generate coverage report run: | - cd - # Function to calculate coverage for a file calculate_coverage() { local file=$1 - local lines_executed=$(grep "File '$file'" -A 1 | awk '/Lines executed:/ {print $4}') - local total_lines=$(grep "File '$file'" -A 1 | awk '/Lines executed:/ {print $NF}') + local lines_executed=$(gcov --object-directory=obj $file -n | awk '/Lines executed:/ {print $4}') + local total_lines=$(gcov --object-directory=obj $file -n | awk '/Lines executed:/ {print $NF}') local coverage=$(echo "scale=2; $lines_executed / $total_lines * 100" | bc) echo $coverage }