From 12f463e03ba3109cf8925ce0aa1493f14fed6932 Mon Sep 17 00:00:00 2001 From: Houmgaor Date: Mon, 23 Feb 2026 17:16:09 +0100 Subject: [PATCH] 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. --- .github/workflows/go.yml | 14 ++++++++------ CHANGELOG.md | 1 + docs/technical-debt.md | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c8efc4634..c3dbe7df2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index ba3548952..721aac002 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- CI: Coverage threshold enforcement — fails build if total coverage drops below 50% - CI: Release workflow that automatically builds and uploads Linux/Windows binaries to GitHub Releases on tag push - Monthly guild item claim tracking per character per type (standard/HLC/EXC), with schema migration (`31-monthly-items.sql`) adding claim timestamps to the `stamps` table - API: `GET /version` endpoint returning server name and client mode (`{"clientMode":"ZZ","name":"Erupe-CE"}`) diff --git a/docs/technical-debt.md b/docs/technical-debt.md index 6d0a83eaf..9a4dac5bc 100644 --- a/docs/technical-debt.md +++ b/docs/technical-debt.md @@ -59,8 +59,8 @@ These are validated indirectly through mock-based handler tests but have no SQL- ### 4. CI updates -- ~~`codecov-action@v4` could be updated to `v5` (current stable)~~ **Fixed.** Updated to `codecov-action@v5`. -- No coverage threshold is enforced — coverage is uploaded but regressions aren't caught +- ~~`codecov-action@v4` could be updated to `v5` (current stable)~~ **Removed.** Replaced with local `go tool cover` threshold check (no Codecov account needed). +- ~~No coverage threshold is enforced — coverage is uploaded but regressions aren't caught~~ **Fixed.** CI now fails if total coverage drops below 50% (current: ~58%). --- @@ -93,4 +93,4 @@ Based on remaining impact: 1. ~~**Add tests for `handlers_commands.go`**~~ — **Done.** 62 tests covering all 12 commands (ban, timer, PSN, reload, key quest, rights, course, raviente, teleport, discord, playtime, help), disabled-command gating, op overrides, error paths, and `initCommands`. 2. **Fix bookshelf data pointer** (`model_character.go`) — corrupts saves for three game versions (needs save data validation) 3. **Fix achievement rank-up notifications** (`handlers_achievement.go:125`) — needs protocol research on `MhfDisplayedAchievement` -4. **Add coverage threshold** to CI — prevents regressions +4. ~~**Add coverage threshold** to CI~~ — **Done.** 50% floor enforced via `go tool cover` in CI; Codecov removed.