From e8483ea610f2cd034209d2cc05c29cff21ac4ad6 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 9 May 2026 10:17:19 +0100 Subject: [PATCH] test: tighten plugin prerelease workflow assertions --- .../plugin-prerelease-test-plan.test.ts | 96 +++++++++++++++++-- 1 file changed, 88 insertions(+), 8 deletions(-) diff --git a/test/scripts/plugin-prerelease-test-plan.test.ts b/test/scripts/plugin-prerelease-test-plan.test.ts index 210493f3d21..167bf52d7a6 100644 --- a/test/scripts/plugin-prerelease-test-plan.test.ts +++ b/test/scripts/plugin-prerelease-test-plan.test.ts @@ -223,18 +223,86 @@ describe("scripts/lib/plugin-prerelease-test-plan.mjs", () => { expect(workflow.jobs["checks-node-extensions-shard"]).toBeUndefined(); expect(preflight.outputs).not.toHaveProperty("run_plugin_prerelease_suite"); expect(preflight.outputs).not.toHaveProperty("run_checks_node_extensions"); - expect(staticShard).toMatchObject({ + expect(staticShard).toEqual({ + if: "needs.preflight.outputs.run_plugin_prerelease_static == 'true'", name: "${{ matrix.check_name }}", + needs: ["preflight"], + permissions: { + contents: "read", + }, "runs-on": "blacksmith-8vcpu-ubuntu-2404", + steps: [ + { + name: "Checkout", + uses: "actions/checkout@v6", + with: { + "fetch-depth": 1, + "fetch-tags": false, + "persist-credentials": false, + ref: "${{ needs.preflight.outputs.checkout_revision }}", + submodules: false, + }, + }, + { + name: "Setup Node environment", + uses: "./.github/actions/setup-node-env", + with: { + "install-bun": "false", + }, + }, + { + env: { + PLUGIN_PRERELEASE_COMMAND: "${{ matrix.command }}", + PLUGIN_PRERELEASE_TASK: "${{ matrix.task }}", + }, + name: "Run plugin prerelease static shard", + run: [ + "set -euo pipefail", + 'echo "Running ${PLUGIN_PRERELEASE_TASK}: ${PLUGIN_PRERELEASE_COMMAND}"', + 'bash -c "$PLUGIN_PRERELEASE_COMMAND"', + "", + ].join("\n"), + shell: "bash", + }, + ], + strategy: { + "fail-fast": false, + matrix: "${{ fromJson(needs.preflight.outputs.plugin_prerelease_static_matrix) }}", + }, + "timeout-minutes": 45, }); expect(workflow.on.workflow_dispatch.inputs.full_release_validation).toBeUndefined(); - expect(workflow.on.workflow_dispatch.inputs.include_android).toMatchObject({ + expect(workflow.on.workflow_dispatch.inputs.include_android).toEqual({ default: false, + description: "Run Android lanes for this manual CI dispatch.", + required: false, type: "boolean", }); - expect(manifestEnv).toMatchObject({ + expect(manifestEnv).toEqual({ + OPENCLAW_CI_CHECKOUT_REVISION: "${{ steps.checkout_ref.outputs.sha }}", + OPENCLAW_CI_DOCS_CHANGED: + "${{ github.event_name == 'workflow_dispatch' && 'true' || steps.docs_scope.outputs.docs_changed }}", + OPENCLAW_CI_DOCS_ONLY: + "${{ github.event_name == 'workflow_dispatch' && 'false' || steps.docs_scope.outputs.docs_only }}", + OPENCLAW_CI_REPOSITORY: "${{ github.repository }}", OPENCLAW_CI_RUN_ANDROID: "${{ github.event_name == 'workflow_dispatch' && inputs.include_android && 'true' || steps.changed_scope.outputs.run_android || 'false' }}", + OPENCLAW_CI_RUN_CONTROL_UI_I18N: + "${{ github.event_name == 'workflow_dispatch' && 'true' || steps.changed_scope.outputs.run_control_ui_i18n || 'false' }}", + OPENCLAW_CI_RUN_MACOS: + "${{ github.event_name == 'workflow_dispatch' && 'true' || steps.changed_scope.outputs.run_macos || 'false' }}", + OPENCLAW_CI_RUN_NODE: + "${{ github.event_name == 'workflow_dispatch' && 'true' || steps.changed_scope.outputs.run_node || 'false' }}", + OPENCLAW_CI_RUN_NODE_FAST_CI_ROUTING: + "${{ github.event_name == 'workflow_dispatch' && 'false' || steps.changed_scope.outputs.run_node_fast_ci_routing || 'false' }}", + OPENCLAW_CI_RUN_NODE_FAST_ONLY: + "${{ github.event_name == 'workflow_dispatch' && 'false' || steps.changed_scope.outputs.run_node_fast_only || 'false' }}", + OPENCLAW_CI_RUN_NODE_FAST_PLUGIN_CONTRACTS: + "${{ github.event_name == 'workflow_dispatch' && 'false' || steps.changed_scope.outputs.run_node_fast_plugin_contracts || 'false' }}", + OPENCLAW_CI_RUN_SKILLS_PYTHON: + "${{ github.event_name == 'workflow_dispatch' && 'true' || steps.changed_scope.outputs.run_skills_python || 'false' }}", + OPENCLAW_CI_RUN_WINDOWS: + "${{ github.event_name == 'workflow_dispatch' && 'true' || steps.changed_scope.outputs.run_windows || 'false' }}", }); expect(manifestEnv).not.toHaveProperty("OPENCLAW_CI_FULL_RELEASE_VALIDATION"); expect(manifestScript).toContain("includeReleaseOnlyPluginShards: false"); @@ -262,15 +330,20 @@ describe("scripts/lib/plugin-prerelease-test-plan.mjs", () => { expect(pluginManifestScript).toContain( "Plugin prerelease plan unavailable in target ref; skipping static and Docker plugin prerelease lanes.", ); - expect(pluginWorkflow.on.workflow_dispatch.inputs.target_ref).toMatchObject({ + expect(pluginWorkflow.on.workflow_dispatch.inputs.target_ref).toEqual({ default: "main", + description: "Branch, tag, or full commit SHA to validate", + required: false, type: "string", }); - expect(pluginWorkflow.on.workflow_dispatch.inputs.full_release_validation).toMatchObject({ + expect(pluginWorkflow.on.workflow_dispatch.inputs.full_release_validation).toEqual({ default: false, + description: "Enable release-only Docker prerelease lanes from Full Release Validation", + required: false, type: "boolean", }); - expect(pluginManifestEnv).toMatchObject({ + expect(pluginManifestEnv).toEqual({ + EXPECTED_SHA: "${{ inputs.expected_sha }}", FULL_RELEASE_VALIDATION: "${{ inputs.full_release_validation && 'true' || 'false' }}", }); expect(pluginManifestScript).toContain( @@ -279,7 +352,7 @@ describe("scripts/lib/plugin-prerelease-test-plan.mjs", () => { expect(pluginManifestScript).toContain( "const runDocker = fullReleaseValidation && dockerLanes.length > 0;", ); - expect(pluginPreflight.outputs).toMatchObject({ + expect(pluginPreflight.outputs).toEqual({ checkout_revision: "${{ steps.manifest.outputs.checkout_revision }}", plugin_prerelease_docker_lanes: "${{ steps.manifest.outputs.plugin_prerelease_docker_lanes }}", @@ -310,9 +383,16 @@ describe("scripts/lib/plugin-prerelease-test-plan.mjs", () => { expect( staticShard.steps.find((step) => step.name === "Run plugin prerelease static shard").run, ).toContain('bash -c "$PLUGIN_PRERELEASE_COMMAND"'); - expect(dockerSuite).toMatchObject({ + expect(dockerSuite).toEqual({ if: "${{ inputs.full_release_validation && needs.preflight.outputs.run_plugin_prerelease_docker == 'true' }}", + name: "plugin-prerelease-docker-suite", needs: ["preflight"], + permissions: { + actions: "read", + contents: "read", + packages: "write", + "pull-requests": "read", + }, uses: "./.github/workflows/openclaw-live-and-e2e-checks-reusable.yml", with: { docker_lanes: "${{ needs.preflight.outputs.plugin_prerelease_docker_lanes }}",