You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: benchmark/ci-test/README.md
+15-6Lines changed: 15 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,14 @@ ut run benchmark:ci-test -- --output-dir .tmp/ci-benchmark -- ut execute vitest
21
21
22
22
# Summarize an existing Vitest JSON without running tests (the CI path)
23
23
ut run benchmark:ci-test -- --report-only --vitest-json benchmark/ci-test/ci-run/vitest-results.json
24
+
25
+
# From tools/egg-bin, summarize a package-local run with command metadata
26
+
cd tools/egg-bin
27
+
node ../../scripts/ci-test-benchmark.js --report-only --vitest-json benchmark/ci-test/ci-run/vitest-results.json -- vitest run
24
28
```
25
29
26
30
The default output directory is `benchmark/ci-test/<timestamp>`. Use `--output-dir` for a deterministic path when collecting artifacts.
31
+
In report-only mode, arguments after `--` describe the original Vitest command for the report's parameter table; they are not executed.
27
32
28
33
## Parallelism metrics
29
34
@@ -36,20 +41,24 @@ Tests run with `isolate: false` (full parallelism; the tegg `TeggScope` per-app
36
41
-**Parallel efficiency** — `avg concurrency ÷ worker ceiling` (the ceiling mirrors `vitest.config.ts`: Windows CI caps workers, otherwise the machine's available parallelism).
37
42
-**Critical path** — the longest single-file span (the wall-clock floor with unlimited workers).
38
43
44
+
The report also includes long-tail project, file, and test tables. The test table comes from Vitest `assertionResults[*].duration`, so it points at the specific slow cases inside fork-heavy files such as `tools/egg-bin`.
45
+
39
46
> **Interval caveat:** the Vitest 4 JSON reporter derives a file's `startTime`/`endTime` from test-level timings only, so the span covers test bodies and per-test `beforeEach`/`afterEach` but **excludes suite-level `beforeAll`/`afterAll` (where egg boots its apps — often the dominant per-file cost) and module transform/import**. That excluded time still occupies the worker threads, so **avg concurrency and parallel efficiency are lower bounds** on real worker utilization; for `beforeAll`-heavy suites avg can read below 1 while peak is high. Use **peak concurrency** as the primary signal. Fully-skipped files (no test timings) are dropped from the calculation.
40
47
41
48
## CI integration
42
49
43
-
The `test` gating job in `.github/workflows/ci.yml`is instrumented without changing gate semantics:
50
+
The `test`and `test-egg-bin`gating jobs in `.github/workflows/ci.yml`are instrumented without changing gate semantics:
44
51
45
-
1.`vitest.config.ts` adds a `json` reporter when `CI` is set, writing `benchmark/ci-test/ci-run/vitest-results.json` during the gating `ut run ci` run.
46
-
2. A `Report parallelism metrics` step (`if: always()`) runs the harness in `--report-only` mode against that JSON.
47
-
3. When `GITHUB_STEP_SUMMARY` is set, the Markdown report (including the parallelism table) is appended to the GitHub Actions job summary, so the metrics are visible on the run page per OS/Node matrix entry.
52
+
1. The relevant `vitest.config.ts` adds a `json` reporter when `CI` is set, writing `benchmark/ci-test/ci-run/vitest-results.json` during the gating test run.
53
+
2. The `test-egg-bin` job splits build and test into separate steps, and runs `scripts/ci-runner-diagnostics.js` after build to log runner hardware, Node process startup, egg-bin command startup, and temp-file IO baselines.
54
+
3. The `test-egg-bin` package harness enables `EGG_BIN_TIMING=1` when `CI` is set, propagates that flag into each spawned `egg-bin` child, and forces coffee debug output, so CI logs show per-child startup, oclif import/config/manifest/command-load phases, command init, glob/config, `startVitest`, and `vitest.close` timings. On Windows the entrypoint also presets `SHELL` when it is missing, avoiding oclif's synchronous shell probe in every child.
55
+
4. A `Report parallelism metrics` step (`if: always()`) runs the harness in `--report-only` mode against that JSON.
56
+
5. When `GITHUB_STEP_SUMMARY` is set, the Markdown reports (including the parallelism and long-tail test tables) are appended to the GitHub Actions job summary, so the metrics are visible on the run page per OS/Node matrix entry.
48
57
49
-
Gating still comes entirely from `ut run ci`; the metrics step is informational and exits `0` even when the JSON is missing.
58
+
Gating still comes entirely from the preceding test command (`ut run ci` or `ut run test`); the metrics step is informational and exits `0` even when the JSON is missing.
0 commit comments