Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(ci): parse timing artifacts once (#119890)

Raúl Negrón-Otero017557ed014d
diff --git a/.github/actions/report-jest-timings/action.yml b/.github/actions/report-jest-timings/action.yml
index 3309b5a67d26..acc9cd05e4e8 100644
--- a/.github/actions/report-jest-timings/action.yml
+++ b/.github/actions/report-jest-timings/action.yml
@@ -14,7 +14,12 @@ runs:
env:
JEST_ARTIFACTS: ${{ inputs.artifacts }}
REPORT: ${{ runner.temp }}/jest-test-speed-report.html
- run: bin/report-jest-timings --artifacts "$JEST_ARTIFACTS" --html "$REPORT"
+ TIMINGS: ${{ runner.temp }}/jest-test-timings.json
+ run: |
+ # The parser can return without writing a report, so never reuse stale input.
+ : > "$TIMINGS"
+ "${UV:-uv}" run --script .github/scripts/report_test_timings.py --runner=jest --timings "$TIMINGS" "$JEST_ARTIFACTS"
+ bin/report-jest-timings --timings "$TIMINGS" --html "$REPORT"
- name: Upload browser report
id: report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.0
@@ -26,8 +31,8 @@ runs:
- name: Write timing summary
shell: bash
env:
- JEST_ARTIFACTS: ${{ inputs.artifacts }}
+ TIMINGS: ${{ runner.temp }}/jest-test-timings.json
REPORT_URL: ${{ steps.report.outputs.artifact-url }}
run: |
- bin/report-jest-timings --artifacts "$JEST_ARTIFACTS" --markdown-overview >> "$GITHUB_STEP_SUMMARY"
+ bin/report-jest-timings --timings "$TIMINGS" --markdown-overview >> "$GITHUB_STEP_SUMMARY"
printf '\n[Open the full interactive Jest timing report](%s)\n' "$REPORT_URL" >> "$GITHUB_STEP_SUMMARY"
diff --git a/.github/scripts/report_test_timings.py b/.github/scripts/report_test_timings.py
index b408b2bc2f40..ee02e4a14e6f 100644
--- a/.github/scripts/report_test_timings.py
+++ b/.github/scripts/report_test_timings.py
@@ -1099,6 +1099,8 @@ def main(argv: list[str] | None = None) -> int:
len(prior_failed_by_job),
)
+ # Metrics need the full unfiltered run, not the signal-trimmed emission set.
+ full_shards = shards
pre_filter = sum(len(s.tests) for s in shards)
min_duration_seconds = math.inf if args.signals_only else args.min_duration_seconds
shards = filter_shards(shards, min_duration_seconds, prior_failed_by_job)
@@ -1117,10 +1119,6 @@ def main(argv: list[str] | None = None) -> int:
return 0
if args.timings is not None:
- # Metrics need the full unfiltered run, not the signal-trimmed emission set.
- full_shards = collect_shards(args.artifacts_root, args.runner)
- if run_attempt > 1:
- full_shards, _ = partition_run_attempt(full_shards, run_attempt)
payload = json.dumps(build_timings_report(full_shards, args.artifacts_root, args.runner), indent=2)
if str(args.timings) == "-":
sys.stdout.write(payload + "\n")