-
Notifications
You must be signed in to change notification settings - Fork 156
241 lines (205 loc) · 6.82 KB
/
validate-build.yml
File metadata and controls
241 lines (205 loc) · 6.82 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
name: Project Validation
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
gha: ${{ steps.filter.outputs.gha }}
kotlin: ${{ steps.filter.outputs.kotlin }}
front: ${{ steps.filter.outputs.front }}
python: ${{ steps.filter.outputs.python }}
doc: ${{ steps.filter.outputs.doc }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
gha:
- '.github/**'
front:
- 'bot/admin/web/**'
kotlin:
- '**/src/main/kotlin/**'
- '**/src/main/resources/**'
- '**/src/test/kotlin/**'
- '**/src/test/resources/**'
- '**/*.kts'
- '**/pom.xml'
python:
- 'gen-ai/orchestrator-server/src/main/python/**'
- '.pre-commit-config.yaml'
doc:
- 'docs/**'
kotlin:
name: Kotlin
runs-on: ubuntu-latest
needs: changes
timeout-minutes: 20
if: ${{ needs.changes.outputs.kotlin == 'true' || needs.changes.outputs.gha == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Check Maven version
run: |
echo "Maven version:"
mvn --version
- name: Build & Test
run: |
echo "Compiling and testing project with Maven..."
mvn -B -ntp clean -Dskip.npm -Dexec.skip verify
front:
name: Admin Front
runs-on: ubuntu-latest
needs: changes
timeout-minutes: 20
if: ${{ needs.changes.outputs.front == 'true' || needs.changes.outputs.gha == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Check Maven version
run: |
echo "Maven version:"
mvn --version
- name: Build & Test
run: |
echo "building front with maven"
cd bot/admin/web
mvn -B -ntp verify
doc:
name: Documentation
runs-on: ubuntu-latest
needs: changes
timeout-minutes: 20
if: ${{ needs.changes.outputs.doc == 'true' || needs.changes.outputs.gha == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
cache-dependency-path: docs/requirements.txt
- name: Check Python version
run: |
echo "Python version:"
python --version
pip --version
- name: Install Python dependencies
run: |
echo "Installing dependencies from docs/requirements.txt..."
pip install -r docs/requirements.txt
- name: Validate documentation build
working-directory: docs
run: |
echo "Building MkDocs documentation..."
mkdocs build --strict
python:
name: Python
runs-on: ubuntu-latest
needs: changes
timeout-minutes: 25
if: ${{ needs.changes.outputs.python == 'true' || needs.changes.outputs.gha == 'true'}}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Cache Poetry
uses: actions/cache@v4
with:
path: |
gen-ai/orchestrator-server/src/main/python/server/.venv
~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('gen-ai/orchestrator-server/src/main/python/server/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-
- name: Install Poetry dependencies
working-directory: gen-ai/orchestrator-server/src/main/python/server
run: |
echo "Installing Poetry dependencies..."
poetry install --with dev,test
- name: Check Python Gen-AI syntax (recursive)
working-directory: gen-ai/orchestrator-server/src/main/python/server
run: |
echo "Checking Python syntax in gen-ai..."
poetry run python - <<'PY'
import compileall, sys
ok = compileall.compile_dir("src", quiet=1)
sys.exit(0 if ok else 1)
PY
- name: Run Poetry tests
working-directory: gen-ai/orchestrator-server/src/main/python/server
run: |
poetry run pytest --version || echo "Pytest not configured, skipped"
precommit:
name: Pre-commit
runs-on: ubuntu-latest
needs: changes
timeout-minutes: 15
if: ${{ needs.changes.outputs.python == 'true' || needs.changes.outputs.gha == 'true'}}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-precommit-
- name: Install pre-commit
run: |
echo "Installing pre-commit..."
pip install pre-commit
- name: Run pre-commit
run: |
echo "Running pre-commit on all files..."
pre-commit run --all-files --show-diff-on-failure
final-status:
name: Final Status
if: always()
needs: [ changes, kotlin, front, doc, python, precommit ]
runs-on: ubuntu-latest
steps:
- name: Check all required jobs status
run: |
echo "Checking status of all required jobs..."
results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}')
echo "Job results: $results"
# Check if any required job failed or was cancelled
if grep -q -E '(failure|cancelled)' <<< "$results"; then
echo "❌ One or more required jobs failed or were cancelled"
exit 1
fi
echo "✅ All validations passed successfully"