Skip to content

Add tab components and API reference docs #43

Add tab components and API reference docs

Add tab components and API reference docs #43

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: write # Allow a GITHUB_TOKEN to push to the repository
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 }} .venv # Explicitly name the venv folder
- name: Install dependencies into uv venv
shell: bash # Use bash to activate venv
run: |
source .venv/bin/activate
uv pip install -e ".[dev]"
echo "--- Explicitly installing mypy --- "
uv pip install mypy # Add explicit install for mypy
- name: Linting and Formatting Checks
shell: bash # Use bash to ensure venv is active for these commands
run: |
source .venv/bin/activate
echo "--- Linting with ruff (with auto-fix) --- "
ruff check . --fix --config pyproject.toml
echo "--- Formatting with ruff ---"
ruff format . --config pyproject.toml
echo "--- Type checking with mypy ---"
python -m mypy . --ignore-missing-imports
- name: Commit changes made by ruff
if: success() # Only run if previous steps were successful
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git diff --quiet || (git commit -am "Automated linting and formatting fixes" && git push)
test:
runs-on: ubuntu-latest
needs: lint # Run tests only if linting passes
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
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 }} .venv # Explicitly name the venv folder
- name: Install dependencies into uv venv
shell: bash # Use bash to activate venv
run: |
source .venv/bin/activate
uv pip install -e ".[dev]"
- name: Run tests
shell: bash # Use bash to ensure venv is active for pytest
run: |
source .venv/bin/activate
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.