jasonmiller-cc/Go Unit Testing
Run Go unit tests with race-condition detection, generate code-coverage reports (HTML + text), enforce a minimum-coverage threshold, and upload all artifacts for later inspection.
View on GitHubTrust Signals
- Scorecard Score
- not yet scored
- Maintenance Recency
- Stale
- License
- None
Inputs
| name | description | required | default |
|---|---|---|---|
| go-version | The Go toolchain version to use (e.g. "stable", "1.22", "^1.21"). Passed directly to actions/setup-go. | no | stable |
| working-directory | Path (relative to the repository root) that contains the Go module you want to test. Defaults to the repository root. | no | . |
| test-flags | Extra flags forwarded verbatim to `go test`. Example: "-count=1 -timeout 120s" | no | "" |
| coverage-threshold | Minimum acceptable total code-coverage percentage (0–100). The step fails when actual coverage falls below this value. | no | 0 |
| upload-artifacts | Set to "true" to upload coverage reports and raw test output as a workflow artifact; "false" to skip the upload step. | no | true |
| artifact-name | Name given to the uploaded artifact bundle. Must be unique within a single workflow run when the action is invoked multiple times. | no | go-test-artifacts |
| artifact-retention-days | Number of days GitHub retains the uploaded artifact (1–90). | no | 30 |
| run-vet | Set to "true" to run `go vet ./...` before executing tests. Catches common correctness issues early. | no | true |
Outputs
| name | description |
|---|---|
| coverage-percentage | Total code-coverage percentage reported by `go tool cover`. |
| test-result | "pass" when all tests succeed; "fail" otherwise. |