ci: replace codecov with local coverage threshold check

Codecov requires an account and token to function. Replace it with
a self-contained `go tool cover` step that fails the build if total
coverage drops below 50% (currently ~58%). This catches test
regressions without external service dependencies.
This commit is contained in:
Houmgaor
2026-02-23 17:16:09 +01:00
parent 7f13ee6a51
commit 12f463e03b
3 changed files with 12 additions and 9 deletions

View File

@@ -43,12 +43,14 @@ jobs:
- name: Run Tests with Race Detector and Coverage
run: go test -race -coverprofile=coverage.out ./... -timeout=10m
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.out
flags: unittests
name: codecov-umbrella
- name: Check coverage threshold
run: |
COVERAGE=$(go tool cover -func=coverage.out | grep '^total:' | awk '{print substr($3, 1, length($3)-1)}')
echo "Total coverage: ${COVERAGE}%"
if [ "$(echo "$COVERAGE < 50" | bc)" -eq 1 ]; then
echo "::error::Coverage ${COVERAGE}% is below 50% threshold"
exit 1
fi
build:
name: Build