- Extract shared pythonEnv in flake.nix and symlink .venv in devShell shellHook so IDEs, terminal, and Nix checks share one Python 3.14 env. - Add pyright static type checking to scripts/test and align pre-commit with the unified Nix environment. - Remove personal domain from flake.nix description and ignore .venv.
35 lines
915 B
Bash
Executable File
35 lines
915 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# scripts/test - 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!"
|