Repository navigation
389 lines (339 loc) · 10.3 KB
/
Copy pathpr.yml
File metadata and controls
389 lines (339 loc) · 10.3 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
name: PR
on:
pull_request:
# opened and synchronize already run for a draft. ready_for_review would
# start the same jobs a second time when the pull request leaves draft.
types: [opened, synchronize, reopened]
concurrency:
group: pr-${{ github.event.number }}
cancel-in-progress: true
permissions: {}
env:
OLLAMA_MODEL_ID: tinyllama
OLLAMA_DATA_PATH: ./.ollama_data
jobs:
check:
name: Check Triggers
runs-on: ubuntu-slim
permissions:
contents: read
pull-requests: read
outputs:
workflows: ${{ steps.diff.outputs.workflows }}
unit: ${{ steps.diff.outputs.unit }}
container: ${{ steps.diff.outputs.container }}
image: ${{ steps.diff.outputs.image }}
analysis: ${{ steps.diff.outputs.analysis }}
steps:
- uses: actions/checkout@v7
with:
lfs: true
- id: diff
uses: bcgov/actions/diff-triggers@122a9b1c6c082b1b1f18c300020fbdc417b6b0b2 # v0.10.0
with:
filters: |
workflows:
- .github/workflows/**
unit:
- app/**
- tests/**
- compose.yml
- .github/workflows/**
container:
- app/**
- tests/**
- compose.yml
- '!app/data/sources.yaml'
image:
- app/**
- tests/**
analysis:
- app/**
- tests/**
- compose.yml
- .github/**
- '!app/data/**'
- '!app/public/**'
actionlint:
name: Lint Workflows
needs: check
if: needs.check.outputs.workflows == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
timeout-minutes: 2
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Validate PR & Lint Workflows
uses: bcgov/actions/pr-validate@122a9b1c6c082b1b1f18c300020fbdc417b6b0b2 # v0.10.0
prepare-tests:
name: Prepare Test Cache
needs: check
if: needs.check.outputs.container == 'true'
runs-on: ubuntu-26.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7
with:
lfs: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Warm Cache (All Test Targets)
uses: docker/bake-action@v7
with:
source: .
files: compose.yml
targets: dev
set: |
*.cache-from=type=gha
*.cache-from=type=registry,ref=ghcr.io/miniontech/vexilon/agnav:buildcache
*.cache-to=type=gha,mode=max
test-unit:
name: Unit Tests
needs: check
if: needs.check.outputs.unit == 'true'
runs-on: ubuntu-26.04
permissions:
contents: read
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up uv
uses: astral-sh/setup-uv@v10.3.0
with:
enable-cache: true
cache-dependency-glob: "app/uv.lock"
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Install Dependencies
run: |
cd app
uv sync --frozen
- name: Run Deployment Integrity Checks
run: |
cd app
uv run pytest ../tests/deploy_integrity/ -v
- name: Run Local Unit & Streaming Tests
env:
VERIFY_ENABLED: "true"
run: |
mkdir -p reports
cd app
uv run python -m pytest tests/test_*.py -v \
--junitxml=../reports/junit.xml \
--cov=indexing --cov=main --cov-report=xml:../reports/coverage.xml
- name: Upload Coverage
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: reports/
validate-cache:
name: Validate FAISS Cache
needs: [test-unit, prepare-tests]
runs-on: ubuntu-26.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7
with:
lfs: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and Cache (Validator)
uses: docker/bake-action@v7
with:
load: true
source: .
files: compose.yml
targets: dev
set: |
*.cache-from=type=gha
*.cache-from=type=registry,ref=ghcr.io/miniontech/vexilon/agnav:buildcache
- name: Validate Cache Manifest
run: docker compose up test-cache
test-integration-model:
name: Integration Tests (Model)
needs: [test-unit, prepare-tests]
runs-on: ubuntu-26.04
permissions:
contents: read
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Cache Ollama Models
uses: actions/cache@v6
with:
path: ./.ollama_data
key: ollama-models-${{ env.OLLAMA_MODEL_ID }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and Cache (Integration)
uses: docker/bake-action@v7
with:
load: true
source: .
files: compose.yml
targets: dev
set: |
*.cache-from=type=gha
*.cache-from=type=registry,ref=ghcr.io/miniontech/vexilon/agnav:buildcache
- name: Run Integration Tests
run: docker compose up test-integration-model
- name: Dump Logs on Failure
if: failure()
run: docker compose logs
- name: Cleanup
if: always()
run: docker compose down -v || true
test-integration-app:
name: Integration Tests (App)
needs: [test-unit, prepare-tests]
runs-on: ubuntu-26.04
permissions:
contents: read
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and Cache (Functional Tests)
uses: docker/bake-action@v7
with:
load: true
source: .
files: compose.yml
targets: dev
set: |
*.cache-from=type=gha
*.cache-from=type=registry,ref=ghcr.io/miniontech/vexilon/agnav:buildcache
- name: Run Integration Tests (App)
run: docker compose up test-integration-app
- name: Dump Logs on Failure
if: failure()
run: docker compose logs
- name: Cleanup
if: always()
run: docker compose down -v || true
test-ui-e2e:
name: UI E2E Tests (Playwright)
needs: [test-unit, prepare-tests]
runs-on: ubuntu-26.04
permissions:
contents: read
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Cache Ollama Models
uses: actions/cache@v6
with:
path: ./.ollama_data
key: ollama-models-${{ env.OLLAMA_MODEL_ID }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and Cache (UI E2E)
uses: docker/bake-action@v7
with:
load: true
source: .
files: compose.yml
targets: dev
set: |
*.cache-from=type=gha
*.cache-from=type=registry,ref=ghcr.io/miniontech/vexilon/agnav:buildcache
- name: Run UI E2E Tests
run: docker compose up --abort-on-container-exit --exit-code-from test-ui-e2e test-ui-e2e
- name: Dump Logs on Failure
if: failure()
run: docker compose logs
- name: Cleanup
if: always()
run: docker compose down -v || true
test-e2e:
name: End-to-End Tests
needs: [test-unit, prepare-tests]
runs-on: ubuntu-26.04
permissions:
contents: read
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Cache Ollama Models
uses: actions/cache@v6
with:
path: ./.ollama_data
key: ollama-models-${{ env.OLLAMA_MODEL_ID }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and Cache (E2E)
uses: docker/bake-action@v7
with:
load: true
source: .
files: compose.yml
targets: dev
set: |
*.cache-from=type=gha
*.cache-from=type=registry,ref=ghcr.io/miniontech/vexilon/agnav:buildcache
- name: Run E2E Tests
run: docker compose up test-everything
- name: Dump Logs on Failure
if: failure()
run: docker compose logs
- name: Cleanup
if: always()
run: docker compose down -v || true
build:
name: Build & Push to GHCR
needs: [check, test-unit]
if: needs.check.outputs.image == 'true' && needs.test-unit.result == 'success'
runs-on: ubuntu-26.04
timeout-minutes: 20
permissions:
attestations: write
contents: read
id-token: write
packages: write
steps:
- name: Build and Push
id: builder
uses: bcgov/actions/builder@122a9b1c6c082b1b1f18c300020fbdc417b6b0b2 # v0.10.0
with:
package: agnav
build_context: app
build_file: app/Containerfile
analysis:
name: Analysis
needs: check
if: needs.check.outputs.analysis == 'true'
permissions:
contents: read
security-events: write
uses: ./.github/workflows/reusable-analysis.yml
# ==========================================================================
# WARNING: This job acts as the required merge gate for this workflow.
# If you add a new job to this workflow, you MUST add its ID to the 'needs'
# array below, otherwise its failure or cancellation will not block the PR!
# ==========================================================================
results:
name: PR Results
needs: [check, actionlint, prepare-tests, test-unit, analysis, build, test-integration-model, test-integration-app, test-ui-e2e, test-e2e, validate-cache]
if: always()
runs-on: ubuntu-slim
timeout-minutes: 1
steps:
- uses: bcgov/actions/workflow-results@122a9b1c6c082b1b1f18c300020fbdc417b6b0b2 # v0.10.0
with:
needs: ${{ toJson(needs) }}