Skip to content

Commit

Permalink
attempt 2 at coverage.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
jdinovi committed Dec 21, 2023
1 parent 8d682a1 commit 7e73688
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 7e73688

Please sign in to comment.