-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (76 loc) · 3.04 KB
/
Copy pathvalidate.yml
File metadata and controls
87 lines (76 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Validate Workflows & Scripts
on:
pull_request:
branches:
- test
- main
paths:
- '.github/workflows/**'
- '.github/scripts/**'
push:
branches:
- 'test-**'
- 'feature/**'
- 'develop'
paths:
- '.github/workflows/**'
- '.github/scripts/**'
workflow_dispatch: # Allow manual trigger
jobs:
validate:
name: Validate Changes
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Validate workflow YAML syntax
run: |
echo "🔍 Validating workflow files..."
docker run --rm -v "$PWD:/repo" -w /repo \
rhysd/actionlint:1.7.12 \
-color \
.github/workflows/*.yml
echo "✅ All workflow files have valid syntax"
- name: Validate Python syntax
run: |
echo "🔍 Checking Python syntax..."
for script in .github/scripts/build/*.py .github/scripts/ai/*.py .github/scripts/ai/tasks/*.py .github/scripts/helpers/*.py .github/scripts/qmd-tools/*.py .github/scripts/*.py; do
if [ -f "$script" ]; then
echo " • $script"
python -m py_compile "$script"
fi
done
echo "✅ All Python scripts have valid syntax"
- name: Lint Python with ruff
run: |
echo "🔍 Running ruff..."
pip install --quiet ruff
# Lint every .py under .github/scripts/ - fails the job on any issue.
# Style-only (no auto-fix). ruff defaults cover pyflakes + pycodestyle.
ruff check .github/scripts/
echo "✅ ruff passed"
- name: Validation summary
if: success()
run: |
echo ""
echo "═══════════════════════════════════════════════════════════════"
echo "✅ All validation checks passed!"
echo "═══════════════════════════════════════════════════════════════"
echo ""
echo "Validated:"
echo " • Workflow YAML syntax (actionlint)"
echo " • Python script syntax (py_compile)"
echo ""
- name: Validation failed
if: failure()
run: |
echo ""
echo "═══════════════════════════════════════════════════════════════"
echo "❌ Validation failed!"
echo "═══════════════════════════════════════════════════════════════"
exit 1