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

View File

@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### 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 - 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 - 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"}`) - API: `GET /version` endpoint returning server name and client mode (`{"clientMode":"ZZ","name":"Erupe-CE"}`)

View File

@@ -59,8 +59,8 @@ These are validated indirectly through mock-based handler tests but have no SQL-
### 4. CI updates ### 4. CI updates
- ~~`codecov-action@v4` could be updated to `v5` (current stable)~~ **Fixed.** Updated to `codecov-action@v5`. - ~~`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 - ~~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`. 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) 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` 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.