ci: make the Rust suite the only quality gate
Remove the Bash test suite and shellcheck from CI, the pre-commit hook, the Makefile, agent-commit and publish. CI now runs cargo fmt, clippy and test.
This commit is contained in:
parent
4c59a1f3ad
commit
875278b9a9
7 changed files with 24 additions and 40 deletions
|
|
@ -15,16 +15,20 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Bash test suite
|
- name: Rust format
|
||||||
run: bash installer/tests/run_tests.sh
|
|
||||||
|
|
||||||
- name: shellcheck
|
|
||||||
run: |
|
run: |
|
||||||
if command -v shellcheck >/dev/null 2>&1; then
|
if command -v cargo >/dev/null 2>&1; then
|
||||||
shellcheck -S warning installer/bin/ai-installer \
|
cd installer-rs && cargo fmt --all -- --check
|
||||||
installer/lib/*.sh installer/tui/*.sh
|
|
||||||
else
|
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
|
fi
|
||||||
|
|
||||||
- name: Rust test suite
|
- name: Rust test suite
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
#
|
#
|
||||||
# 1. refuse large/binary image files;
|
# 1. refuse large/binary image files;
|
||||||
# 2. scan staged content for secrets;
|
# 2. scan staged content for secrets;
|
||||||
# 3. run the fast Bash test suite (set PHOEBUS_PRECOMMIT_TESTS=0 to skip);
|
# 3. optionally run the Rust suite (set PHOEBUS_PRECOMMIT_RUST=1 to enable).
|
||||||
# 4. 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 ...
|
# 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
|
scripts/check-secrets.sh "${staged[@]}" || exit 1
|
||||||
fi
|
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
|
if [[ "${PHOEBUS_PRECOMMIT_RUST:-0}" == "1" ]] && command -v cargo >/dev/null 2>&1; then
|
||||||
log="/tmp/phoebus-precommit-rust.log"
|
log="/tmp/phoebus-precommit-rust.log"
|
||||||
if ! (cd installer-rs && cargo test --workspace) >"$log" 2>&1; then
|
if ! (cd installer-rs && cargo test --workspace) >"$log" 2>&1; then
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,9 @@ agent: build
|
||||||
|
|
||||||
Run the project quality gate and fix anything that fails:
|
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`
|
2. `cd installer-rs && cargo fmt --all -- --check`
|
||||||
3. `cd installer-rs && cargo clippy --workspace --all-targets`
|
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
|
Report each failure and what you changed. Do not weaken tests or safety checks
|
||||||
to make them pass.
|
to make them pass.
|
||||||
|
|
|
||||||
10
Makefile
10
Makefile
|
|
@ -8,14 +8,13 @@
|
||||||
|
|
||||||
SHELL := /bin/bash
|
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:
|
help:
|
||||||
@printf 'Phoebus OS targets:\n'
|
@printf 'Phoebus OS targets:\n'
|
||||||
@printf ' make context session briefing (state, roadmap, handoff)\n'
|
@printf ' make context session briefing (state, roadmap, handoff)\n'
|
||||||
@printf ' make doctor check host prerequisites\n'
|
@printf ' make doctor check host prerequisites\n'
|
||||||
@printf ' make test run Bash + Rust test suites\n'
|
@printf ' make test run the Rust test suite\n'
|
||||||
@printf ' make test-bash fast Bash suite only\n'
|
|
||||||
@printf ' make test-rust cargo test --workspace\n'
|
@printf ' make test-rust cargo test --workspace\n'
|
||||||
@printf ' make fmt cargo fmt --all\n'
|
@printf ' make fmt cargo fmt --all\n'
|
||||||
@printf ' make check fmt-check + clippy + tests\n'
|
@printf ' make check fmt-check + clippy + tests\n'
|
||||||
|
|
@ -36,10 +35,7 @@ context:
|
||||||
doctor:
|
doctor:
|
||||||
scripts/doctor.sh
|
scripts/doctor.sh
|
||||||
|
|
||||||
test: test-bash test-rust
|
test: test-rust
|
||||||
|
|
||||||
test-bash:
|
|
||||||
bash installer/tests/run_tests.sh
|
|
||||||
|
|
||||||
test-rust:
|
test-rust:
|
||||||
cd installer-rs && cargo test --workspace
|
cd installer-rs && cargo test --workspace
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
//! Coverage of the reference Bash installer's command-line surface.
|
//! Coverage of the reference Bash installer's command-line surface.
|
||||||
//!
|
//!
|
||||||
//! Every mode and flag accepted by `installer/bin/ai-installer` (argument parser
|
//! Every mode and flag accepted by the reference Bash installer (see
|
||||||
//! around lines 53-73) must have a Rust equivalent, or be explicitly recorded as
|
//! `docs/BASH-MIGRATION.md`) must have a Rust equivalent, or be explicitly
|
||||||
//! intentionally dropped. The test inspects `--help` so it never executes an
|
//! recorded as intentionally dropped. The test inspects `--help` so it never
|
||||||
//! installation or bootstraps OpenCode.
|
//! executes an installation or bootstraps OpenCode.
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@ git add -A
|
||||||
|
|
||||||
scripts/check-secrets.sh
|
scripts/check-secrets.sh
|
||||||
|
|
||||||
if [[ "${PHOEBUS_COMMIT_TEST:-1}" == "1" && -x installer/tests/run_tests.sh ]]; then
|
if [[ "${PHOEBUS_COMMIT_TEST:-1}" == "1" ]] && command -v cargo >/dev/null 2>&1; then
|
||||||
echo "running fast test suite..."
|
echo "running Rust test suite..."
|
||||||
bash installer/tests/run_tests.sh >/tmp/phoebus-agent-commit-tests.log 2>&1 || {
|
(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
|
echo "tests failed; see /tmp/phoebus-agent-commit-tests.log" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,6 @@ if [[ -n "$(git status --porcelain)" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if command -v cargo >/dev/null 2>&1 && [[ -f installer-rs/Cargo.toml ]]; then
|
||||||
echo "running Rust test suite..."
|
echo "running Rust test suite..."
|
||||||
(cd installer-rs && cargo test --workspace) || {
|
(cd installer-rs && cargo test --workspace) || {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue