-
Notifications
You must be signed in to change notification settings - Fork 1
181 lines (158 loc) · 5.33 KB
/
Copy pathdeveloper-experience.yml
File metadata and controls
181 lines (158 loc) · 5.33 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
name: Developer Experience
on:
push:
branches: ["main"]
paths:
- ".dockerignore"
- ".env.example"
- ".env.minimal"
- ".github/workflows/developer-experience.yml"
- ".github/workflows/docker-publish.yml"
- "Dockerfile"
- "README.md"
- "compose.yaml"
- "compose.dev.yaml"
- "compose.prod.yaml"
- "compose.smoke.yaml"
- "docs/**"
- "entrypoint.sh"
- "mkdocs.yml"
- "mcp-bridge/**"
- "pyproject.toml"
- "scripts/write_compose_env.py"
- "setup.sh"
- "src/**"
- "systemd/**"
- "tests/test_deployment_contract.py"
- "uv.lock"
pull_request:
branches: ["main"]
paths:
- ".dockerignore"
- ".env.example"
- ".env.minimal"
- ".github/workflows/developer-experience.yml"
- ".github/workflows/docker-publish.yml"
- "Dockerfile"
- "README.md"
- "compose.yaml"
- "compose.dev.yaml"
- "compose.prod.yaml"
- "compose.smoke.yaml"
- "docs/**"
- "entrypoint.sh"
- "mkdocs.yml"
- "mcp-bridge/**"
- "pyproject.toml"
- "scripts/write_compose_env.py"
- "setup.sh"
- "src/**"
- "systemd/**"
- "tests/test_deployment_contract.py"
- "uv.lock"
permissions:
contents: read
concurrency:
group: developer-experience-${{ github.ref }}
cancel-in-progress: true
jobs:
documentation:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
run: uv python install 3.13
- name: Install documentation dependencies
run: uv sync --locked --only-group docs
- name: Build documentation in strict mode
run: uv run --no-sync mkdocs build --strict
deployment-contract:
name: Validate deployment contract
runs-on: ubuntu-latest
env:
ENV_FILE: .env.minimal
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
run: uv python install 3.13
- name: Install project dependencies
run: uv sync --locked
- name: Build the production image
run: docker build --tag blacki:contract-test .
- name: Run deployment contract tests
run: uv run pytest tests/test_deployment_contract.py
- name: Validate shell syntax
run: bash -n setup.sh entrypoint.sh
- name: Validate Docker Compose
run: |
docker compose --env-file .env.minimal \
-f compose.yaml -f compose.prod.yaml config --quiet
docker compose --env-file .env.minimal \
-f compose.yaml -f compose.dev.yaml config --quiet
- name: Smoke test production startup
env:
ENV_FILE: .env.minimal
IMAGE: blacki:contract-test
SMOKE_PROJECT: blacki-contract-smoke
run: |
cleanup() {
docker compose --project-name "$SMOKE_PROJECT" \
-f compose.smoke.yaml down --remove-orphans >/dev/null 2>&1 || true
}
trap cleanup EXIT
docker compose --project-name "$SMOKE_PROJECT" \
--env-file "$ENV_FILE" -f compose.smoke.yaml up -d
CONTAINER_ID=$(
docker compose --project-name "$SMOKE_PROJECT" \
-f compose.smoke.yaml ps --all -q agent
)
if [ -z "$CONTAINER_ID" ]; then
echo "Production smoke test did not create the agent container."
docker compose --project-name "$SMOKE_PROJECT" \
-f compose.smoke.yaml logs --no-color
exit 1
fi
for attempt in $(seq 1 15); do
if docker exec "$CONTAINER_ID" python -c \
'import urllib.request; urllib.request.urlopen("http://127.0.0.1:8080/ready", timeout=3).read()' \
>/dev/null 2>&1; then
echo "Production image readiness check passed."
exit 0
fi
RUNNING=$(
docker inspect --format '{{.State.Running}}' \
"$CONTAINER_ID" 2>/dev/null || true
)
if [ "$RUNNING" != "true" ]; then
echo "Production image exited before becoming ready."
docker compose --project-name "$SMOKE_PROJECT" \
-f compose.smoke.yaml logs --no-color
exit 1
fi
echo "Readiness attempt $attempt/15 failed; retrying in 2s..."
sleep 2
done
echo "Production image did not become ready."
docker compose --project-name "$SMOKE_PROJECT" \
-f compose.smoke.yaml logs --no-color
exit 1
- name: Validate production OTLP exporters
run: |
docker run --rm --entrypoint python \
--env OTEL_EXPORTER_OTLP_ENDPOINT=http://collector.example:4318 \
--env OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
blacki:contract-test -c \
"from blacki.utils.observability import validate_observability_environment; validate_observability_environment()"