fix: gate runner delegates to script/test instead of hardcoding cargo clippy
The acceptance gate was hardcoded to run cargo clippy, which fails on non-Rust projects (Go, Node, etc.). Now the gate only runs script/test which is project-specific. Clippy is added to storkit's own script/test so Rust linting is preserved for this project. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,9 @@ set -euo pipefail
|
|||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||||
|
|
||||||
|
echo "=== Running cargo clippy ==="
|
||||||
|
cargo clippy --manifest-path "$PROJECT_ROOT/Cargo.toml" --all-targets --all-features
|
||||||
|
|
||||||
echo "=== Running Rust tests ==="
|
echo "=== Running Rust tests ==="
|
||||||
cargo test --manifest-path "$PROJECT_ROOT/Cargo.toml"
|
cargo test --manifest-path "$PROJECT_ROOT/Cargo.toml"
|
||||||
|
|
||||||
|
|||||||
@@ -171,39 +171,12 @@ fn run_command_with_timeout(
|
|||||||
/// otherwise `cargo nextest run` / `cargo test`) in the given directory.
|
/// otherwise `cargo nextest run` / `cargo test`) in the given directory.
|
||||||
/// Returns `(gates_passed, combined_output)`.
|
/// Returns `(gates_passed, combined_output)`.
|
||||||
pub(crate) fn run_acceptance_gates(path: &Path) -> Result<(bool, String), String> {
|
pub(crate) fn run_acceptance_gates(path: &Path) -> Result<(bool, String), String> {
|
||||||
let mut all_output = String::new();
|
// Run script/test (or fallback to cargo test). This is the sole
|
||||||
let mut all_passed = true;
|
// acceptance gate — project-specific linting and test commands belong
|
||||||
|
// in script/test, not hardcoded here.
|
||||||
// ── cargo clippy ──────────────────────────────────────────────
|
|
||||||
let clippy = Command::new("cargo")
|
|
||||||
.args(["clippy", "--all-targets", "--all-features"])
|
|
||||||
.current_dir(path)
|
|
||||||
.output()
|
|
||||||
.map_err(|e| format!("Failed to run cargo clippy: {e}"))?;
|
|
||||||
|
|
||||||
all_output.push_str("=== cargo clippy ===\n");
|
|
||||||
let clippy_stdout = String::from_utf8_lossy(&clippy.stdout);
|
|
||||||
let clippy_stderr = String::from_utf8_lossy(&clippy.stderr);
|
|
||||||
if !clippy_stdout.is_empty() {
|
|
||||||
all_output.push_str(&clippy_stdout);
|
|
||||||
}
|
|
||||||
if !clippy_stderr.is_empty() {
|
|
||||||
all_output.push_str(&clippy_stderr);
|
|
||||||
}
|
|
||||||
all_output.push('\n');
|
|
||||||
|
|
||||||
if !clippy.status.success() {
|
|
||||||
all_passed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── tests (script/test if available, else cargo nextest/test) ─
|
|
||||||
let (test_success, test_out) = run_project_tests(path)?;
|
let (test_success, test_out) = run_project_tests(path)?;
|
||||||
all_output.push_str(&test_out);
|
|
||||||
if !test_success {
|
|
||||||
all_passed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok((all_passed, all_output))
|
Ok((test_success, test_out))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run `script/test_coverage` in the given directory if the script exists.
|
/// Run `script/test_coverage` in the given directory if the script exists.
|
||||||
|
|||||||
Reference in New Issue
Block a user