- Rename scripts/test to scripts/run-tests to eliminate name collision with standard POSIX test (/usr/bin/test, [) - Prevent nixos-rebuild-ng activation safety assertions (test -f) from invoking the Python test suite instead of coreutils test - Update test runner invocation paths across AGENTS.md, README.md, ROADMAP.md, SECURITY.md, and documentation runbooks
35 lines
920 B
Bash
Executable File
35 lines
920 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# scripts/run-tests - Automated test & invariant verification runner for Homelab Core
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
echo "🔍 Running code linters (ruff)..."
|
|
if command -v ruff &>/dev/null; then
|
|
ruff check .
|
|
else
|
|
nix develop --command ruff check .
|
|
fi
|
|
|
|
echo "🔎 Running static type analysis (pyright)..."
|
|
if command -v pyright &>/dev/null; then
|
|
pyright
|
|
else
|
|
nix develop --command pyright
|
|
fi
|
|
|
|
echo "🧪 Running architecture & security test suite (pytest)..."
|
|
if [ -x ".venv/bin/pytest" ]; then
|
|
.venv/bin/pytest tests/
|
|
elif command -v pytest &>/dev/null; then
|
|
pytest tests/
|
|
else
|
|
nix develop --command pytest tests/
|
|
fi
|
|
|
|
echo "❄️ Verifying NixOS flake & sandbox checks..."
|
|
nix flake check
|
|
nix eval .#nixosConfigurations.server.config.system.build.toplevel.drvPath --json >/dev/null
|
|
|
|
echo "✨ All tests and architectural invariants passed successfully!"
|