ci: extract go-test-failure-report composite action (#25670)

The Go test jobs in `ci.yaml` each had ~30 lines of inline shell that
wrapped `gotestsum` with a PATH shim to capture JSON, then ran
`gotestsummary` and `upload-artifact` to publish a failure report. Three
jobs carried three near-identical copies.

This change replaces the three inline blocks with a single composite
action at `.github/actions/go-test-failure-report/` that runs the same
`gotestsummary` invocation, writes the same markdown to
`GITHUB_STEP_SUMMARY`, and uploads the same NDJSON artifact. The PATH
shim is gone; gotestsum's native `GOTESTSUM_JSONFILE` env variable is
used instead, plumbed through the `test-go-pg` composite.

`test-go-pg` gains three optional inputs:

- `gotestsum-json-file` — explicit JSON file path (or `default` for
`${RUNNER_TEMP}/go-test.json`)
- `run-regex` — passed to `go test -run`
- `test-shuffle` — passed to `go test -shuffle`

All three have safe defaults so existing callers are unaffected.

No observable change in CI behavior: the three existing test-go-pg jobs
continue to emit the same JSON, render the same failure summary, and
upload the same artifact.

Stacked under #25667, which uses the new composite and inputs to power a
new flake-detector workflow.
This commit is contained in:
Ethan
2026-05-28 00:16:46 +10:00
committed by GitHub
parent 2770bdc9d1
commit f422ac89cc
3 changed files with 118 additions and 105 deletions
+27
View File
@@ -26,6 +26,18 @@ inputs:
description: "Packages to test (default: ./...)"
required: false
default: "./..."
run-regex:
description: "Go test name regex passed via RUN"
required: false
default: ""
test-shuffle:
description: "Go test shuffle mode passed via TEST_SHUFFLE"
required: false
default: ""
gotestsum-json-file:
description: "Optional Linux path for gotestsum --jsonfile output. Use default for RUNNER_TEMP/go-test.json."
required: false
default: ""
embedded-pg-path:
description: "Path for embedded postgres data (Windows/macOS only)"
required: false
@@ -61,8 +73,11 @@ runs:
TEST_NUM_PARALLEL_PACKAGES: ${{ inputs.test-parallelism-packages }}
TEST_NUM_PARALLEL_TESTS: ${{ inputs.test-parallelism-tests }}
TEST_COUNT: ${{ inputs.test-count }}
RUN: ${{ inputs.run-regex }}
TEST_SHUFFLE: ${{ inputs.test-shuffle }}
TEST_PACKAGES: ${{ inputs.test-packages }}
RACE_DETECTION: ${{ inputs.race-detection }}
GOTESTSUM_JSONFILE_INPUT: ${{ inputs.gotestsum-json-file }}
TS_DEBUG_DISCO: "true"
TS_DEBUG_DERP: "true"
LC_CTYPE: "en_US.UTF-8"
@@ -70,6 +85,18 @@ runs:
run: |
set -euo pipefail
# gotestsum natively reads GOTESTSUM_JSONFILE; set it directly instead
# of writing a PATH shim. "default" is the historical
# ${RUNNER_TEMP}/go-test.json location consumed by
# ./.github/actions/go-test-failure-report.
if [[ -n "${GOTESTSUM_JSONFILE_INPUT}" ]]; then
if [[ "${GOTESTSUM_JSONFILE_INPUT}" == "default" ]]; then
export GOTESTSUM_JSONFILE="${RUNNER_TEMP}/go-test.json"
else
export GOTESTSUM_JSONFILE="${GOTESTSUM_JSONFILE_INPUT}"
fi
fi
if [[ ${RACE_DETECTION} == true ]]; then
make test-race
else