Files
rogee d7c883afc1
Docker image / Test (push) Successful in 2m12s
Docker image / Build and publish (push) Failing after 37s
HH-690: single-container Mihomo lifecycle and ExternalUI (#9)
2026-08-26 17:29:31 +08:00

29 lines
713 B
Bash
Executable File

#!/bin/sh
set -eu
project_root=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
cd "$project_root"
./tests/workflow-contract.sh
unformatted=$(gofmt -l cmd internal)
if [ -n "$unformatted" ]; then
echo "Go files require formatting:" >&2
echo "$unformatted" >&2
exit 1
fi
go test -race -coverprofile=coverage.out ./internal/...
coverage=$(go tool cover -func=coverage.out | awk '/^total:/ { gsub(/%/, "", $3); print $3 }')
awk -v coverage="$coverage" 'BEGIN { if (coverage + 0 < 65) exit 1 }' || {
echo "unit test coverage ${coverage}% is below required 65%" >&2
exit 1
}
echo "unit test coverage: ${coverage}%"
go test ./...
if command -v docker >/dev/null 2>&1; then
docker compose config --quiet
fi