-
Notifications
You must be signed in to change notification settings - Fork 118
138 lines (120 loc) · 3.7 KB
/
test.yml
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
name: Build and test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:
permissions:
contents: read
jobs:
test-python:
runs-on: ubuntu-latest
strategy:
matrix:
# Python 3.13 should theoretically work,
# but having trouble running in Github Actions
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.5.5"
- name: Install dependencies with uv
run: |
uv sync --frozen
env:
UV_SYSTEM_PYTHON: 1
- name: Lint and format with ruff
run: |
uv run ruff format --check
uv run ruff check --output-format github
- name: Test with pytest
run: |
uv run pytest --cov=src/ --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
test-docker:
runs-on: ubuntu-latest
services:
dind:
image: docker:dind
ports:
- 2375:2375
options: >-
--privileged
--health-cmd "docker info"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Build service image
uses: docker/build-push-action@v3
with:
context: .
push: false
load: true
tags: agent-service-toolkit.service:${{ github.sha }}
file: docker/Dockerfile.service
- name: Build app image
uses: docker/build-push-action@v3
with:
context: .
push: false
load: true
tags: agent-service-toolkit.app:${{ github.sha }}
file: docker/Dockerfile.app
- name: Start service container
run: docker run -d --name service-container --network host -e USE_FAKE_MODEL=true agent-service-toolkit.service:${{ github.sha }}
- name: Confirm service starts correctly
run: |
timeout 30 bash -c '
while ! curl -s http://localhost/health; do
echo "Waiting for service to be ready..."
docker logs service-container
sleep 2
done
'
- name: Run app container
run: docker run -d --name app-container --network host -e AGENT_URL=http://localhost agent-service-toolkit.app:${{ github.sha }}
- name: Confirm app starts correctly
run: |
timeout 30 bash -c '
while ! curl -s http://localhost:8501/healthz; do
echo "Waiting for app to be ready..."
docker logs app-container
sleep 2
done
'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.5.5"
- name: Install ONLY CLIENT dependencies with uv
run: |
uv sync --frozen --only-group client --only-group dev
env:
UV_SYSTEM_PYTHON: 1
- name: Run integration tests
run: uv run pytest tests/integration -v --run-docker
- name: Clean up containers
if: always()
run: |
docker stop service-container app-container || true
docker rm service-container app-container || true