Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Dec 4, 2025

Summary

Simplify CI workflow and reorganize tests folder for cleaner filtering.

Tests Folder Reorganization

tests/
β”œβ”€β”€ setup.ts         # Global Jest setup
β”œβ”€β”€ testUtils.ts     # Shared utilities
β”œβ”€β”€ __mocks__/       # Jest mocks
β”œβ”€β”€ ipc/             # Backend IPC integration tests (moved from integration/ipc/)
β”œβ”€β”€ runtime/         # Runtime tests (Docker SSH)
β”œβ”€β”€ e2e/             # Playwright E2E tests
└── worker-test.test.ts

Philosophy: Unit tests colocated in src/, integration tests in tests/.

  • Flattened tests/integration/ipc/ β†’ tests/ipc/
  • Moved tests/models/knownModels.test.ts β†’ src/common/constants/ (colocated with implementation)

CI Integration Test Filtering

Change Type Integration Tests
Docs-only Skip entire job
Browser-only Run tests/ excluding tests/ipc/
Otherwise Run all tests/

Future-proof: New tests/foo/*.test.ts directories are automatically included. Uses --testPathIgnorePatterns for browser-only exclusion instead of hardcoding paths.

Other Changes

  • Runtime tests now actually run in CI (were previously missed)
  • Backend filter uses tests/** with !tests/e2e/** exclusion

Generated with mux

@ammar-agent ammar-agent force-pushed the ci-selective-test-execution branch 2 times, most recently from a9223c8 to 8ade4f1 Compare December 5, 2025 16:38
Implements a coverage-based test selection system to reduce CI time by
running only the integration tests affected by code changes.

Components:
- generate-coverage-map.ts: Runs tests individually with coverage to
  build a reverse index (source file β†’ tests that cover it)
- select-affected-tests.ts: Selects tests based on changed files,
  with safe fallbacks for infrastructure changes, new tests, and
  unmapped files
- coverage-map.yml: Daily workflow to regenerate the map and cache it
- Updated ci.yml: Restores map from cache and runs selective tests

Safety features:
- Falls back to all tests when map is missing/stale (>7 days)
- Infrastructure files (jest config, package.json, etc.) trigger all tests
- New/unmapped source files trigger all tests
- Exit code 2 signals fallback, ensuring CI always runs correct tests

_Generated with `mux`_
- Remove run-selective-tests.sh (logic is inline in CI workflow)
- Move CI/.github from infrastructure to ignored (doesn't affect tests)
- Add more ignored patterns (e2e tests, electron-builder)
- Fix verbose output capture in CI workflow
- Minor comment improvements
@ammar-agent ammar-agent force-pushed the ci-selective-test-execution branch 3 times, most recently from 3e29444 to eca7ff6 Compare December 5, 2025 16:51
Consolidate ci.yml and build.yml into a single pr.yml workflow with
selective execution based on changed files.

Changes:
- Rename ci.yml β†’ pr.yml, merge in build.yml jobs
- Add dorny/paths-filter to detect docs-only PRs
- Skip all tests/builds for docs-only changes
- Consistent job naming: Test/*, Build/*, Smoke/*
- Single 'required' job for branch protection

Job structure:
- changes: detect docs-only PRs
- static-check: lint, typecheck, fmt
- test-unit, test-integration, test-storybook, test-e2e
- smoke-server, smoke-docker (merge_group only)
- build-linux, build-macos, build-vscode
- codex-comments
- required: aggregates all job results

Configure branch protection to require only 'PR / Required'.

_Generated with `mux`_
@ammar-agent ammar-agent force-pushed the ci-selective-test-execution branch from eca7ff6 to f371a13 Compare December 5, 2025 16:55
- Flatten tests/integration/ipc/ to tests/ipc/
- Move tests/models/knownModels.test.ts to src/common/constants/ (colocate with implementation)
- Delete orphan tests/worker-test.test.ts
- Update CI to run tests/ipc + tests/runtime (fixes runtime tests not running)
- Update paths-filter backend filter for new structure

Tests philosophy: unit tests colocated in src/, integration tests in tests/
Instead of skipping the entire integration job, compute which test
directories to run based on paths-filter outputs:

- ipc filter: src/node/services, orpc, config, git, utils, common, cli, desktop, tests/ipc
- runtime filter: src/node/runtime, tests/runtime
- config changes: run all integration tests
- manual override: workflow_dispatch test_filter still works

The job always runs (unless docs-only), but tests are scoped to relevant changes.
@ammar-agent ammar-agent force-pushed the ci-selective-test-execution branch 2 times, most recently from b27e12f to 5adce51 Compare December 5, 2025 18:30
- docs-only: skip entire integration job (job-level if)
- browser-only: skip tests/ipc, run all other tests under tests/
- otherwise: run ALL tests under tests/ (new directories auto-included)

Uses --testPathIgnorePatterns for browser-only exclusion.
Jest's testMatch only picks up *.test.ts, so e2e/*.spec.ts is already excluded.
@ammar-agent ammar-agent force-pushed the ci-selective-test-execution branch from 5adce51 to e6ca02e Compare December 5, 2025 19:35
@ammar-agent ammar-agent changed the title πŸ€– feat: add selective integration test execution system πŸ€– refactor: simplify CI and tests folder structure Dec 5, 2025
@ammario ammario merged commit bf49482 into main Dec 5, 2025
19 checks passed
@ammario ammario deleted the ci-selective-test-execution branch December 5, 2025 20:34
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.

2 participants