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