Skip to content

Commit 36b1341

Browse files
committed
fix(ci): skip oclif shell probe in egg-bin
1 parent 92c47ea commit 36b1341

16 files changed

Lines changed: 701 additions & 39 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name: CI
33

44
on:
5+
workflow_dispatch:
56
push:
67
paths-ignore:
78
- '**/*.md'
@@ -229,17 +230,13 @@ jobs:
229230
strategy:
230231
fail-fast: false
231232
matrix:
232-
os: ['ubuntu-latest', 'windows-latest']
233-
node: ['24']
234-
coverage: [false]
235-
exclude:
236-
- os: 'ubuntu-latest'
237-
node: '24'
238-
coverage: false
239233
include:
240234
- os: 'ubuntu-latest'
241235
node: '24'
242236
coverage: true
237+
- os: 'windows-latest'
238+
node: '24'
239+
coverage: false
243240

244241
name: Test bin (${{ matrix.os }}, ${{ matrix.node }})
245242
runs-on: ${{ matrix.os }}
@@ -273,17 +270,25 @@ jobs:
273270
UTOO_CACHE_DIR: ${{ runner.temp }}/utoo-store
274271
run: ut install --from pnpm
275272

273+
- name: Build egg-bin
274+
run: ut run build -- --workspace ./tools/egg-bin
275+
276+
- name: Report egg-bin runner diagnostics
277+
if: always()
278+
run: node scripts/ci-runner-diagnostics.js --name "Egg-bin runner diagnostics (${{ matrix.os }}, Node ${{ matrix.node }})" --samples 5 -- node tools/egg-bin/bin/run.js --version
279+
276280
- name: Run tests (with coverage)
277281
if: ${{ matrix.coverage }}
278-
run: |
279-
ut run build -- --workspace ./tools/egg-bin
280-
ut run ci --workspace @eggjs/bin
282+
run: ut run ci --workspace @eggjs/bin
281283

282284
- name: Run tests
283285
if: ${{ !matrix.coverage }}
284-
run: |
285-
ut run build -- --workspace ./tools/egg-bin
286-
ut run test --workspace @eggjs/bin
286+
run: ut run test --workspace @eggjs/bin
287+
288+
- name: Report bin parallelism metrics
289+
if: always()
290+
working-directory: tools/egg-bin
291+
run: node ../../scripts/ci-test-benchmark.js --report-only --vitest-json benchmark/ci-test/ci-run/vitest-results.json --output-dir benchmark/ci-test/ci-run --name "Egg-bin test metrics (${{ matrix.os }}, Node ${{ matrix.node }})" -- vitest run ${{ matrix.coverage && '--coverage' || '' }}
287292

288293
- name: Code Coverage
289294
if: ${{ matrix.coverage }}

benchmark/ci-test/README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ ut run benchmark:ci-test -- --output-dir .tmp/ci-benchmark -- ut execute vitest
2121

2222
# Summarize an existing Vitest JSON without running tests (the CI path)
2323
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
2428
```
2529

2630
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.
2732

2833
## Parallelism metrics
2934

@@ -36,20 +41,24 @@ Tests run with `isolate: false` (full parallelism; the tegg `TeggScope` per-app
3641
- **Parallel efficiency**`avg concurrency ÷ worker ceiling` (the ceiling mirrors `vitest.config.ts`: Windows CI caps workers, otherwise the machine's available parallelism).
3742
- **Critical path** — the longest single-file span (the wall-clock floor with unlimited workers).
3843

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+
3946
> **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.
4047
4148
## CI integration
4249

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:
4451

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.
4857

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.
5059

5160
## Outputs
5261

5362
- `report.md`: human-readable benchmark report (run, environment, parameters, parallelism, long-tail tables).
54-
- `report.json`: structured report containing environment, command, wall time, Vitest summary, parallelism metrics, long-tail file/project durations, and coverage/worker/isolate parameters.
63+
- `report.json`: structured report containing environment, command, wall time, Vitest summary, parallelism metrics, long-tail project/file/test durations, and coverage/worker/isolate parameters.
5564
- `vitest-results.json`: raw Vitest JSON reporter output.

0 commit comments

Comments
 (0)