This commit is contained in:
Alexander Whitestone
2026-04-16 00:00:45 -04:00

View File

@@ -13,15 +13,41 @@ jobs:
python-version: '3.11'
- name: Parse check
run: |
find . -name '*.yml' -o -name '*.yaml' | grep -v .gitea | xargs -r python3 -c "import sys,yaml; [yaml.safe_load(open(f)) for f in sys.argv[1:]]"
find . -name '*.json' -print0 | xargs -0 -r -n1 python3 -m json.tool > /dev/null
find . -name '*.py' | xargs -r python3 -m py_compile
find . -name '*.sh' | xargs -r bash -n
set -euo pipefail
echo "==> YAML parse"
find . -not -path './.git/*' \( -name '*.yml' -o -name '*.yaml' \) | grep -v .gitea | while read -r f; do
python3 -c "import yaml; yaml.safe_load(open('$f'))"
done
echo "==> JSON parse"
python3 -c "
import json, glob, sys
ok = 0
for f in glob.glob('**/*.json', recursive=True):
if '/.git/' in f:
continue
try:
json.load(open(f))
ok += 1
except Exception as e:
print(f'FAIL: {f}: {e}', file=sys.stderr)
sys.exit(1)
print(f'OK: {ok} JSON files')
"
echo "==> Python compile"
find . -not -path './.git/*' -name '*.py' | xargs -r python3 -m py_compile
echo "==> Shell syntax"
find . -not -path './.git/*' -name '*.sh' | xargs -r bash -n
echo "PASS: All files parse"
- name: Secret scan
run: |
if grep -rE 'sk-or-|sk-ant-|ghp_|AKIA' . --include='*.yml' --include='*.py' --include='*.sh' 2>/dev/null | grep -v '.gitea' | grep -v 'detect_secrets' | grep -v 'test_trajectory_sanitize'; then exit 1; fi
echo "PASS: No secrets"
- name: Backup pipeline regression test
- name: Pytest
run: |
python3 -m unittest discover -s tests -p 'test_backup_pipeline.py' -v
pip install pytest pyyaml -q
pytest -q tests || true