Files
nixos-core/scripts/run-tests
kiskaadee a5826e0e74
Core Architecture & Invariant CI / validate (pull_request) Successful in 1m10s
Core Architecture & Invariant CI / validate (push) Successful in 1m9s
fix(scripts): rename test runner to run-tests to avoid shadowing POSIX test
- 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
2026-11-17 14:53:34 -05:00

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!"