Skip to content

Commit 944896d

Browse files
authored
CI improvements (#197)
1 parent c28a0a8 commit 944896d

File tree

5 files changed

+110
-32
lines changed

5 files changed

+110
-32
lines changed

.github/actions/python-uv-setup/action.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ inputs:
44
python-version:
55
description: Python version to install
66
required: false
7-
default: "3.13"
7+
default: "3.13.9"
88
sync-flags:
99
description: Extra flags for uv sync (e.g., --all-extras --dev)
1010
required: false
11-
default: "--all-extras --dev"
11+
default: "--all-extras --dev --frozen"
1212
working-directory:
1313
description: Directory to run in
1414
required: false
@@ -23,27 +23,19 @@ runs:
2323
python-version: ${{ inputs.python-version }}
2424
version: "latest"
2525
enable-cache: true
26+
prune-cache: false
27+
cache-suffix: ${{ inputs.python-version }}
2628
cache-dependency-glob: |
2729
**/pyproject.toml
2830
**/uv.lock
2931
30-
- name: Cache .venv directory
31-
id: cache_venv
32-
uses: actions/cache@v4
33-
with:
34-
path: .venv
35-
key: uv-venv-v1-${{ runner.os }}-py${{ inputs.python-version }}-${{ hashFiles('**/uv.lock') }}
36-
restore-keys: |
37-
uv-venv-v1-${{ runner.os }}-py${{ inputs.python-version }}-
38-
uv-venv-v1-${{ runner.os }}-
39-
4032
- name: Log cache status
4133
shell: bash
4234
run: |
4335
echo "uv download cache hit: ${{ steps.setup_uv.outputs['cache-hit'] }}"
4436
echo ".venv cache hit: ${{ steps.cache_venv.outputs.cache-hit }}"
4537
46-
- name: Install the project
38+
- name: Install the project dependencies
4739
shell: bash
4840
working-directory: ${{ inputs.working-directory }}
4941
run: uv sync ${{ inputs.sync-flags }}

.github/workflows/run_tests.yml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,47 @@ on:
1010
concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}
1212
cancel-in-progress: true
13+
14+
env:
15+
# If set, uv will run without updating the uv.lock file. Equivalent to the `uv run --frozen`.
16+
UV_FROZEN: "1"
17+
1318
jobs:
14-
lint:
15-
name: Ruff & mypy
19+
ruff:
20+
name: Ruff
1621
runs-on: ubuntu-latest
1722
steps:
1823
- name: Checkout
1924
uses: actions/checkout@v5
20-
- uses: ./.github/actions/python-uv-setup
25+
- name: Install dependencies
26+
uses: ./.github/actions/python-uv-setup
2127
- name: Run Ruff
2228
run: uv run ruff check .
23-
- name: Mypy core
29+
30+
mypy:
31+
name: Mypy
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v5
36+
- name: Install dependencies
37+
uses: ./.github/actions/python-uv-setup
38+
# Restore mypy cache to speed up the run
39+
- name: Restore mypy cache
40+
uses: actions/cache/restore@v4
41+
with:
42+
path: .mypy_cache
43+
key: mypy-cache-${{ hashFiles('pyproject.toml') }}
44+
- name: Run mypy for core
2445
run: uv run mypy --install-types --non-interactive agents-core/vision_agents
25-
- name: Mypy plugins
46+
- name: Run mypy for plugins
2647
run: uv run mypy --install-types --non-interactive --exclude 'plugins/.*/tests/.*' plugins
27-
- name: Show environment name
28-
run: |
29-
echo "Environment: ${{ job.environment }}"
48+
# Save the updated mypy cache
49+
- name: Save mypy cache
50+
uses: actions/cache/save@v4
51+
with:
52+
path: .mypy_cache
53+
key: mypy-cache-${{ hashFiles('pyproject.toml') }}
3054

3155
test:
3256
name: Test "${{ inputs.marker }}"
@@ -50,7 +74,8 @@ jobs:
5074
steps:
5175
- name: Checkout
5276
uses: actions/checkout@v5
53-
- uses: ./.github/actions/python-uv-setup
77+
- name: Install dependencies
78+
uses: ./.github/actions/python-uv-setup
5479
- name: Export AWS_BEARER_TOKEN_BEDROCK (heredoc)
5580
shell: bash
5681
run: |
@@ -62,7 +87,7 @@ jobs:
6287
6388
- name: Verify presence
6489
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))"
65-
- name: Run test
66-
run: uv run pytest -n auto -m "${{ inputs.marker }}"
67-
- name: Run plugin test
68-
run: uv run pytest plugins/*/tests/*.py -n auto -m "${{ inputs.marker }}"
90+
- name: Run core tests
91+
run: uv run pytest -n auto -m "${{ inputs.marker }}" tests/
92+
- name: Run plugin tests
93+
run: uv run pytest -n auto -m "${{ inputs.marker }}" plugins/*/tests/*.py

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.12.8
4+
rev: v0.14.5
55
hooks:
66
# Run the linter.
77
- id: ruff-check
@@ -22,13 +22,13 @@ repos:
2222
hooks:
2323
- id: mypy-main
2424
name: mypy (vision_agents)
25-
entry: uv run mypy --install-types --non-interactive -p vision_agents
25+
entry: uv run --frozen mypy --install-types --non-interactive agents-core/vision_agents
2626
language: system
2727
pass_filenames: false
2828
types_or: [python]
2929
- id: mypy-plugins
3030
name: mypy (plugins)
31-
entry: uv run mypy --install-types --non-interactive --exclude 'plugins/.*/tests/.*' plugins
31+
entry: uv run --frozen mypy --install-types --non-interactive --exclude 'plugins/.*/tests/.*' plugins
3232
language: system
3333
pass_filenames: false
3434
types_or: [python]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ exclude = [
7373
[dependency-groups]
7474
dev = [
7575
"ruff",
76-
"mypy",
76+
"mypy[mypyc,faster-cache]",
7777
"pip>=25.2",
7878
"pytest",
7979
"pytest-xdist",

0 commit comments

Comments
 (0)