From 92eaa0635ce1c12a6d2726f6360b8964c1a5ab60 Mon Sep 17 00:00:00 2001 From: igor04091968 Date: Sat, 25 Apr 2026 15:30:34 +0300 Subject: [PATCH] chore: add local quality-gate script for offline validation --- README.md | 1 + scripts/quality-gate.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 scripts/quality-gate.sh diff --git a/README.md b/README.md index a83a668..4d4a946 100755 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ - `aw-server/` — установочные скрипты, env-шаблон, systemd unit и RU patch для Web UI. - `ansible/` — Ansible-ensemble для автоматизированного сервера (Debian/CT). - `windows/` — PowerShell toolkit: single-user, domain-users, ensemble orchestration, hardening/recovery, validation. +- `scripts/quality-gate.sh` — локальный preflight-пайплайн проверок. ## Базовый сценарий diff --git a/scripts/quality-gate.sh b/scripts/quality-gate.sh new file mode 100755 index 0000000..84b68eb --- /dev/null +++ b/scripts/quality-gate.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT_DIR" + +echo "[1/3] Bash syntax check" +find aw-server proxmox -type f -name "*.sh" -print0 | xargs -0 -r -n1 bash -n + +echo "[2/3] Shellcheck (if available)" +if command -v shellcheck >/dev/null 2>&1; then + find aw-server proxmox -type f -name "*.sh" -print0 | xargs -0 -r shellcheck +else + echo "shellcheck not found, skipping." +fi + +echo "[3/3] PowerShell parse check (if pwsh available)" +if command -v pwsh >/dev/null 2>&1; then + pwsh -NoLogo -NoProfile -Command ' + $ErrorActionPreference = "Stop" + Get-ChildItem windows -Filter *.ps1 | ForEach-Object { + [void][System.Management.Automation.Language.Parser]::ParseFile($_.FullName,[ref]$null,[ref]$null) + } + [void][System.Management.Automation.Language.Parser]::ParseFile((Resolve-Path "windows/ActivityWatch.Windows.Common.psm1"),[ref]$null,[ref]$null) + [void][System.Management.Automation.Language.Parser]::ParseFile((Resolve-Path "windows/ActivityWatch.Windows.Common.psd1"),[ref]$null,[ref]$null) + ' +else + echo "pwsh not found, skipping." +fi + +echo "quality-gate: OK"