From 88d00889f628a1bf254eb4fd65facc9a27b7f803 Mon Sep 17 00:00:00 2001 From: Christopher Byrd Date: Tue, 2 Apr 2024 10:42:57 -0700 Subject: [PATCH] nit nit --- .github/workflows/main.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b97462c..d6c5068 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,3 +60,18 @@ jobs: - name: Report coverage run: | coverage report + + - name: Retrieve baseline coverage + run: | + git fetch origin main:main + baseline_coverage=$(git show main:.coverage | coverage report -m | sed -n '/TOTAL/ s/.*\s\([0-9.]*%\).*/\1/p' | sed 's/%//') + echo "$baseline_coverage" > .coverage_baseline + + - name: Compare coverage with baseline + run: | + current_coverage=$(coverage report -m | sed -n '/TOTAL/ s/.*\s\([0-9.]*%\).*/\1/p' | sed 's/%//') + baseline_coverage=$(cat .coverage_baseline) + if (( current_coverage < baseline_coverage )); then + echo "Coverage decreased from $baseline_coverage% to $current_coverage%" + exit 1 + fi