Skip to content

Commit 8ce7248

Browse files
elevranroytman
andauthored
[cicd[ Make coverage comparison optional (llm-d#762)
* make coverage comparison optional Signed-off-by: Etai Lev Ran <elevran@gmail.com> Co-authored-by: Alexey Roytman <roytman@il.ibm.com> * Handle failure cases in extract_total: missing, empty and corrupt files. In all these cases the function returns "", and the caller handles that as missing data and not a script abort. Signed-off-by: Etai Lev Ran <elevran@gmail.com> --------- Signed-off-by: Etai Lev Ran <elevran@gmail.com> Co-authored-by: Alexey Roytman <roytman@il.ibm.com>
1 parent 5b233fd commit 8ce7248

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

.github/workflows/ci-pr-checks.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ jobs:
2222
filters: |
2323
src:
2424
- '**/*.go'
25-
- '**/*.py'
2625
- Dockerfile.epp
2726
- Dockerfile.sidecar
2827
- Makefile*
2928
- go.mod
29+
- scripts/**
3030
lint-and-test:
3131
needs: check-changes
3232
if: ${{ needs.check-changes.outputs.src == 'true' }}
@@ -77,6 +77,7 @@ jobs:
7777

7878
- name: Compare coverage against main baseline
7979
if: github.event_name == 'pull_request'
80+
continue-on-error: true
8081
shell: bash
8182
run: make coverage-compare BASELINE_DIR=coverage/baseline
8283

scripts/compare-coverage.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ THRESHOLD="${3:-0}"
2222
# extract_total <profile.out> → percentage as a bare number, e.g. "72.4"
2323
extract_total() {
2424
local profile="$1"
25-
if [[ ! -f "$profile" ]]; then
25+
if [[ ! -s "$profile" ]]; then
2626
echo ""
2727
return
2828
fi
2929
go tool cover -func="$profile" 2>/dev/null \
30-
| awk '/^total:/{gsub(/%/,"",$NF); print $NF}'
30+
| awk '/^total:/{gsub(/%/,"",$NF); print $NF}' || true
3131
}
3232

3333
# delta_str <base> <cur> → e.g. "+1.2" or "-0.5" or "0.0"
@@ -57,7 +57,7 @@ for f in "$BASELINE_DIR"/*.out "$CURRENT_DIR"/*.out; do
5757
[[ -f "$f" ]] || continue
5858
name=$(basename "$f" .out)
5959
# deduplicate
60-
if [[ ! " ${all_names[*]} " =~ " ${name} " ]]; then
60+
if [[ ! " ${all_names[*]-} " =~ " ${name} " ]]; then
6161
all_names+=("$name")
6262
fi
6363
done

0 commit comments

Comments
 (0)