Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Oct 12, 2025

Summary

Two high-impact CI optimizations that reduce runtime by 40-50% on subsequent runs, plus reduced duplication for maintainability.

Changes

1. Fix Duplicate TypeCheck Execution ⚑ (save 10-20s)

  • Problem: TypeScript was running twice in parallel during make -j3 static-check
    • scripts/lint.sh called typecheck.sh
    • Makefile also ran typecheck directly
    • Wasted 10-12 seconds per CI run
  • Solution: Removed typecheck call from lint.sh, let Makefile handle orchestration
  • Files: scripts/lint.sh, Makefile (updated help text)

2. Add Dependency Caching πŸš€ (save 90-180s total)

  • Problem: Every CI job ran bun install --frozen-lockfile from scratch (30-60s per job)
  • Solution: Cache ~/.bun/install/cache with GitHub Actions cache via composite action
  • Applies to: static-check, test, integration-test, e2e-test, build jobs
  • Bonus: Cache shfmt binary with -latest key to match install strategy (save 3-5s)
  • Files: .github/actions/setup-cmux/action.yml

3. Reduce Duplication 🧹 (60 lines removed)

  • Problem: Setup steps (Bun + cache + install) duplicated across 4 CI jobs
  • Solution: Use existing setup-cmux composite action consistently
  • Benefit: Single source of truth, easier to maintain
  • Files: .github/workflows/ci.yml

Expected Impact

Before:

  • CI runtime: ~3 minutes
  • No caching, duplicate work, scattered setup

After (first run):

  • CI runtime: ~2-2.5 minutes (cache population)
  • No duplicate work, centralized setup

After (cached runs):

  • CI runtime: ~1.5-2 minutes
  • 40-50% faster ⚑

Testing

  • Local verification: make static-check runs correctly
  • No duplicate typecheck in parallel execution
  • All static checks still pass
  • Reduced duplication improves maintainability
  • CI will populate caches on first run
  • Subsequent runs should show significant speedup

Low Risk

  • Removed redundant work, not changing functionality
  • Caching is standard GitHub Actions practice
  • Composite action already used in build workflows
  • Backward compatible
  • Easy to revert if issues arise

Generated with cmux

Focus on static check optimizations and low-hanging fruit:
- Caching strategies for dependencies, tools, and build artifacts
- Eliminating redundant typecheck runs
- ESLint and Prettier caching
- Prioritized implementation roadmap with expected 40-60% speedup

Generated with `cmux`
Deep dive into current static check bottlenecks:
- Identified duplicate typecheck execution (10-12s waste)
- Tool-by-tool caching strategies for ESLint, Prettier, TypeScript
- Phase-by-phase implementation guide with timing analysis
- Expected 60% improvement on cached runs

Generated with `cmux`
Track progress of CI optimization phases:
- Phase 1: Immediate wins (dedupe + caching)
- Phase 2: TypeScript incremental builds
- Phase 3: Measurement & validation
- Baseline metrics and success criteria

Generated with `cmux`
Comprehensive quick-reference guide:
- Fast-track implementation steps for Phase 1
- Expected results and success criteria
- Verification commands and troubleshooting
- Links to detailed documentation

Generated with `cmux`
High-level overview of findings and recommendations:
- Critical issue: duplicate typecheck (10-20s waste)
- Missing: dependency caching (90-180s waste)
- Phase 1 ROI: 40 min work β†’ 40-60% speedup
- Recommendation: Implement Phase 1 immediately

Generated with `cmux`
Two high-impact optimizations:

1. Remove duplicate typecheck execution (save 10-20s)
   - scripts/lint.sh no longer calls typecheck.sh
   - Makefile static-check already runs typecheck separately
   - Was wasting 10-12s per CI run with redundant parallel execution

2. Add bun dependency caching (save 90-180s total)
   - Cache ~/.bun/install/cache across all CI jobs
   - Applies to: static-check, test, integration-test, e2e-test
   - Also cache shfmt binary (save 3-5s)
   - Updated composite action for build workflows

Expected improvement: 40-50% faster CI on subsequent runs

_Generated with `cmux`_
…ile lint target

- Use bun.lockb for Actions cache keys (proper invalidation)
- Align shfmt cache key with install strategy (latest)
- Update Makefile help text for lint to reflect new behavior

Minor readability, structure, and performance improvements.

_Generated with `cmux`_
The lockfile is bun.lock in this repo, not bun.lockb. Revert to correct filename.

_Generated with `cmux`_
Replace duplicate setup steps (Bun + cache + install) in all CI jobs
with the existing setup-cmux composite action. Reduces ~60 lines of
duplication.

Single source of truth for dependency setup makes future changes easier.

_Generated with `cmux`_
Remove multi-line format that was causing issues.

_Generated with `cmux`_
Combine install and PATH setup into single step, and verify shfmt is available
before proceeding to avoid PATH timing issues in GitHub Actions.

_Generated with `cmux`_
@ammario ammario added this pull request to the merge queue Oct 13, 2025
Merged via the queue into main with commit df4c863 Oct 13, 2025
7 checks passed
@ammario ammario deleted the ci-opt-fresh branch October 13, 2025 01:50
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