89 lines
3.1 KiB
Bash
89 lines
3.1 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
META_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
ROOT="${GOVOPLAN_CORE_ROOT:-$META_ROOT/../govoplan-core}"
|
|
ROOT="$(cd "$ROOT" && pwd)"
|
|
VENV_ROOT="${GOVOPLAN_VENV_ROOT:-$META_ROOT/.venv}"
|
|
PYTHON="${PYTHON:-$VENV_ROOT/bin/python}"
|
|
NODE="/home/zemion/.nvm/versions/node/v22.22.3/bin"
|
|
NPM="$NODE/npm"
|
|
WEBUI_BIN="$ROOT/webui/node_modules/.bin"
|
|
NPM_USERCONFIG="$(mktemp "${TMPDIR:-/tmp}/govoplan-npmrc.XXXXXXXX")"
|
|
|
|
trap 'rm -f "$NPM_USERCONFIG"' EXIT
|
|
|
|
[ -x "$PYTHON" ] || {
|
|
echo "check-focused: Python virtualenv not found at $PYTHON." >&2
|
|
echo "Run: cd $META_ROOT && python3 -m venv .venv && ./.venv/bin/python -m pip install --upgrade pip && ./.venv/bin/python -m pip install -r requirements-dev.txt" >&2
|
|
exit 127
|
|
}
|
|
|
|
export PATH="$WEBUI_BIN:$NODE:$PATH"
|
|
export NPM_CONFIG_USERCONFIG="$NPM_USERCONFIG"
|
|
export GOVOPLAN_NPM_USERCONFIG="$NPM_USERCONFIG"
|
|
unset npm_config_tmp NPM_CONFIG_TMP
|
|
|
|
cd "$ROOT"
|
|
|
|
GOVOPLAN_CORE_ROOT="$ROOT" PYTHON="$PYTHON" CHECK_TESTCLIENT_DEPRECATIONS=1 bash "$META_ROOT/tools/checks/check-dependency-hygiene.sh"
|
|
"$PYTHON" "$META_ROOT/tools/checks/check-contracts.py" --no-impact
|
|
|
|
"$PYTHON" - <<'PY'
|
|
import ast
|
|
import pathlib
|
|
import sys
|
|
|
|
roots = [
|
|
pathlib.Path("/mnt/DATA/git/govoplan-core/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-access/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-admin/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-addresses/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-tenancy/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-organizations/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-identity/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-policy/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-audit/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-mail/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-files/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-campaign/src"),
|
|
pathlib.Path("/mnt/DATA/git/govoplan-mail/tests"),
|
|
]
|
|
|
|
errors = []
|
|
count = 0
|
|
for root in roots:
|
|
if not root.exists():
|
|
continue
|
|
for path in root.rglob("*.py"):
|
|
count += 1
|
|
try:
|
|
ast.parse(path.read_text(), filename=str(path))
|
|
except SyntaxError as exc:
|
|
errors.append(f"{path}:{exc.lineno}:{exc.offset}: {exc.msg}")
|
|
|
|
if errors:
|
|
print("\n".join(errors))
|
|
sys.exit(1)
|
|
|
|
print(f"AST syntax check passed for {count} Python files")
|
|
PY
|
|
|
|
"$PYTHON" -c 'import govoplan_core.db.bootstrap; import govoplan_access.backend.admin.service; import govoplan_addresses.backend.manifest; import govoplan_files.backend.router; import govoplan_mail.backend.sending.imap; print("targeted backend imports passed")'
|
|
"$META_ROOT/tools/checks/check_dependency_boundaries.py"
|
|
"$PYTHON" -m unittest tests.test_module_system
|
|
"$PYTHON" -m unittest discover -s /mnt/DATA/git/govoplan-mail/tests
|
|
"$PYTHON" -m unittest tests.test_api_smoke.ApiSmokeTests.test_mailbox_message_listing_reports_total_count
|
|
|
|
cd "$ROOT/webui"
|
|
"$NPM" run test:mail-components
|
|
"$NPM" run test:module-capabilities
|
|
"$NPM" run test:module-permutations
|
|
|
|
cd /mnt/DATA/git/govoplan-mail/webui
|
|
"$NPM" run test:mail-ui
|
|
|
|
cd /mnt/DATA/git/govoplan-campaign/webui
|
|
"$NPM" run test:policy-ui
|
|
"$NPM" run test:template-preview
|