diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index b506370..2c7b43b 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -15,16 +15,20 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Bash test suite - run: bash installer/tests/run_tests.sh - - - name: shellcheck + - name: Rust format run: | - if command -v shellcheck >/dev/null 2>&1; then - shellcheck -S warning installer/bin/ai-installer \ - installer/lib/*.sh installer/tui/*.sh + if command -v cargo >/dev/null 2>&1; then + cd installer-rs && cargo fmt --all -- --check else - echo "shellcheck not installed on this runner; skipping" + echo "cargo not installed on this runner; skipping" + fi + + - name: Rust clippy + run: | + if command -v cargo >/dev/null 2>&1; then + cd installer-rs && cargo clippy --workspace --all-targets + else + echo "cargo not installed on this runner; skipping" fi - name: Rust test suite diff --git a/.githooks/pre-commit b/.githooks/pre-commit index fea26c9..520fd81 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -3,8 +3,7 @@ # # 1. refuse large/binary image files; # 2. scan staged content for secrets; -# 3. run the fast Bash test suite (set PHOEBUS_PRECOMMIT_TESTS=0 to skip); -# 4. optionally run the Rust suite (set PHOEBUS_PRECOMMIT_RUST=1 to enable). +# 3. optionally run the Rust suite (set PHOEBUS_PRECOMMIT_RUST=1 to enable). # # Bypass with: git commit --no-verify or SKIP_PHOEBUS_HOOKS=1 git commit ... @@ -38,14 +37,6 @@ if [[ -x scripts/check-secrets.sh ]]; then scripts/check-secrets.sh "${staged[@]}" || exit 1 fi -if [[ "${PHOEBUS_PRECOMMIT_TESTS:-1}" == "1" && -x installer/tests/run_tests.sh ]]; then - log="/tmp/phoebus-precommit-tests.log" - if ! bash installer/tests/run_tests.sh >"$log" 2>&1; then - printf 'pre-commit: tests failed; see %s\n' "$log" >&2 - exit 1 - fi -fi - if [[ "${PHOEBUS_PRECOMMIT_RUST:-0}" == "1" ]] && command -v cargo >/dev/null 2>&1; then log="/tmp/phoebus-precommit-rust.log" if ! (cd installer-rs && cargo test --workspace) >"$log" 2>&1; then diff --git a/.opencode/command/verify.md b/.opencode/command/verify.md index 8452075..d343b44 100644 --- a/.opencode/command/verify.md +++ b/.opencode/command/verify.md @@ -5,10 +5,9 @@ agent: build Run the project quality gate and fix anything that fails: -1. `make test` (Bash suite + `cargo test --workspace`) +1. `make test` (`cargo test --workspace`) 2. `cd installer-rs && cargo fmt --all -- --check` 3. `cd installer-rs && cargo clippy --workspace --all-targets` -4. `shellcheck -S warning installer/bin/ai-installer installer/lib/*.sh installer/tui/*.sh` Report each failure and what you changed. Do not weaken tests or safety checks to make them pass. diff --git a/Makefile b/Makefile index 0a2b5ee..ecd1682 100644 --- a/Makefile +++ b/Makefile @@ -8,14 +8,13 @@ SHELL := /bin/bash -.PHONY: help context doctor test test-bash test-rust fmt fmt-check clippy check build static vm hooks commit publish backup forgejo-init public private protect release clean +.PHONY: help context doctor test test-rust fmt fmt-check clippy check build static vm hooks commit publish backup forgejo-init public private protect release clean help: @printf 'Phoebus OS targets:\n' @printf ' make context session briefing (state, roadmap, handoff)\n' @printf ' make doctor check host prerequisites\n' - @printf ' make test run Bash + Rust test suites\n' - @printf ' make test-bash fast Bash suite only\n' + @printf ' make test run the Rust test suite\n' @printf ' make test-rust cargo test --workspace\n' @printf ' make fmt cargo fmt --all\n' @printf ' make check fmt-check + clippy + tests\n' @@ -36,10 +35,7 @@ context: doctor: scripts/doctor.sh -test: test-bash test-rust - -test-bash: - bash installer/tests/run_tests.sh +test: test-rust test-rust: cd installer-rs && cargo test --workspace diff --git a/installer-rs/crates/phoebus-installer/tests/cli_coverage.rs b/installer-rs/crates/phoebus-installer/tests/cli_coverage.rs index 6abea2d..ad8de95 100644 --- a/installer-rs/crates/phoebus-installer/tests/cli_coverage.rs +++ b/installer-rs/crates/phoebus-installer/tests/cli_coverage.rs @@ -1,9 +1,9 @@ //! Coverage of the reference Bash installer's command-line surface. //! -//! Every mode and flag accepted by `installer/bin/ai-installer` (argument parser -//! around lines 53-73) must have a Rust equivalent, or be explicitly recorded as -//! intentionally dropped. The test inspects `--help` so it never executes an -//! installation or bootstraps OpenCode. +//! Every mode and flag accepted by the reference Bash installer (see +//! `docs/BASH-MIGRATION.md`) must have a Rust equivalent, or be explicitly +//! recorded as intentionally dropped. The test inspects `--help` so it never +//! executes an installation or bootstraps OpenCode. use std::path::PathBuf; use std::process::Command; diff --git a/scripts/agent-commit.sh b/scripts/agent-commit.sh index 7452d0a..ae5afa8 100755 --- a/scripts/agent-commit.sh +++ b/scripts/agent-commit.sh @@ -30,9 +30,9 @@ git add -A scripts/check-secrets.sh -if [[ "${PHOEBUS_COMMIT_TEST:-1}" == "1" && -x installer/tests/run_tests.sh ]]; then - echo "running fast test suite..." - bash installer/tests/run_tests.sh >/tmp/phoebus-agent-commit-tests.log 2>&1 || { +if [[ "${PHOEBUS_COMMIT_TEST:-1}" == "1" ]] && command -v cargo >/dev/null 2>&1; then + echo "running Rust test suite..." + (cd installer-rs && cargo test --workspace) >/tmp/phoebus-agent-commit-tests.log 2>&1 || { echo "tests failed; see /tmp/phoebus-agent-commit-tests.log" >&2 exit 1 } diff --git a/scripts/publish.sh b/scripts/publish.sh index de43c3f..7559058 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -26,12 +26,6 @@ if [[ -n "$(git status --porcelain)" ]]; then exit 1 fi -echo "running fast test suite..." -bash installer/tests/run_tests.sh >/tmp/phoebus-publish-tests.log 2>&1 || { - echo "tests failed; see /tmp/phoebus-publish-tests.log" >&2 - exit 1 -} - if command -v cargo >/dev/null 2>&1 && [[ -f installer-rs/Cargo.toml ]]; then echo "running Rust test suite..." (cd installer-rs && cargo test --workspace) || {