Skip to content

Update pyproject.toml #8

Update pyproject.toml

Update pyproject.toml #8

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
PYTHON_VERSION: '3.10' # Matches Dockerfile Python version
UV_VERSION: '0.1.40' # Specify a version for uv
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
run: python -m pip install uv==${{ env.UV_VERSION }}
- name: Create uv virtual environment
run: uv venv --python ${{ env.PYTHON_VERSION }} # Specify Python version for venv
- name: Install dependencies
# Activate venv created by setup-python if necessary, or install globally for the runner
# For simplicity, uv can manage its own environment or install into the one setup-python provides.
run: uv pip install -e ".[dev]"
- name: Lint with ruff
run: uv run ruff check .
- name: Check formatting with ruff
run: uv run ruff format --check .
- name: Type check with mypy
run: uv run mypy . --ignore-missing-imports # Add --ignore-missing-imports for initial setup
test:
runs-on: ubuntu-latest
needs: lint # Run tests only if linting passes
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
# Define other environment variables your tests might need
# Example: AGENT_PORT: "10000"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
run: python -m pip install uv==${{ env.UV_VERSION }}
- name: Create uv virtual environment
run: uv venv --python ${{ env.PYTHON_VERSION }} # Specify Python version for venv
- name: Install dependencies
run: uv pip install -e ".[dev]"
- name: Run tests
run: uv run pytest
build-and-push-docker:
runs-on: ubuntu-latest
needs: test # Run Docker build only if tests pass
# Only run this job on pushes to the main branch
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: read # To checkout the repository
packages: write # To push packages to GHCR
steps:
- uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/rabbithole-agent
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true # Always push since this job only runs on 'push' to 'main'
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# The ADK agent in Docker reads GOOGLE_API_KEY from its runtime environment.
# No need to pass it as a build-arg unless build-time operations require it.