Skip to content

ci(test): add binary smoke test to verify built artifact runs correctly #554

Description

@lizhengfeng101

Description

The test job in ci.yml currently builds the binary to /dev/null:

- name: Build
  run: go build -o /dev/null ./cmd/opencodereview

This only verifies that the code compiles, but does not verify that the resulting binary:

  • Starts without panicking (e.g., bad init() functions, missing linked symbols)
  • Has correct ldflags injection (--version output)
  • Has intact flag registration and dispatch logic (--help output)

Proposed Change

Replace the current Build step and add a Smoke Test step in the existing test job:

- name: Build
  run: go build -o ./opencodereview ./cmd/opencodereview

- name: Smoke test
  run: |
    ./opencodereview --version
    ./opencodereview --version | grep -q "open-code-review"
    ./opencodereview --help
    ./opencodereview --help | grep -q "Commands:"

Why steps in the existing job (not a separate job)?

  • The smoke test itself takes <1 second — spinning up a new container just for this is wasteful.
  • No artifact passing needed — build and verify in the same job is simplest.
  • Semantically it's a natural extension of "Build": compile it, then prove it runs.

Scope

  • File: .github/workflows/ci.yml
  • Job: test (lines 69–70)
  • The cross-compile job should remain unchanged (cross-compiled binaries can't run on the host architecture).

Acceptance Criteria

  • test job builds a real binary (not to /dev/null)
  • Smoke test verifies --version outputs a string containing open-code-review
  • Smoke test verifies --help outputs a string containing Commands:
  • CI passes on a PR targeting main

Context

Discovered during a CI gap analysis. The cross-compile job also builds to /dev/null, but that's expected — you can't execute a darwin/arm64 binary on a linux/amd64 runner. The native-platform test job is the right place to verify the binary actually works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions