mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-06 23:56:37 +08:00
ab70633e9f
Result: {"status":"keep","total_issues":8,"golint_canonicalheader":0,"golint_errname":0,"golint_errorlint":1,"golint_exhaustive":0,"golint_forcetypeassert":0,"golint_gosec":0,"golint_intrange":0,"golint_modernize":3,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":0,"golint_recvcheck":1,"golint_usestdlibvars":0,"golint_wastedassign":0,"golint_total":8,"golint_test_testifylint":0,"golint_test_thelper":0,"golint_test_usetesting":0,"golint_test_total":0,"golint_vetx_total":0,"eslint_problems":0,"eslint_errors":0,"eslint_warnings":0,"tsc_errors":0,"vitest_failed":0,"vitest_total":116,"measure_s":68}
43 lines
1.5 KiB
Bash
Executable File
43 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
||
# Correctness gate: must pass after every edit. Fails fast on real breakage.
|
||
set -euo pipefail
|
||
cd "$(dirname "$0")/.."
|
||
|
||
echo "==> go vet ./..."
|
||
go vet ./... 2>&1 | tail -20
|
||
|
||
echo "==> go build ./..."
|
||
go build ./... 2>&1 | tail -20
|
||
|
||
echo "==> golangci-lint run (repo config)"
|
||
golangci-lint run 2>&1 | tail -20
|
||
|
||
# 全量单测(sqlite + miniredis,纯本地无需外部服务;2026-08-16 起全绿)
|
||
echo "==> go test ./internal/... ./pkg/..."
|
||
go test ./internal/... ./pkg/... 2>&1 | grep -E "^--- FAIL|^FAIL" | head -20 || true
|
||
if go test ./internal/... ./pkg/... > /tmp/auto_gotest.log 2>&1; then
|
||
:
|
||
else
|
||
tail -30 /tmp/auto_gotest.log
|
||
exit 1
|
||
fi
|
||
|
||
# 前端测试(vitest;2026-08-16 起全绿)
|
||
echo "==> pnpm exec vitest run (frontend)"
|
||
(cd frontend && pnpm exec vitest run --reporter=dot > /tmp/auto_vitest.log 2>&1) || {
|
||
tail -30 /tmp/auto_vitest.log
|
||
exit 1
|
||
}
|
||
|
||
# 并发密集包 -race 门禁(2026-08-16 全仓 -race 清零后纳入,防回归;
|
||
# frpc/frps 慢套件不含在此,另做全量周期验证)
|
||
echo "==> go test -race (concurrency packages)"
|
||
RACE_PKGS="./internal/apps/oauth/ ./internal/apps/openflare/tls/ ./internal/apps/openflare/uptimekuma/ ./internal/apps/upload/cache/ ./internal/repository/ ./pkg/cache/disk/ ./pkg/logger/ ./internal/infra/persistence/batchwriter/"
|
||
if go test -race -count=1 $RACE_PKGS > /tmp/auto_race.log 2>&1; then
|
||
:
|
||
else
|
||
grep -E "WARNING: DATA RACE|^--- FAIL|^FAIL" /tmp/auto_race.log | head -20
|
||
exit 1
|
||
fi
|
||
|
||
echo "OK: checks passed" |