-
-
Notifications
You must be signed in to change notification settings - Fork 0
229 lines (198 loc) · 7.14 KB
/
Copy pathmicroservices_validation.yml
File metadata and controls
229 lines (198 loc) · 7.14 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
name: Microservices Validation
on:
push:
branches:
- master
- work
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: microservices-validation-${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow, github.event.pull_request.number) || github.workflow_ref }}
cancel-in-progress: true
jobs:
unit-tests-aimer-web:
name: Unit Tests (aimer-web)
runs-on: ubuntu-latest
env:
UV_LINK_MODE: copy
SECRET_KEY: ci-secret-key
DEBUG: "true"
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
- name: Install Python 3.13
run: uv python install 3.13
- name: Install aimer-web dependencies
working-directory: services/aimer-web
run: uv sync --locked
- name: Run aimer-web Django tests
working-directory: services/aimer-web
run: uv run --locked python manage.py test auth website --testrunner django.test.runner.DiscoverRunner --verbosity 1
- name: Run aimer-web RAG tests
working-directory: services/aimer-web
run: uv run --locked python -m pytest -q RAG/tests
- name: Run Giovani Selenium tests
working-directory: services/aimer-web
run: uv run --locked python manage.py test website.selenium_tests --testrunner django.test.runner.DiscoverRunner --verbosity 1
unit-tests-mage:
name: Unit Tests (MAGE)
runs-on: ubuntu-latest
env:
UV_LINK_MODE: copy
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
- name: Install Python 3.13
run: uv python install 3.13
- name: Install MAGE dependencies
working-directory: services/MAGE
run: uv sync --locked
- name: Run MAGE unit tests
working-directory: services/MAGE
run: uv run --locked python -m pytest -q -m "not slow" tests
unit-tests-farm:
name: Unit Tests (FARM)
runs-on: ubuntu-latest
env:
UV_LINK_MODE: copy
DJANGO_SECRET_KEY: ci-secret-key
DJANGO_DEBUG: "true"
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
- name: Install Python 3.13
run: uv python install 3.13
- name: Install FARM dependencies
working-directory: services/FARM
run: uv sync --locked
- name: Run FARM unit tests
working-directory: services/FARM
run: uv run --locked python -m pytest -q tests
deployment-config:
name: Deployment Config
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Validate dev-stack compose file
run: |
cp infra/dev-stack/.env.ci infra/dev-stack/.env
docker compose --env-file infra/dev-stack/.env -f infra/dev-stack/docker-compose.yml config > /tmp/dev-stack.compose.yml
smoke-tests:
name: Docker Smoke (${{ matrix.service }})
runs-on: ubuntu-latest
needs:
- unit-tests-aimer-web
- unit-tests-mage
- unit-tests-farm
- deployment-config
strategy:
fail-fast: false
matrix:
include:
- service: aimer-web
context: ./services/aimer-web
dockerfile: ./services/aimer-web/Dockerfile
image: aimer-web-smoke:ci
container: aimer-web-smoke
host-port: "18000"
target-port: "8000"
health-url: http://127.0.0.1:18000/healthz/
run-env: -e SECRET_KEY=ci-secret-key -e DEBUG=true -e ALLOWED_HOSTS=localhost,127.0.0.1 -e RAG_VERIFY_ON_START=0
run-command: ""
- service: aimer-rag
context: ./services/aimer-web
dockerfile: ./services/aimer-web/Dockerfile.rag
image: aimer-rag-smoke:ci
container: aimer-rag-smoke
host-port: "18002"
target-port: "8000"
health-url: http://127.0.0.1:18002/healthz
run-env: -e RUN_DJANGO_MIGRATIONS=0 -e RAG_VERIFY_ON_START=0
run-command: ""
- service: MAGE
context: ./services/MAGE
dockerfile: ./services/MAGE/Dockerfile
image: mage-smoke:ci
container: mage-smoke
host-port: "10000"
target-port: "10000"
health-url: http://127.0.0.1:10000/healthz
run-env: ""
run-command: ""
- service: FARM
context: ./services/FARM
dockerfile: ./services/FARM/Dockerfile
image: farm-smoke:ci
container: farm-smoke
host-port: "18001"
target-port: "8000"
health-url: http://127.0.0.1:18001/healthz/
run-env: -e DJANGO_SECRET_KEY=ci-secret-key -e DJANGO_DEBUG=true -e DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1
run-command: ""
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e
- name: Build runtime image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: false
load: true
tags: ${{ matrix.image }}
- name: Run HTTP smoke test
env:
CONTAINER: ${{ matrix.container }}
HEALTH_URL: ${{ matrix.health-url }}
HOST_PORT: ${{ matrix.host-port }}
IMAGE: ${{ matrix.image }}
RUN_COMMAND: ${{ matrix.run-command }}
RUN_ENV: ${{ matrix.run-env }}
TARGET_PORT: ${{ matrix.target-port }}
run: |
set -euo pipefail
docker run -d --name "${CONTAINER}" ${RUN_ENV} -p "${HOST_PORT}:${TARGET_PORT}" "${IMAGE}" ${RUN_COMMAND}
cleanup() {
status=$?
if [ "${status}" -ne 0 ]; then
docker logs "${CONTAINER}" || true
fi
docker rm -f "${CONTAINER}" || true
exit "${status}"
}
trap cleanup EXIT
for attempt in {1..60}; do
if curl -fsS "${HEALTH_URL}"; then
exit 0
fi
sleep 2
done
echo "Smoke check failed for ${HEALTH_URL}"
exit 1