Skip to content

Commit fbda2dc

Browse files
justin808claude
andcommitted
Update CONTRIBUTING.md files with CI optimization documentation
Add comprehensive CI testing section to both main and Pro CONTRIBUTING.md files: - Document new CI behavior (reduced matrix on PRs, full on master) - Add bin/ci-local usage examples and best practices - Add script/ci-changes-detector documentation - Add /run-ci Claude Code command reference - Include CI optimization table showing time savings - Reference docs/CI_OPTIMIZATION.md for details Addresses review comment #3488599517 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent deb7bb9 commit fbda2dc

File tree

2 files changed

+154
-0
lines changed

2 files changed

+154
-0
lines changed

CONTRIBUTING.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,105 @@ Run `rake -T` or `rake -D` to see testing options.
322322

323323
See below for verifying changes to the generators.
324324

325+
## CI Testing and Optimization
326+
327+
React on Rails uses an optimized CI pipeline that runs faster on branches while maintaining full coverage on `master`. Contributors have access to local CI tools to validate changes before pushing.
328+
329+
### CI Behavior
330+
331+
- **On PRs/Branches**: Runs reduced test matrix (latest Ruby/Node versions only) for faster feedback (~12 min vs ~45 min)
332+
- **On Master**: Runs full test matrix (all Ruby/Node/dependency combinations) for complete coverage
333+
- **Docs-only changes**: CI skips entirely when only `.md` files or `docs/` directory change
334+
335+
### Local CI Tools
336+
337+
#### `bin/ci-local` - Smart Local CI Runner
338+
339+
Analyzes your changes and runs appropriate tests locally before pushing:
340+
341+
```bash
342+
# Auto-detect what to test based on changed files
343+
bin/ci-local
344+
345+
# Run all CI checks (same as master branch)
346+
bin/ci-local --all
347+
348+
# Quick check - only fast tests, skip slow integration tests
349+
bin/ci-local --fast
350+
351+
# Compare against a different branch
352+
bin/ci-local origin/develop
353+
```
354+
355+
**Benefits:**
356+
357+
- Catches CI failures before pushing
358+
- Skips irrelevant tests (e.g., Ruby tests when only JS changed)
359+
- Provides clear summary of what passed/failed
360+
361+
#### `script/ci-changes-detector` - Change Analysis
362+
363+
Analyzes git changes and recommends which CI jobs to run:
364+
365+
```bash
366+
# Check what changed since master
367+
script/ci-changes-detector origin/master
368+
369+
# JSON output for scripting (requires jq)
370+
CI_JSON_OUTPUT=1 script/ci-changes-detector origin/master
371+
```
372+
373+
**Output example:**
374+
375+
```
376+
=== CI Changes Analysis ===
377+
Changed file categories:
378+
• Ruby source code
379+
• JavaScript/TypeScript code
380+
381+
Recommended CI jobs:
382+
✓ Lint (Ruby + JS)
383+
✓ RSpec gem tests
384+
✓ JS unit tests
385+
```
386+
387+
#### `/run-ci` - Claude Code Command
388+
389+
If using Claude Code, run `/run-ci` for interactive CI execution that:
390+
391+
1. Analyzes your changes
392+
2. Shows recommended CI jobs
393+
3. Asks which tests to run
394+
4. Executes and reports results
395+
396+
### CI Best Practices
397+
398+
**DO:**
399+
400+
- Run `bin/ci-local` before pushing to catch issues early
401+
- Use `bin/ci-local --fast` during rapid iteration
402+
- Trust the reduced matrix on PRs - master validates everything
403+
- Separate docs-only changes into dedicated commits/PRs when possible
404+
405+
**DON'T:**
406+
407+
- Push without running local tests first
408+
- Mix code and docs changes if you want docs to skip CI
409+
- Expect PR CI to catch minimum Ruby/Node version issues (use `bin/ci-local --all` for that)
410+
411+
### Understanding CI Optimizations
412+
413+
The CI system intelligently skips unnecessary work:
414+
415+
| Change Type | CI Behavior | Time Saved |
416+
| -------------------------- | --------------------- | ---------- |
417+
| Docs only (`.md`, `docs/`) | Skips all CI | 100% |
418+
| Ruby code only | Skips JS tests | ~30% |
419+
| JS code only | Skips Ruby-only tests | ~30% |
420+
| Workflow changes | Runs lint only | ~75% |
421+
422+
For more details, see [`docs/CI_OPTIMIZATION.md`](./docs/CI_OPTIMIZATION.md).
423+
325424
### Install Generator
326425

327426
In your Rails app add this gem with a path to your fork.

react_on_rails_pro/CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,61 @@ See [Run NPM JS tests](#run-npm-js-tests) for the JS tests and [RSpec Testing](#
6161

6262
See [Dev Initial Setup](#dev-initial-setup) below for, well... initial setup.
6363

64+
## CI Testing and Optimization
65+
66+
React on Rails Pro shares the optimized CI pipeline with the main gem. The CI system intelligently runs only relevant tests based on file changes.
67+
68+
### CI Behavior
69+
70+
- **On PRs/Branches**: Runs reduced test matrix (latest Ruby/Node versions only) for faster feedback
71+
- **On Master**: Runs full test matrix (all Ruby/Node/dependency combinations) for complete coverage
72+
- **Docs-only changes**: CI skips entirely when only `.md` files or `docs/` directory change
73+
74+
### Local CI Tools
75+
76+
The repository root provides local CI tools that work with both the main gem and Pro:
77+
78+
#### `bin/ci-local` - Smart Local CI Runner
79+
80+
Run from the **repository root** to test Pro changes:
81+
82+
```bash
83+
# Navigate to repository root first
84+
cd ..
85+
86+
# Auto-detect what to test (includes Pro tests if Pro files changed)
87+
bin/ci-local
88+
89+
# Run all CI checks (same as master branch)
90+
bin/ci-local --all
91+
92+
# Quick check - only fast tests
93+
bin/ci-local --fast
94+
```
95+
96+
The detector automatically identifies Pro-related changes and runs appropriate Pro tests.
97+
98+
#### `script/ci-changes-detector` - Change Analysis
99+
100+
Analyzes changes to both main gem and Pro:
101+
102+
```bash
103+
# From repository root
104+
script/ci-changes-detector origin/master
105+
```
106+
107+
### CI Best Practices for Pro
108+
109+
**DO:**
110+
- Run `bin/ci-local` from repository root before pushing
111+
- Test Pro changes alongside main gem changes if modifying both
112+
- Use `bin/ci-local --fast` during rapid iteration
113+
114+
**DON'T:**
115+
- Push Pro changes without testing locally first
116+
- Modify both Pro and main gem without running full tests
117+
118+
For comprehensive CI documentation, see [`../docs/CI_OPTIMIZATION.md`](../docs/CI_OPTIMIZATION.md) in the repository root.
64119

65120
# IDE/Editor Setup
66121
It's critical to configure your IDE/editor to ignore certain directories. Otherwise your IDE might slow to a crawl!

0 commit comments

Comments
 (0)