Skip to content

Commit d8a3726

Browse files
committed
Expose backend coverage in dev mode through web
Generate backend coverage in ci
1 parent 9faa363 commit d8a3726

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docker/rootfs/etc/nginx/conf.d/dev.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ server {
66
return 302 /api/;
77
}
88

9+
root /app/backend;
10+
___location /api/coverage {
11+
try_files /index.html /coverage.html;
12+
}
13+
914
___location /api/ {
1015
add_header X-Served-By $host;
1116
chunked_transfer_encoding off;

scripts/ci/test-backend

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ if [ "${1:-}" = "--inside-docker" ]; then
4343
echo -e "${BLUE}${CYAN}Testing backend code${RESET}"
4444
cd /app/backend
4545
[ -z "$(go tool fix -diff ./internal)" ]
46-
go test -json -cover ./internal/... | tparse
46+
go test -json -cover -coverprofile="$DIR/../../coverage.out" ./internal/... | tparse
47+
go tool cover -html="$DIR/../../coverage.out" -o "$DIR/../../coverage.html"
48+
rm -f "$DIR/../../coverage.out"
4749
golangci-lint -v run ./...
4850
else
4951
# run this script from within docker

0 commit comments

Comments
 (0)