mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-25 14:53:34 +00:00
* ci: enforce regression tests for fix commits Add a commit-msg hook and CI workflow that require test changes alongside bug fix commits, ensuring every fix includes a regression test that would have caught the bug. - scripts/commit-msg-regression.sh: local git hook (blocks fix commits without test changes; exempts static/docs-only; bypass via [skip-regression-check] marker) - .github/workflows/regression-test-check.yml: CI mirror on PRs (checks title + commit messages; skip via label) - scripts/dev-setup.sh: install hook in step 6 - .github/scripts/create-labels.sh: add skip-regression-check label - CLAUDE.md: document regression test policy Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix: address PR review feedback on regression test enforcement - Use here-strings instead of echo|grep to avoid misinterpreting special characters in variables - Use git diff -W (whole-function context) to detect edits inside existing test functions, not just new #[test] attributes - Honor [skip-regression-check] in commit messages in CI (not just the PR label) - Use git rev-parse --git-path hooks for worktree-safe hook install [skip-regression-check] Co-Authored-By: Claude Opus 4.6 <[email protected]> * Update .github/workflows/regression-test-check.yml Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]> Co-authored-by: Copilot <[email protected]>
69 lines
2.1 KiB
Bash
Executable File
69 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Developer setup script for IronClaw.
|
|
#
|
|
# Gets a fresh checkout ready for development without requiring
|
|
# Docker, PostgreSQL, or any external services.
|
|
#
|
|
# Usage:
|
|
# ./scripts/dev-setup.sh
|
|
#
|
|
# After running, you can:
|
|
# cargo check # default features (postgres + libsql)
|
|
# cargo test # default test suite (uses libsql temp DB)
|
|
# cargo test --all-features # full test suite
|
|
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
echo "=== IronClaw Developer Setup ==="
|
|
echo ""
|
|
|
|
# 1. Check rustup
|
|
if ! command -v rustup &>/dev/null; then
|
|
echo "ERROR: rustup not found. Install from https://rustup.rs"
|
|
exit 1
|
|
fi
|
|
echo "[1/6] rustup found: $(rustup --version 2>/dev/null | head -1)"
|
|
|
|
# 2. Add WASM target (required by build.rs for channel compilation)
|
|
echo "[2/6] Adding wasm32-wasip2 target..."
|
|
rustup target add wasm32-wasip2
|
|
|
|
# 3. Install wasm-tools (required by build.rs for WASM component model)
|
|
echo "[3/6] Installing wasm-tools..."
|
|
if command -v wasm-tools &>/dev/null; then
|
|
echo " wasm-tools already installed: $(wasm-tools --version)"
|
|
else
|
|
cargo install wasm-tools --locked
|
|
fi
|
|
|
|
# 4. Verify the project compiles
|
|
echo "[4/6] Running cargo check..."
|
|
cargo check
|
|
|
|
# 5. Run tests using libsql temp DB (no Docker/external DB needed)
|
|
echo "[5/6] Running tests (no external DB required)..."
|
|
cargo test
|
|
|
|
# 6. Install git hooks
|
|
echo "[6/6] Installing git hooks..."
|
|
HOOKS_DIR=$(git rev-parse --git-path hooks 2>/dev/null) || true
|
|
if [ -n "$HOOKS_DIR" ]; then
|
|
mkdir -p "$HOOKS_DIR"
|
|
SCRIPT_ABS="$(cd "$(dirname "$0")" && pwd)/commit-msg-regression.sh"
|
|
ln -sf "$SCRIPT_ABS" "$HOOKS_DIR/commit-msg"
|
|
echo " commit-msg hook installed (regression test enforcement)"
|
|
else
|
|
echo " Skipped: not a git repository"
|
|
fi
|
|
|
|
echo ""
|
|
echo "=== Setup complete ==="
|
|
echo ""
|
|
echo "Quick start:"
|
|
echo " cargo run # Run with default features"
|
|
echo " cargo test # Test suite (libsql temp DB)"
|
|
echo " cargo test --all-features # Full test suite"
|
|
echo " cargo clippy --all-features # Lint all code"
|