Skip to content

Commit bf19c98

Browse files
committed
chore: gh action improvements
1 parent e45b611 commit bf19c98

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Coverage Check
33
on:
44
pull_request:
55

6+
concurrency:
7+
group: coverage-${{ github.event.pull_request.number }}
8+
cancel-in-progress: true
9+
610
env:
711
COVERAGE_SENSITIVITY_PERCENT: 1
812
MAINNET_RPC: ${{ secrets.MAINNET_RPC }}
@@ -101,11 +105,10 @@ jobs:
101105
else
102106
old=0
103107
fi
104-
# Floor decimals to integer for comparison
105-
old_int=${old%.*}
106-
new=$(( ${{ steps.new-coverage.outputs.total-coverage }} + ${{ env.COVERAGE_SENSITIVITY_PERCENT }} ))
107-
if [ "$new" -lt "$old_int" ]; then
108-
echo "Coverage decreased from $old_int to $new"
108+
new_total=${{ steps.new-coverage.outputs.total-coverage }}
109+
new=$(awk -v a="$new_total" -v b="${{ env.COVERAGE_SENSITIVITY_PERCENT }}" 'BEGIN{printf "%.2f", a+b}')
110+
if awk "BEGIN {exit !($new < $old)}"; then
111+
echo "Coverage decreased from $old to $new"
109112
exit 1
110113
fi
111114
mv lcovNew.info coverage.info

0 commit comments

Comments
 (0)