Skip to content

Commit fc0efdc

Browse files
committed
Add CI change detection for node-renderer package
Added comprehensive CI change detection for the new react-on-rails-pro-node-renderer package: 1. **New flag**: PRO_NODE_RENDERER_CHANGED - Detects changes in packages/react-on-rails-pro-node-renderer/** 2. **Pattern matching**: Covers all node-renderer files - Source files (src/**/*) - Test files (tests/**/*) - Scripts (scripts/**/*) - Package config (package.json, tsconfig.json) - Workflow file (.github/workflows/node-renderer-tests.yml) 3. **Job logic**: RUN_PRO_NODE_RENDERER_TESTS triggered by - Node-renderer package changes - Pro JS changes (shared dependency) - Core Ruby changes (affects all packages) - Uncategorized changes (safety fallback) 4. **Output integration**: - Added to display output - Added to GITHUB_OUTPUT for CI workflows - Added to JSON output for programmatic parsing 5. **Removed TODO comment**: Resolved "need to add node-renderer tests" This ensures the node-renderer package tests run automatically when relevant files change, while avoiding unnecessary test runs for unrelated changes.
1 parent 787681f commit fc0efdc

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

script/ci-changes-detector

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ PRO_RUBY_CHANGED=false
6464
PRO_RSPEC_CHANGED=false
6565
PRO_JS_CHANGED=false
6666
PRO_DUMMY_CHANGED=false
67+
PRO_NODE_RENDERER_CHANGED=false
6768
UNCATEGORIZED_CHANGED=false
6869

6970
# Analyze each changed file
@@ -128,6 +129,12 @@ while IFS= read -r file; do
128129
PRO_DUMMY_CHANGED=true
129130
;;
130131

132+
# React on Rails Pro Node Renderer package (JS/TS source, tests, configs)
133+
packages/react-on-rails-pro-node-renderer/src/*|packages/react-on-rails-pro-node-renderer/src/**/*|packages/react-on-rails-pro-node-renderer/tests/*|packages/react-on-rails-pro-node-renderer/tests/**/*|packages/react-on-rails-pro-node-renderer/scripts/*|packages/react-on-rails-pro-node-renderer/scripts/**/*|packages/react-on-rails-pro-node-renderer/package.json|packages/react-on-rails-pro-node-renderer/tsconfig.json|.github/workflows/node-renderer-tests.yml)
134+
DOCS_ONLY=false
135+
PRO_NODE_RENDERER_CHANGED=true
136+
;;
137+
131138
# Lint/format configuration
132139
.rubocop.yml|.eslintrc*|.prettierrc*|tsconfig.json|.editorconfig|.github/workflows/lint-js-and-ruby.yml)
133140
DOCS_ONLY=false
@@ -215,7 +222,6 @@ if [ "$DOCS_ONLY" = true ]; then
215222
exit 0
216223
fi
217224

218-
# TODO: need to add node-renderer tests
219225
echo "Changed file categories:"
220226
[ "$RUBY_CHANGED" = true ] && echo -e "${YELLOW} • Ruby source code${NC}"
221227
[ "$JS_CHANGED" = true ] && echo -e "${YELLOW} • JavaScript/TypeScript code${NC}"
@@ -226,6 +232,7 @@ echo "Changed file categories:"
226232
[ "$PRO_RSPEC_CHANGED" = true ] && echo -e "${YELLOW} • React on Rails Pro RSpec tests${NC}"
227233
[ "$PRO_RUBY_CHANGED" = true ] && echo -e "${YELLOW} • React on Rails Pro Ruby source code${NC}"
228234
[ "$PRO_DUMMY_CHANGED" = true ] && echo -e "${YELLOW} • React on Rails Pro Dummy app${NC}"
235+
[ "$PRO_NODE_RENDERER_CHANGED" = true ] && echo -e "${YELLOW} • React on Rails Pro Node Renderer package${NC}"
229236
[ "$LINT_CONFIG_CHANGED" = true ] && echo -e "${YELLOW} • Lint/format configuration${NC}"
230237
[ "$PRO_LINT_CONFIG_CHANGED" = true ] && echo -e "${YELLOW} • React on Rails Pro lint/format configuration${NC}"
231238
[ "$UNCATEGORIZED_CHANGED" = true ] && echo -e "${YELLOW} • Uncategorized changes (running full suite for safety)${NC}"
@@ -242,6 +249,7 @@ RUN_GENERATORS=false
242249
RUN_PRO_LINT=false
243250
RUN_PRO_TESTS=false
244251
RUN_PRO_DUMMY_TESTS=false
252+
RUN_PRO_NODE_RENDERER_TESTS=false
245253

246254
if [ "$LINT_CONFIG_CHANGED" = true ] || [ "$RUBY_CHANGED" = true ] || [ "$JS_CHANGED" = true ] || [ "$SPEC_DUMMY_CHANGED" = true ]; then
247255
RUN_LINT=true
@@ -275,6 +283,10 @@ if [ "$PRO_DUMMY_CHANGED" = true ] || [ "$PRO_RUBY_CHANGED" = true ] || [ "$PRO_
275283
RUN_PRO_DUMMY_TESTS=true
276284
fi
277285

286+
if [ "$PRO_NODE_RENDERER_CHANGED" = true ] || [ "$PRO_JS_CHANGED" = true ] || [ "$RUBY_CHANGED" = true ]; then
287+
RUN_PRO_NODE_RENDERER_TESTS=true
288+
fi
289+
278290
# If we encounter a change that isn't explicitly categorized, default to running everything
279291
if [ "$UNCATEGORIZED_CHANGED" = true ]; then
280292
RUN_LINT=true
@@ -285,6 +297,7 @@ if [ "$UNCATEGORIZED_CHANGED" = true ]; then
285297
RUN_PRO_LINT=true
286298
RUN_PRO_TESTS=true
287299
RUN_PRO_DUMMY_TESTS=true
300+
RUN_PRO_NODE_RENDERER_TESTS=true
288301
fi
289302

290303
[ "$RUN_LINT" = true ] && echo " ✓ Lint (Ruby + JS)"
@@ -295,6 +308,7 @@ fi
295308
[ "$RUN_PRO_LINT" = true ] && echo " ✓ React on Rails Pro Lint (Ruby + JS)"
296309
[ "$RUN_PRO_TESTS" = true ] && echo " ✓ React on Rails Pro RSpec unit tests (Ruby + JS)"
297310
[ "$RUN_PRO_DUMMY_TESTS" = true ] && echo " ✓ React on Rails Pro Dummy app integration tests"
311+
[ "$RUN_PRO_NODE_RENDERER_TESTS" = true ] && echo " ✓ React on Rails Pro Node Renderer tests"
298312

299313
# Export as GitHub Actions outputs if running in CI
300314
if [ -n "${GITHUB_OUTPUT:-}" ]; then
@@ -308,6 +322,7 @@ if [ -n "${GITHUB_OUTPUT:-}" ]; then
308322
echo "run_pro_lint=$RUN_PRO_LINT"
309323
echo "run_pro_tests=$RUN_PRO_TESTS"
310324
echo "run_pro_dummy_tests=$RUN_PRO_DUMMY_TESTS"
325+
echo "run_pro_node_renderer_tests=$RUN_PRO_NODE_RENDERER_TESTS"
311326
} >> "$GITHUB_OUTPUT"
312327
fi
313328

@@ -323,7 +338,8 @@ if [ "${CI_JSON_OUTPUT:-}" = "1" ]; then
323338
"run_generators": $RUN_GENERATORS,
324339
"run_pro_lint": $RUN_PRO_LINT,
325340
"run_pro_tests": $RUN_PRO_TESTS,
326-
"run_pro_dummy_tests": $RUN_PRO_DUMMY_TESTS
341+
"run_pro_dummy_tests": $RUN_PRO_DUMMY_TESTS,
342+
"run_pro_node_renderer_tests": $RUN_PRO_NODE_RENDERER_TESTS
327343
}
328344
EOF
329345
fi

0 commit comments

Comments
 (0)