feat: stream go test failure summary and drop raw json artifact (#25146)

This follows up on
https://github.com/coder/coder/actions/runs/25684936801/job/75406131184?pr=25139
by replacing the large raw Go test JSON artifact with inline structured
summaries and a compact failures-only artifact.

## What changed

- Added `scripts/gotestsummary`, a streaming Go tool that reads
gotestsum JSON and renders failed tests as Markdown.
- Updated the three Go test jobs to publish per-test `<details>`
sections in the job summary.
- Removed upload of the raw `go-test.json` artifact.
- Added upload of `go-test-failures-*.ndjson` with compact failure
records for deeper inspection.
- Deleted the old bash and `jq` summary script.

## Why

- The previous raw artifact was about 35 MB compressed and 445 MB raw in
the linked run.
- Passing-test output made the artifact noisy and slow to inspect.
- The old summary truncated output to 600 characters.
- The new path keeps streaming, bounded output and writes structured
diagnostics for only final failed tests.

## Validation

- `gofmt -w scripts/gotestsummary`
- `gofmt -l scripts/gotestsummary`
- `go test ./scripts/gotestsummary/...`
- `go vet ./scripts/gotestsummary/...`
- `grep -rn 'go-test-failure-summary.sh' . || true`
- `grep -rn 'go-test-failure-summary.sh\|go-test.json\|go-test-json-'
.claude .agents docs AGENTS.md || true`
- `make lint/agents`
- `make lint/emdash`
- `make lint/markdown`
- `make lint/shellcheck`
- `git diff --check origin/main..HEAD`

> This PR was prepared by Mux working on Mike's behalf.
This commit is contained in:
Michael Suchacz
2026-05-12 00:08:37 +02:00
committed by GitHub
parent aed43d9b61
commit bb8c40e764
5 changed files with 766 additions and 112 deletions
+33 -12
View File
@@ -560,14 +560,21 @@ jobs:
- name: Publish Go test failure summary
if: failure() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
run: bash scripts/go-test-failure-summary.sh "${RUNNER_TEMP}/go-test.json" >> "$GITHUB_STEP_SUMMARY"
run: |
go run ./scripts/gotestsummary \
--jsonfile "${RUNNER_TEMP}/go-test.json" \
--markdown-out - \
--failures-out "${RUNNER_TEMP}/go-test-failures.ndjson" \
--max-output-bytes 16384 \
--max-failures 50 \
>> "$GITHUB_STEP_SUMMARY"
- name: Upload Go test JSON
- name: Upload Go test failures
if: failure() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: go-test-json-${{ github.job }}-${{ github.sha }}
path: ${{ runner.temp }}/go-test.json
name: go-test-failures-${{ github.job }}-${{ github.sha }}
path: ${{ runner.temp }}/go-test-failures.ndjson
retention-days: 7
- name: Upload failed test db dumps
@@ -671,14 +678,21 @@ jobs:
- name: Publish Go test failure summary
if: failure() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
run: bash scripts/go-test-failure-summary.sh "${RUNNER_TEMP}/go-test.json" >> "$GITHUB_STEP_SUMMARY"
run: |
go run ./scripts/gotestsummary \
--jsonfile "${RUNNER_TEMP}/go-test.json" \
--markdown-out - \
--failures-out "${RUNNER_TEMP}/go-test-failures.ndjson" \
--max-output-bytes 16384 \
--max-failures 50 \
>> "$GITHUB_STEP_SUMMARY"
- name: Upload Go test JSON
- name: Upload Go test failures
if: failure() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: go-test-json-${{ github.job }}-${{ github.sha }}
path: ${{ runner.temp }}/go-test.json
name: go-test-failures-${{ github.job }}-${{ github.sha }}
path: ${{ runner.temp }}/go-test-failures.ndjson
retention-days: 7
- name: Upload Test Cache
@@ -766,14 +780,21 @@ jobs:
- name: Publish Go test failure summary
if: failure() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
run: bash scripts/go-test-failure-summary.sh "${RUNNER_TEMP}/go-test.json" >> "$GITHUB_STEP_SUMMARY"
run: |
go run ./scripts/gotestsummary \
--jsonfile "${RUNNER_TEMP}/go-test.json" \
--markdown-out - \
--failures-out "${RUNNER_TEMP}/go-test-failures.ndjson" \
--max-output-bytes 16384 \
--max-failures 50 \
>> "$GITHUB_STEP_SUMMARY"
- name: Upload Go test JSON
- name: Upload Go test failures
if: failure() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: go-test-json-${{ github.job }}-${{ github.sha }}
path: ${{ runner.temp }}/go-test.json
name: go-test-failures-${{ github.job }}-${{ github.sha }}
path: ${{ runner.temp }}/go-test-failures.ndjson
retention-days: 7
- name: Upload Test Cache