From f380a8c4ac35de83d37a0974659be02c0fbb2674 Mon Sep 17 00:00:00 2001 From: naiba Date: Tue, 26 May 2026 05:36:09 +0000 Subject: [PATCH] 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 Co-authored-by: cloudcode --- .github/workflows/e2e.yml | 3 ++- README.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 3a93e47..dba9ec7 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -75,6 +75,7 @@ jobs: printf 'user e2e\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 diff --git a/README.md b/README.md index eddfd3d..69c552a 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,13 @@ printf 'admin e2e\n' > cmd/dashboard/admin-dist/in printf 'user e2e\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: