Skip to content
18 changes: 5 additions & 13 deletions .github/actions/python-uv-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ inputs:
python-version:
description: Python version to install
required: false
default: "3.13"
default: "3.13.9"
sync-flags:
description: Extra flags for uv sync (e.g., --all-extras --dev)
required: false
default: "--all-extras --dev"
default: "--all-extras --dev --frozen"
working-directory:
description: Directory to run in
required: false
Expand All @@ -23,27 +23,19 @@ runs:
python-version: ${{ inputs.python-version }}
version: "latest"
enable-cache: true
prune-cache: false
cache-suffix: ${{ inputs.python-version }}
cache-dependency-glob: |
**/pyproject.toml
**/uv.lock

- name: Cache .venv directory
id: cache_venv
uses: actions/cache@v4
with:
path: .venv
key: uv-venv-v1-${{ runner.os }}-py${{ inputs.python-version }}-${{ hashFiles('**/uv.lock') }}
restore-keys: |
uv-venv-v1-${{ runner.os }}-py${{ inputs.python-version }}-
uv-venv-v1-${{ runner.os }}-

- name: Log cache status
shell: bash
run: |
echo "uv download cache hit: ${{ steps.setup_uv.outputs['cache-hit'] }}"
echo ".venv cache hit: ${{ steps.cache_venv.outputs.cache-hit }}"

- name: Install the project
- name: Install the project dependencies
shell: bash
working-directory: ${{ inputs.working-directory }}
run: uv sync ${{ inputs.sync-flags }}
51 changes: 38 additions & 13 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,47 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# If set, uv will run without updating the uv.lock file. Equivalent to the `uv run --frozen`.
UV_FROZEN: "1"

jobs:
lint:
name: Ruff & mypy
ruff:
name: Ruff
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- uses: ./.github/actions/python-uv-setup
- name: Install dependencies
uses: ./.github/actions/python-uv-setup
- name: Run Ruff
run: uv run ruff check .
- name: Mypy core

mypy-core:
name: Run Mypy for core
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install dependencies
uses: ./.github/actions/python-uv-setup
# Restore mypy cache to speed up the run
- name: Restore mypy cache
uses: actions/cache/restore@v4
with:
path: .mypy_cache
key: mypy-cache-${{ hashFiles('pyproject.toml', 'mypy.ini') }}
- name: Run mypy core
run: uv run mypy --install-types --non-interactive agents-core/vision_agents
- name: Mypy plugins
- name: Run mypy for plugins
run: uv run mypy --install-types --non-interactive --exclude 'plugins/.*/tests/.*' plugins
- name: Show environment name
run: |
echo "Environment: ${{ job.environment }}"
# Save the updated cache
- name: Save mypy cache
uses: actions/cache/save@v4
with:
path: .mypy_cache
key: mypy-cache-${{ hashFiles('pyproject.toml', 'mypy.ini') }}

test:
name: Test "${{ inputs.marker }}"
Expand All @@ -50,7 +74,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
- uses: ./.github/actions/python-uv-setup
- name: Install dependencies
uses: ./.github/actions/python-uv-setup
- name: Export AWS_BEARER_TOKEN_BEDROCK (heredoc)
shell: bash
run: |
Expand All @@ -62,7 +87,7 @@ jobs:

- name: Verify presence
run: uv run python -c "import os; v=os.getenv('AWS_BEARER_TOKEN_BEDROCK'); print('exists', v is not None, 'len', 0 if v is None else len(v))"
- name: Run test
run: uv run pytest -n auto -m "${{ inputs.marker }}"
- name: Run plugin test
run: uv run pytest plugins/*/tests/*.py -n auto -m "${{ inputs.marker }}"
- name: Run core tests
run: uv run pytest -n auto -m "${{ inputs.marker }}" tests/
- name: Run plugin tests
run: uv run pytest -n auto -m "${{ inputs.marker }}" plugins/*/tests/*.py
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.12.8
rev: v0.14.5
hooks:
# Run the linter.
- id: ruff-check
Expand All @@ -22,13 +22,13 @@ repos:
hooks:
- id: mypy-main
name: mypy (vision_agents)
entry: uv run mypy --install-types --non-interactive -p vision_agents
entry: uv run --frozen mypy --install-types --non-interactive agents-core/vision_agents
language: system
pass_filenames: false
types_or: [python]
- id: mypy-plugins
name: mypy (plugins)
entry: uv run mypy --install-types --non-interactive --exclude 'plugins/.*/tests/.*' plugins
entry: uv run --frozen mypy --install-types --non-interactive --exclude 'plugins/.*/tests/.*' plugins
language: system
pass_filenames: false
types_or: [python]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exclude = [
[dependency-groups]
dev = [
"ruff",
"mypy",
"mypy[mypyc,faster-cache]",
"pip>=25.2",
"pytest",
"pytest-xdist",
Expand Down
Loading