internal/contributor-info/ci-optimization.md
This document explains the CI optimization strategy implemented for React on Rails.
The CI pipeline has been optimized to:
All workflows now use paths-ignore to skip when only certain files change:
on:
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
Benefits:
The main test workflow includes a detect-changes job that:
Example:
jobs:
detect-changes:
runs-on: ubuntu-22.04
outputs:
skip_tests: ${{ steps.changes.outputs.skip_tests }}
steps:
- name: Detect changes
# ... analyzes git diff
On PRs, we run a reduced test matrix for faster feedback:
| Environment | Main Branch | Pull Requests |
|---|---|---|
| Ruby versions | 3.2, 3.4 | 3.4 only |
| Node versions | 20, 22 | 22 only |
| Dependencies | minimum, latest | latest only |
Benefits:
Implementation:
matrix:
ruby-version: ${{ github.ref == 'refs/heads/main' && fromJSON('["3.2", "3.4"]') || fromJSON('["3.4"]') }}
node-version: ${{ github.ref == 'refs/heads/main' && fromJSON('["20", "22"]') || fromJSON('["22"]') }}
Each workflow ignores paths that don't affect its tests:
lib/**, spec/react_on_rails/**)packages/react-on-rails/src/**)bin/ci-local - Smart Local CI RunnerRuns appropriate CI checks based on your changes:
# Auto-detect what to test based on changes
bin/ci-local
# Run all CI checks (same as main)
bin/ci-local --all
# Run only fast checks
bin/ci-local --fast
# Compare against specific branch
bin/ci-local origin/develop
Features:
script/ci-changes-detector - Change Analysis ToolAnalyzes which files changed and recommends CI jobs:
# Check changes since main
script/ci-changes-detector origin/main
# Check changes between any refs
script/ci-changes-detector origin/develop HEAD
Output:
=== CI Changes Analysis ===
Changed file categories:
• Ruby source code
• JavaScript/TypeScript code
Recommended CI jobs:
✓ Lint (Ruby + JS)
✓ RSpec gem tests
✓ JS unit tests
✓ Dummy app integration tests
/run-ci Claude CommandClaude Code command for interactive CI execution:
/run-ci
Claude will:
| Workflow | Runs On | Skips For | Matrix Reduction |
|---|---|---|---|
main.yml | Code changes | Docs only | Yes (75% faster) |
lint-js-and-ruby.yml | Code changes | Docs only | No (already fast) |
examples.yml | Generator changes | Docs only | Yes (50% faster) |
package-js-tests.yml | JS changes | Docs, Ruby files | Yes (50% faster) |
rspec-package-specs.yml | Ruby changes | Docs, JS files | Yes (75% faster) |
check-markdown-links.yml | Markdown changes | Non-docs | No (already optimized) |
Run local CI before pushing:
bin/ci-local
Use fast mode for quick checks:
bin/ci-local --fast
Separate doc changes from code changes:
Trust the PR CI:
Monitor CI performance:
Update path filters:
Review main CI failures:
Check if:
git diff --name-only)paths-ignorebin/ci-local --fast for local testingbin/ci-local --all to match CI exactlyPotential further optimizations:
script/ci-changes-detector - Change detection scriptbin/ci-local - Local CI runner.claude/commands/run-ci.md - Claude command.github/workflows/*.yml - All CI workflows