-
Notifications
You must be signed in to change notification settings - Fork 14
115 lines (99 loc) · 3.35 KB
/
pr-validation.yml
File metadata and controls
115 lines (99 loc) · 3.35 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Pull Request Validation
on:
pull_request:
branches:
- main
- master
jobs:
validate-pr:
name: Validate Pull Request
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=1.23.5"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Set up Node.js for markdownlint
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install Go dependencies
run: go mod tidy -e || true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: latest
- name: Lint Go code
run: ./scripts/lint-go.sh ci
- name: Check Python test suite
id: check-python
run: |
if [ -f "test/requirements.txt" ] && [ -f "test/setup.sh" ]; then
echo "python_tests_exist=true" >> $GITHUB_OUTPUT
echo "✅ Python test suite found"
else
echo "python_tests_exist=false" >> $GITHUB_OUTPUT
echo "⚠️ Python test suite not found - skipping Python validation"
fi
- name: Setup Python environment
if: steps.check-python.outputs.python_tests_exist == 'true'
run: |
cd test
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Validate Python code quality
if: steps.check-python.outputs.python_tests_exist == 'true'
run: ./scripts/lint-python.sh ci
- name: Lint Markdown files
run: ./scripts/lint-markdown.sh ci
# TODO: Re-enable Python tests when ready
# - name: Run Python tests
# if: steps.check-python.outputs.python_tests_exist == 'true'
# run: |
# cd test
# source venv/bin/activate
# echo "🧪 Running Python tests..."
# if ! pytest -v --tb=short; then
# echo "❌ Python tests failed."
# exit 1
# fi
# echo "✅ Python tests passed!"
# env:
# CF_API: ${{ secrets.CF_API }}
# CF_USERNAME: ${{ secrets.CF_USERNAME }}
# CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
# CF_ORG: ${{ secrets.CF_ORG }}
# CF_SPACE: ${{ secrets.CF_SPACE }}
- name: Build plugin
run: |
echo "🔨 Building plugin..."
if ! python3 .github/workflows/build.py; then
echo "❌ Build failed."
exit 1
fi
echo "✅ Build successful!"
- name: Validation Summary
run: |
echo ""
echo "🎉 Pull Request Validation Summary"
echo "=================================="
echo "✅ Go code formatting and linting"
echo "✅ Go tests"
echo "✅ Markdown formatting and linting"
if [ "${{ steps.check-python.outputs.python_tests_exist }}" == "true" ]; then
echo "✅ Python code quality checks"
echo "✅ Python tests"
else
echo "⚠️ Python tests skipped (not found)"
fi
echo "✅ Plugin build"
echo ""
echo "🚀 Ready for merge!"