mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Refactor CI pipeline scripts and documentation
- Consolidated CI pipeline steps into PowerShell and Bash scripts for improved usability and consistency. - Updated documentation in `ci.md` to clarify the execution process and options for skipping the rbx-dom section. - Enhanced error handling and reporting in the scripts to provide clearer feedback on CI step results. - Streamlined formatting and linting processes for both Rojo and rbx-dom, ensuring a more efficient CI workflow.
This commit is contained in:
parent
9688224cb4
commit
f496bee347
8 changed files with 473 additions and 193 deletions
|
|
@ -1,185 +1,50 @@
|
|||
# /ci - Complete CI Pipeline
|
||||
|
||||
Run the complete CI pipeline: auto-fix all formatting, run all linters, build everything, and run ALL tests.
|
||||
Run the complete CI pipeline by executing the appropriate platform script.
|
||||
|
||||
## Instructions
|
||||
|
||||
- If the user's message contains **"rbx-dom"**, run **both** the Rojo and rbx-dom sections below.
|
||||
- Otherwise, **skip the entire rbx-dom section** (steps 9–14) to save time.
|
||||
### 1. Determine rbx-dom Flag
|
||||
|
||||
Execute ALL applicable steps in order. Fix issues automatically where possible.
|
||||
- By default, run **without** the skip flag (full suite including rbx-dom).
|
||||
- If the user's message asks to **skip rbx-dom**, pass the skip flag (`-NoRbxDom` / `--no-rbx-dom`).
|
||||
|
||||
---
|
||||
### 2. Run the CI Script
|
||||
|
||||
## Rojo
|
||||
|
||||
### 1. Auto-fix Lua Formatting (Stylua)
|
||||
**Windows (PowerShell):**
|
||||
```powershell
|
||||
stylua plugin/src
|
||||
.\scripts\ci.ps1 # with rbx-dom
|
||||
.\scripts\ci.ps1 -NoRbxDom # without rbx-dom
|
||||
```
|
||||
|
||||
### 2. Auto-fix Rust Formatting
|
||||
```powershell
|
||||
cargo fmt
|
||||
**macOS/Linux (Bash):**
|
||||
```bash
|
||||
bash scripts/ci.sh # with rbx-dom
|
||||
bash scripts/ci.sh --no-rbx-dom # without rbx-dom
|
||||
```
|
||||
|
||||
### 3. Auto-fix TypeScript Formatting (Prettier) for vscode-rojo
|
||||
```powershell
|
||||
cd vscode-rojo
|
||||
npx prettier --write "src/**/*.ts"
|
||||
cd ..
|
||||
```
|
||||
**Monitor the script output as it runs.** After each step completes, check its result. If a step failed, kill the script and switch to manual fixing (step 3) — don't let it continue to the next step.
|
||||
|
||||
### 4. Lua Static Analysis (Selene) - MUST PASS WITH ZERO ISSUES
|
||||
```powershell
|
||||
selene plugin/src
|
||||
```
|
||||
### 3. Fix Failures Between Steps
|
||||
|
||||
**CRITICAL: Selene must exit with code 0 (zero errors AND zero warnings).** Warnings count as failures.
|
||||
When a step fails, stop the script and fix the issue before continuing. Use targeted commands to speed up the feedback loop:
|
||||
|
||||
If Selene reports ANY errors or warnings:
|
||||
1. **FIX THEM IMMEDIATELY** before proceeding - do not just report them
|
||||
2. Common fixes:
|
||||
- `unused_variable`: Replace with `_` (e.g., `for _ = 1, 10 do`) or remove the variable entirely
|
||||
- `unused_variable` for imports: Remove the unused require/import line
|
||||
3. Re-run Selene after fixes to confirm exit code 0
|
||||
4. Only proceed once Selene shows: `Results: 0 errors, 0 warnings, 0 parse errors`
|
||||
1. **Formatting/linting failures** — auto-fix with the relevant formatter (`cargo fmt`, `stylua`), then verify with the specific check command only (e.g. `cargo fmt --check`).
|
||||
|
||||
### 5. Rust Linting (Clippy) - Auto-fix where possible
|
||||
```powershell
|
||||
cargo clippy --fix --allow-dirty --allow-staged
|
||||
```
|
||||
Then verify with:
|
||||
```powershell
|
||||
cargo clippy --all-targets --all-features
|
||||
```
|
||||
If there are remaining warnings/errors, fix them before proceeding.
|
||||
2. **Test failures — investigate the implementation, not just the tests.** For every failing test:
|
||||
- Read the failing test to understand what behavior it asserts.
|
||||
- Read the implementation code the test exercises.
|
||||
- Determine the root cause:
|
||||
- **Implementation regression/bug:** The feature is incomplete or broken. **Fix the implementation** so the test passes. Do not weaken or delete the test.
|
||||
- **Outdated test fixture:** The test's snapshot or fixture data is stale because of an intentional change. Update the fixture with `cargo insta review`/`cargo insta accept`, or regenerate the fixture data. Confirm the new fixture reflects correct behavior.
|
||||
- **Incomplete feature:** A new feature was added but doesn't fully handle all cases the tests cover. **Complete the feature implementation** rather than trimming the tests to match a partial implementation.
|
||||
- **Never** delete or gut a test just to make CI green. Tests exist for a reason — the code must satisfy them, not the other way around.
|
||||
- **Re-run only the failing test(s)** to verify fixes quickly (e.g. `cargo test <test_name>`, `cargo test -p <crate>`). Do not re-run the entire suite until you believe all issues are resolved.
|
||||
|
||||
### 6. Build Everything
|
||||
```powershell
|
||||
cargo build --locked --all-targets --all-features
|
||||
```
|
||||
3. **After all known issues are fixed**, re-run the full CI script from step 2 to catch any remaining failures.
|
||||
|
||||
### 7. Run ALL Rust Tests
|
||||
```powershell
|
||||
cargo test --locked --all-targets --all-features
|
||||
```
|
||||
4. Repeat until the script exits with `Overall: PASS`.
|
||||
|
||||
### 8. Run Roblox Plugin Tests
|
||||
### 4. Report
|
||||
|
||||
**Do NOT use the scripts (`unit-test-plugin.ps1` / `unit-test-plugin.sh`).** They reference a system-installed binary which may not exist. Always use the freshly built binary from step 6.
|
||||
|
||||
```powershell
|
||||
.\target\debug\atlas.exe build plugin/test-place.project.json -o TestPlace.rbxl
|
||||
run-in-roblox --script plugin/run-tests.server.lua --place TestPlace.rbxl
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## rbx-dom (submodule)
|
||||
|
||||
All rbx-dom steps run inside the `rbx-dom/` directory.
|
||||
|
||||
### 9. Auto-fix Lua Formatting (Stylua) for rbx_dom_lua
|
||||
```powershell
|
||||
cd rbx-dom
|
||||
stylua rbx_dom_lua/src
|
||||
cd ..
|
||||
```
|
||||
|
||||
### 10. Auto-fix Rust Formatting
|
||||
```powershell
|
||||
cd rbx-dom
|
||||
cargo fmt
|
||||
cd ..
|
||||
```
|
||||
|
||||
### 11. Lua Static Analysis (Selene) for rbx_dom_lua - MUST PASS WITH ZERO ISSUES
|
||||
```powershell
|
||||
cd rbx-dom
|
||||
selene rbx_dom_lua/src
|
||||
cd ..
|
||||
```
|
||||
|
||||
Same rules as step 4: exit code 0 required, fix all errors and warnings before proceeding.
|
||||
|
||||
### 12. Rust Linting (Clippy) - Auto-fix where possible
|
||||
```powershell
|
||||
cd rbx-dom
|
||||
cargo clippy --fix --allow-dirty --allow-staged
|
||||
```
|
||||
Then verify with:
|
||||
```powershell
|
||||
cd rbx-dom
|
||||
cargo clippy --all-targets --all-features -- -D warnings
|
||||
cd ..
|
||||
```
|
||||
If there are remaining warnings/errors, fix them before proceeding.
|
||||
|
||||
### 13. Build rbx-dom
|
||||
```powershell
|
||||
cd rbx-dom
|
||||
cargo build --verbose
|
||||
cargo build --all-features --verbose
|
||||
cd ..
|
||||
```
|
||||
|
||||
### 14. Run ALL rbx-dom Rust Tests
|
||||
```powershell
|
||||
cd rbx-dom
|
||||
cargo test --verbose
|
||||
cargo test --all-features --verbose
|
||||
cd ..
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Reporting
|
||||
|
||||
After ALL steps complete, provide a summary:
|
||||
|
||||
```
|
||||
=== CI COMPLETE ===
|
||||
|
||||
--- Rojo ---
|
||||
|
||||
Formatting:
|
||||
- Stylua: [fixed X files / no changes needed]
|
||||
- Rustfmt: [fixed X files / no changes needed]
|
||||
- Prettier (vscode-rojo): [fixed X files / no changes needed]
|
||||
|
||||
Linting:
|
||||
- Selene: PASS (0 errors, 0 warnings) / FAIL (X errors, Y warnings)
|
||||
- Clippy: PASS / FAIL (X warnings)
|
||||
|
||||
Build: PASS / FAIL
|
||||
|
||||
Tests:
|
||||
- Rust: X passed, Y failed
|
||||
- Plugin: X passed, Y failed
|
||||
|
||||
--- rbx-dom (only if included) ---
|
||||
|
||||
Formatting:
|
||||
- Stylua (rbx_dom_lua): [fixed X files / no changes needed]
|
||||
- Rustfmt: [fixed X files / no changes needed]
|
||||
|
||||
Linting:
|
||||
- Selene (rbx_dom_lua): PASS (0 errors, 0 warnings) / FAIL (X errors, Y warnings)
|
||||
- Clippy: PASS / FAIL (X warnings)
|
||||
|
||||
Build: PASS / FAIL
|
||||
Build (all features): PASS / FAIL
|
||||
|
||||
Tests:
|
||||
- Rust: X passed, Y failed
|
||||
- Rust (all features): X passed, Y failed
|
||||
|
||||
--- Overall: PASS / FAIL ---
|
||||
```
|
||||
|
||||
**IMPORTANT:**
|
||||
- Selene PASS requires exit code 0 (0 errors AND 0 warnings). Any warnings = FAIL.
|
||||
- If any step fails, continue running the remaining steps to get a complete picture, then report all failures at the end.
|
||||
- Do not report "Overall: PASS" unless ALL linters pass with zero issues across all sections that were run.
|
||||
- If rbx-dom was skipped, omit its section from the report entirely.
|
||||
Once CI passes clean, provide a brief summary of what was fixed (if anything) and confirm the final result.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue