Skip to content

ci: cut redundant installs, desktop rebuild, and vite build from the test job - #590

Merged
Astro-Han merged 4 commits into
mainfrom
ci/conditional-tool-installs
Jul 6, 2026
Merged

Astro-Han merged 4 commits into
mainfrom
ci/conditional-tool-installs

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Three CI cuts on the test/e2e jobs (the bottleneck after #587), one per commit:

  1. Install ripgrep/xvfb only when missing — command -v X || install. No-op where the tool is preinstalled, installs where it isn't.
  2. Desktop skips its rebuild — move the vite bundle to dist-renderer (sibling of dist), so build:main's tsc side-files under dist/renderer and the vite bundle no longer collide. New desktop test:dist (test:checks + node --test dist/main) needs no rebuild. test:checks is factored out of pretest so the hygiene-check list lives in one place.
  3. Test job skips the vite build — test:dist only consumes tsc outputs; the vite bundle is never loaded by node tests (the index.html test reads src/, the hygiene checks skip dist/, e2e builds its own renderer in a separate job). Add build:test (everything except the vite renderer) and use it in the test job.

Why

After #587 the test job was ~167s. This PR's first iteration used emptyOutDir:false + a manual clean, which worked but was fragile. This revision switches to the dist-renderer split (which check-stale-dist.mjs's own header comment already described as the intended layout) and adds the build:test cut that the first iteration missed entirely — vite was building a renderer bundle that nothing in the test job consumes. Build-artifact sharing, dist caching, test sharding, larger runners, and build-script parallelism were evaluated (Codex + Claude consult + internal review) and rejected as over-engineering for a ~2-3 min CI on free 2-core runners.

Measured

Local: build:test 9.5s (skips vite), test:dist all suites pass / 0 fail (4863 tests incl. 2138 desktop), check:stale fresh, full build produces the dist-renderer bundle. CI will confirm the test-job wall (expected ~95-110s, approaching typecheck's ~90s floor).

Scope

Three commits, one per concern (independently reviewable and revertable):

  • ci: install ripgrep/xvfb only when missing
  • ci(test): skip desktop rebuild via dist-renderer split + test:dist
  • ci(test): skip the vite renderer build in the test job

Files: .github/workflows/ci.yml, apps/desktop/{vite.config.ts,package.json,src/main/main-window.ts}, package.json, scripts/check-stale-dist.mjs.

User-facing impact

None (CI + build scripts only). npm run dev (vite dev server) is unaffected. The renderer bundle now lives at dist-renderer instead of dist/renderer; the only code that loaded the bundle is the one loadFile in main-window.ts (updated), and check-stale-dist.mjs's renderer pair (updated to match its own header comment).

Reviewer notes

  • The dist-renderer move is the cross-cutting change; its runtime effect is covered by the e2e job, which loads the window via loadFile.
  • emptyOutDir now safely clears only dist-renderer; tsc side-files in dist/renderer are never touched by vite — this removes the prior iteration's clean-list fragility and the incremental-tsc transition footgun.
  • test:checks is shared by pretest and test:dist, so the console/a11y/copy check list has a single source.

@Astro-Han Astro-Han changed the title ci: install ripgrep/xvfb only when missing ci: skip redundant installs and desktop rebuild in test job Jul 6, 2026
Astro-Han added 3 commits July 7, 2026 04:26
Make the ripgrep and xvfb install steps conditional
(`command -v X || install`): a no-op where the tool is already present,
still installs on images that lack it. No assumption about what any image
ships.
Move the vite renderer bundle to `dist-renderer` (sibling of `dist`) so
`build:main`'s tsc side-files under `dist/renderer` (helpers imported by
main/__tests__) and the vite bundle no longer collide. `emptyOutDir` clears
only `dist-renderer`; the tsc side-files stay intact, so desktop no longer
needs `clean:main && build:main` before testing.

- vite outDir -> `../../dist-renderer`; main-window `loadFile` updated;
  check-stale-dist renderer pair updated (its header comment already
  described this two-output layout).
- desktop `test:dist` = `test:checks` (console/a11y/copy, factored out of
  `pretest` so the list is not duplicated) + `node --test dist/main`, no rebuild.
- root `test:dist` calls desktop `test:dist` instead of `test`.
`test:dist` only consumes tsc outputs (`dist/main` + `dist/renderer`
side-files). The vite bundle is never loaded by node tests: the index.html
test reads `src/`, the hygiene checks skip `dist/`, and e2e builds its own
renderer in a separate job. Add `build:test` (builds everything except the
vite renderer bundle) and use it in the test job instead of the full build.
@Astro-Han
Astro-Han force-pushed the ci/conditional-tool-installs branch from df62d4e to 4f7e976 Compare July 6, 2026 20:28
@Astro-Han Astro-Han changed the title ci: skip redundant installs and desktop rebuild in test job ci: cut redundant installs, desktop rebuild, and vite build from the test job Jul 6, 2026
The vite renderer bundle moved to apps/desktop/dist-renderer; .gitignore
only covered `dist`, so the new output showed as untracked. Add
`dist-renderer` alongside `dist`. (Codex review P2.)
@Astro-Han
Astro-Han merged commit 2300f81 into main Jul 6, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the ci/conditional-tool-installs branch July 14, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant