ci(e2e): prebuild dashboard before backend health check

The GitHub runner can spend more than the readiness window compiling go run ./cmd/dashboard, leaving dashboard.log empty while the backend has not started yet. Build the dashboard binary during preparation and health-check only the actual server startup. Keep README instructions aligned with CI.

Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>

Co-authored-by: cloudcode <cloudcode@users.noreply.github.com>
This commit is contained in:
naiba
2026-05-26 05:36:09 +00:00
co-authored by naiba/CloudCode cloudcode
parent e961fdb131
commit f380a8c4ac
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -75,6 +75,7 @@ jobs:
printf '<!doctype html><title>user e2e</title>\n' > cmd/dashboard/user-dist/index.html
go install github.com/swaggo/swag/cmd/swag@latest
"$(go env GOPATH)/bin/swag" init --pd -d cmd/dashboard -g main.go -o cmd/dashboard/docs
go build -o /tmp/nezha-dashboard ./cmd/dashboard
- name: Start backend
working-directory: nezha
@@ -82,7 +83,7 @@ jobs:
GIN_MODE: release
run: |
mkdir -p data
nohup go run ./cmd/dashboard -c data/config.yaml -db data/sqlite.db \
nohup /tmp/nezha-dashboard -c data/config.yaml -db data/sqlite.db \
> /tmp/dashboard.log 2>&1 &
echo $! > /tmp/dashboard.pid
+2 -1
View File
@@ -30,12 +30,13 @@ printf '<!doctype html><title>admin e2e</title>\n' > cmd/dashboard/admin-dist/in
printf '<!doctype html><title>user e2e</title>\n' > cmd/dashboard/user-dist/index.html
go install github.com/swaggo/swag/cmd/swag@latest
"$(go env GOPATH)/bin/swag" init --pd -d cmd/dashboard -g main.go -o cmd/dashboard/docs
go build -o /tmp/nezha-dashboard ./cmd/dashboard
NZ_LISTENHOST=127.0.0.1 NZ_LISTENPORT=8008 \
NZ_JWTSECRETKEY=e2e-jwt-secret-key-min-32-chars-long-ok \
NZ_AGENTSECRETKEY=e2e-agent-secret-32-bytes-long-ok \
NZ_SITENAME=nezha-e2e GIN_MODE=release \
go run ./cmd/dashboard -c data/config.yaml -db data/sqlite.db
/tmp/nezha-dashboard -c data/config.yaml -db data/sqlite.db
```
Then back in this repo: