forked from icebear0828/codex-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (73 loc) · 2.33 KB
/
ci-docker.yml
File metadata and controls
82 lines (73 loc) · 2.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
name: CI — Docker smoke test
on:
pull_request:
paths:
- "Dockerfile"
- "docker-entrypoint.sh"
- "docker-healthcheck.sh"
- "docker-compose.yml"
- "package*.json"
- "src/**"
- "web/**"
- "shared/**"
- "config/**"
- "scripts/**"
push:
branches: [master]
paths:
- "Dockerfile"
- "docker-entrypoint.sh"
- "docker-healthcheck.sh"
concurrency:
group: ci-docker-${{ github.ref }}
cancel-in-progress: true
jobs:
smoke:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t codex-proxy:smoke .
- name: Start container
run: |
docker run -d --name smoke-test \
-p 18080:8080 \
-e NODE_ENV=production \
codex-proxy:smoke
echo "Container started"
- name: Wait for healthy
run: |
echo "Waiting for container to become healthy..."
for i in $(seq 1 30); do
STATUS=$(docker inspect --format='{{.State.Health.Status}}' smoke-test 2>/dev/null || echo "starting")
echo " [$i/30] status: $STATUS"
if [ "$STATUS" = "healthy" ]; then
echo "Container is healthy"
exit 0
fi
sleep 2
done
echo "::error::Container did not become healthy within 60s"
docker logs smoke-test
exit 1
- name: Verify /health endpoint
run: |
RESPONSE=$(curl -sf http://localhost:18080/health)
echo "Response: $RESPONSE"
echo "$RESPONSE" | jq -e '.status == "ok"'
- name: Verify /v1/models returns valid JSON
run: |
# Without auth, should return 401 or model list — either way must be valid JSON
STATUS=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:18080/v1/models)
echo "/v1/models status: $STATUS"
# 200 (no key set) or 401 (key set) are both acceptable
if [ "$STATUS" != "200" ] && [ "$STATUS" != "401" ]; then
echo "::error::Unexpected status $STATUS from /v1/models"
exit 1
fi
- name: Cleanup
if: always()
run: |
docker logs smoke-test 2>&1 | tail -30
docker rm -f smoke-test || true