rojo/scripts/ci.sh
Joe e617e8fcda Enhance audit documentation and improve Ref property handling
- Added a detailed section in the audit documentation outlining the sync system layout for both CLI syncback and two-way sync pipelines, including file mappings and processing steps.
- Updated `init.meta.json5` to include the `Rojo_Ref_PrimaryPart` attribute for better reference tracking.
- Improved the `ChangeProcessor` to populate the `RefPathIndex` from existing meta/model files at startup, ensuring accurate handling of pre-existing `Rojo_Ref_*` attributes during renames.
- Refactored the `remove_file` method in `RefPathIndex` to `remove_all_for_file`, enhancing the re-indexing process after attribute removals.
- Added tests to verify the correct behavior of the `RefPathIndex` and ensure robustness against edge cases.

These changes improve the clarity of the audit process and enhance the reliability of reference path management in the synchronization system.
2026-02-14 15:55:24 -06:00

181 lines
5.4 KiB
Bash

#!/usr/bin/env bash
# Complete CI Pipeline
# Usage: bash scripts/ci.sh [--no-rbx-dom]
set -o pipefail
RBX_DOM=true
for arg in "$@"; do
case "$arg" in
--no-rbx-dom) RBX_DOM=false ;;
esac
done
failures=()
step() {
echo ""
echo "=== Step $1: $2 ==="
}
record() {
if [ "$2" -ne 0 ]; then
failures+=("$1")
echo "FAIL"
else
echo "PASS"
fi
}
# ─── Rojo ────────────────────────────────────────────────────────────────────
step 1 "Auto-fix Lua Formatting (Stylua)"
stylua plugin/src
stylua_rojo=$?
record "Stylua (Rojo)" $stylua_rojo
step 2 "Auto-fix Rust Formatting"
cargo fmt
rustfmt_exit=$?
record "Rustfmt" $rustfmt_exit
step 3 "Auto-fix TypeScript Formatting (Prettier)"
(cd vscode-rojo && npx prettier --write "src/**/*.ts")
prettier_exit=$?
record "Prettier" $prettier_exit
step 4 "Compile TypeScript Extension (vscode-rojo)"
(cd vscode-rojo && npm run compile)
ts_build=$?
record "TS Compile (vscode-rojo)" $ts_build
step 5 "Lua Static Analysis (Selene)"
selene plugin/src
selene_exit=$?
record "Selene" $selene_exit
step 6 "Rust Linting (Clippy) - Auto-fix"
cargo clippy -j 16 --fix --allow-dirty --allow-staged >/dev/null 2>&1
echo "Verifying..."
cargo clippy -j 16 --all-targets --all-features 2>&1
clippy_exit=$?
record "Clippy" $clippy_exit
step 7 "Build Everything"
cargo build -j 16 --locked --all-targets --all-features
build_exit=$?
record "Build" $build_exit
step 8 "Run ALL Rust Tests"
cargo test -j 16 --locked --all-features -- --test-threads=16 2>&1
rust_tests=$?
record "Rust Tests" $rust_tests
step 9 "Run Roblox Plugin Tests"
./target/debug/atlas build plugin/test-place.project.json -o TestPlace.rbxl
if [ $? -eq 0 ]; then
run-in-roblox --script plugin/run-tests.server.lua --place TestPlace.rbxl
plugin_tests=$?
else
echo "Skipped: build failed"
plugin_tests=1
fi
record "Plugin Tests" $plugin_tests
# ─── rbx-dom ─────────────────────────────────────────────────────────────────
if [ "$RBX_DOM" = true ]; then
step 10 "Auto-fix Lua Formatting (Stylua) for rbx_dom_lua"
(cd rbx-dom && stylua rbx_dom_lua/src)
stylua_rbxdom=$?
record "Stylua (rbx_dom_lua)" $stylua_rbxdom
step 11 "Auto-fix Rust Formatting (rbx-dom)"
(cd rbx-dom && cargo fmt)
rustfmt_rbxdom=$?
record "Rustfmt (rbx-dom)" $rustfmt_rbxdom
step 12 "Lua Static Analysis (Selene) for rbx_dom_lua"
(cd rbx-dom && selene rbx_dom_lua/src)
selene_rbxdom=$?
record "Selene (rbx_dom_lua)" $selene_rbxdom
step 13 "Rust Linting (Clippy) for rbx-dom - Auto-fix"
(cd rbx-dom && cargo clippy -j 16 --fix --allow-dirty --allow-staged >/dev/null 2>&1)
echo "Verifying..."
(cd rbx-dom && cargo clippy -j 16 --all-targets --all-features -- -D warnings 2>&1)
clippy_rbxdom=$?
record "Clippy (rbx-dom)" $clippy_rbxdom
step 14 "Build rbx-dom"
(cd rbx-dom && cargo build -j 16 --verbose)
build_rbxdom=$?
(cd rbx-dom && cargo build -j 16 --all-features --verbose)
build_rbxdom_all=$?
record "Build (rbx-dom)" $build_rbxdom
record "Build (rbx-dom all-features)" $build_rbxdom_all
step 15 "Run ALL rbx-dom Rust Tests"
(cd rbx-dom && cargo test -j 16 --verbose -- --test-threads=16)
tests_rbxdom=$?
(cd rbx-dom && cargo test -j 16 --all-features --verbose -- --test-threads=16)
tests_rbxdom_all=$?
record "Tests (rbx-dom)" $tests_rbxdom
record "Tests (rbx-dom all-features)" $tests_rbxdom_all
fi
# ─── Report ──────────────────────────────────────────────────────────────────
pass_or_fail() { [ "$1" -eq 0 ] && echo "PASS" || echo "FAIL"; }
echo ""
echo "=== CI COMPLETE ==="
echo ""
echo "--- Rojo ---"
echo ""
echo "Formatting:"
echo " - Stylua: $(pass_or_fail $stylua_rojo)"
echo " - Rustfmt: $(pass_or_fail $rustfmt_exit)"
echo " - Prettier (vscode-rojo): $(pass_or_fail $prettier_exit)"
echo ""
echo "TS Compile (vscode-rojo): $(pass_or_fail $ts_build)"
echo ""
echo "Linting:"
echo " - Selene: $(pass_or_fail $selene_exit)"
echo " - Clippy: $(pass_or_fail $clippy_exit)"
echo ""
echo "Build: $(pass_or_fail $build_exit)"
echo ""
echo "Tests:"
echo " - Rust: $(pass_or_fail $rust_tests)"
echo " - Plugin: $(pass_or_fail $plugin_tests)"
if [ "$RBX_DOM" = true ]; then
echo ""
echo "--- rbx-dom ---"
echo ""
echo "Formatting:"
echo " - Stylua (rbx_dom_lua): $(pass_or_fail $stylua_rbxdom)"
echo " - Rustfmt: $(pass_or_fail $rustfmt_rbxdom)"
echo ""
echo "Linting:"
echo " - Selene (rbx_dom_lua): $(pass_or_fail $selene_rbxdom)"
echo " - Clippy: $(pass_or_fail $clippy_rbxdom)"
echo ""
echo "Build: $(pass_or_fail $build_rbxdom)"
echo "Build (all features): $(pass_or_fail $build_rbxdom_all)"
echo ""
echo "Tests:"
echo " - Rust: $(pass_or_fail $tests_rbxdom)"
echo " - Rust (all features): $(pass_or_fail $tests_rbxdom_all)"
fi
echo ""
if [ ${#failures[@]} -eq 0 ]; then
echo "--- Overall: PASS ---"
exit 0
else
echo "--- Overall: FAIL ---"
echo "Failed steps: $(IFS=', '; echo "${failures[*]}")"
exit 1
fi