Skip to content

Merge pull request #121 from JoshuaC215/ddg-update #214

Merge pull request #121 from JoshuaC215/ddg-update

Merge pull request #121 from JoshuaC215/ddg-update #214

Workflow file for this run

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