From 396a0fcb21984d1a84ad6832aecfeb5dfa9b5408 Mon Sep 17 00:00:00 2001 From: naiba Date: Mon, 20 Jul 2026 14:16:00 +0000 Subject: [PATCH] ci: prepare dashboard inputs for stress Co-authored-by: naiba/CloudCode --- .github/workflows/test.yml | 8 ++++++ .../workflowpolicy/stress_workflow_test.go | 28 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 21ec8a66..bbe1e5a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -110,6 +110,14 @@ jobs: with: go-version: "1.26.x" cache: false + - name: Prepare Dashboard build inputs + working-directory: nezha + run: | + go install github.com/swaggo/swag/cmd/swag@v1.16.6 + mkdir -p cmd/dashboard/user-dist cmd/dashboard/admin-dist + printf 'placeholder\n' > cmd/dashboard/user-dist/placeholder.txt + printf 'placeholder\n' > cmd/dashboard/admin-dist/placeholder.txt + swag init --pd -d cmd/dashboard -g main.go -o cmd/dashboard/docs - name: Require named stress test working-directory: nezha run: go test -mod=readonly -tags=agentcompat -list '^TestStressPRFullEightAgentExactlyOnce$' ./integration/agentcompat/internal/scenario | grep -Fx 'TestStressPRFullEightAgentExactlyOnce' diff --git a/integration/agentcompat/internal/workflowpolicy/stress_workflow_test.go b/integration/agentcompat/internal/workflowpolicy/stress_workflow_test.go index 3396f13e..c1f774c2 100644 --- a/integration/agentcompat/internal/workflowpolicy/stress_workflow_test.go +++ b/integration/agentcompat/internal/workflowpolicy/stress_workflow_test.go @@ -1,6 +1,7 @@ package workflowpolicy_test import ( + "strings" "testing" "github.com/stretchr/testify/require" @@ -23,7 +24,22 @@ func TestPolicy_NezhaStressWorkflowRunsPinnedCrossRepositoryTest(t *testing.T) { require.Equal(t, "Linux agent compatibility stress", stressJob.Name) require.Equal(t, "ubuntu-24.04", stressJob.RunsOn) require.Equal(t, 75, stressJob.TimeoutMinutes) - require.Len(t, stressJob.Steps, 5) + require.Len(t, stressJob.Steps, 6) + require.Equal(t, []string{ + "Checkout Nezha revision", + "Checkout pinned Agent revision", + "Set up Go", + "Prepare Dashboard build inputs", + "Require named stress test", + "Run PR-full agent compatibility stress", + }, []string{ + stressJob.Steps[0].Name, + stressJob.Steps[1].Name, + stressJob.Steps[2].Name, + stressJob.Steps[3].Name, + stressJob.Steps[4].Name, + stressJob.Steps[5].Name, + }) nezhaCheckout := stressJob.stepNamed(t, "Checkout Nezha revision") require.Equal(t, "actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0", nezhaCheckout.Uses) @@ -44,6 +60,16 @@ func TestPolicy_NezhaStressWorkflowRunsPinnedCrossRepositoryTest(t *testing.T) { require.Equal(t, "1.26.x", setupGo.With.GoVersion) require.False(t, *setupGo.With.Cache) + prepareDashboardInputs := stressJob.stepNamed(t, "Prepare Dashboard build inputs") + require.Equal(t, "nezha", prepareDashboardInputs.WorkingDirectory) + require.Equal(t, strings.Join([]string{ + "go install github.com/swaggo/swag/cmd/swag@v1.16.6", + "mkdir -p cmd/dashboard/user-dist cmd/dashboard/admin-dist", + "printf 'placeholder\\n' > cmd/dashboard/user-dist/placeholder.txt", + "printf 'placeholder\\n' > cmd/dashboard/admin-dist/placeholder.txt", + "swag init --pd -d cmd/dashboard -g main.go -o cmd/dashboard/docs", + }, "\n"), strings.TrimSpace(prepareDashboardInputs.Run)) + listStep := stressJob.stepNamed(t, "Require named stress test") require.Equal(t, "nezha", listStep.WorkingDirectory) require.Equal(t, "go test -mod=readonly -tags=agentcompat -list '^"+agentcompatStressTestName+"$' ./integration/agentcompat/internal/scenario | grep -Fx '"+agentcompatStressTestName+"'", listStep.Run)