Skip to content

Optimize test CI workflow for faster execution#4

Merged
gricha merged 1 commit intomainfrom
optimize/test-ci-speed
Jan 5, 2026
Merged

Optimize test CI workflow for faster execution#4
gricha merged 1 commit intomainfrom
optimize/test-ci-speed

Conversation

@gricha
Copy link
Copy Markdown
Owner

@gricha gricha commented Jan 5, 2026

Summary

Optimizes the test CI workflow to reduce execution time through parallelization and smart Docker caching.

Key Changes

  1. Parallel jobs: Split into 3 jobs that can run concurrently:

    • lint: Linting, format check, typecheck (~30s)
    • build: Build CLI and web UI (~1min)
    • test: Integration/E2E tests (depends on build, ~5-6min)
  2. Smart Docker caching with BuildKit:

    • Always builds Docker image (ensures correctness)
    • Uses registry-based layer caching (cache-from)
    • Detects if perry/ directory changed to decide when to update cache
    • Fast builds (~10-30s) when layers are cached
    • Full rebuild when Dockerfile/scripts change
  3. Bun dependency caching: Proper caching of:

    • ~/.bun/install/cache
    • node_modules
    • web/node_modules
  4. Build artifacts: Upload/download dist directory between jobs

How Docker Caching Works

Scenario Behavior
Dockerfile unchanged Fast build using cached layers (~10-30s)
Dockerfile changed Full rebuild + update cache
First run (no cache) Full build + populate cache

This ensures:

  • Tests always run against the correct Docker image for the code being tested
  • Dockerfile changes are properly tested (not using stale image)
  • Fast CI when only non-Docker code changes

Expected Performance

Metric Before After
Total time (no Docker changes) ~10 min ~6-7 min
Total time (Docker changes) ~10 min ~8-9 min
Docker image build From scratch (~3min) Cached (~30s) or rebuild
Lint/typecheck Sequential Parallel with build

Test Plan

  • Workflow structure is correct
  • Docker change detection works for PRs and pushes
  • BuildKit caching configured correctly
  • Verify fast builds with cache hit (after merge)
  • Verify full rebuild when Dockerfile changes

🤖 Generated with Claude Code

Key optimizations:

1. **Parallel jobs**: Split into lint, build, and test jobs
   - lint: Runs linting, format check, and typecheck in parallel with build
   - build: Builds CLI and web UI, uploads artifacts
   - test: Downloads artifacts and runs integration tests

2. **Smart Docker caching with BuildKit**:
   - Always builds Docker image (ensures tests use correct image)
   - Uses registry-based layer caching (cache-from)
   - Detects perry/ directory changes to decide when to update cache
   - Fast builds (~30s) when using cached layers
   - Full rebuild when Dockerfile/scripts change

3. **Bun dependency caching**: Proper caching of bun install cache
   and node_modules directories

4. **Test setup optimization**: Skip Docker build in test setup
   when image already exists (CI pre-builds it)

Expected performance:
- No Dockerfile changes: ~6-7min (cached Docker layers)
- Dockerfile changes: ~8-9min (full Docker rebuild)
- Previous: ~10min

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gricha gricha force-pushed the optimize/test-ci-speed branch from 92feed1 to b6c4bbf Compare January 5, 2026 19:06
@gricha gricha merged commit b37c9f2 into main Jan 5, 2026
3 checks passed
@gricha gricha deleted the optimize/test-ci-speed branch January 7, 2026 06:55
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