Expose backend coverage in dev mode through web

Generate backend coverage in ci
This commit is contained in:
Jamie Curnow 2023-07-27 13:44:38 +10:00
parent 9faa36315f
commit d8a3726f3a
No known key found for this signature in database
GPG Key ID: FFBB624C43388E9E
2 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,11 @@ server {
return 302 /api/;
}
root /app/backend;
location /api/coverage {
try_files /index.html /coverage.html;
}
location /api/ {
add_header X-Served-By $host;
chunked_transfer_encoding off;

View File

@ -43,7 +43,9 @@ if [ "${1:-}" = "--inside-docker" ]; then
echo -e "${BLUE} ${CYAN}Testing backend code${RESET}"
cd /app/backend
[ -z "$(go tool fix -diff ./internal)" ]
go test -json -cover ./internal/... | tparse
go test -json -cover -coverprofile="$DIR/../../coverage.out" ./internal/... | tparse
go tool cover -html="$DIR/../../coverage.out" -o "$DIR/../../coverage.html"
rm -f "$DIR/../../coverage.out"
golangci-lint -v run ./...
else
# run this script from within docker