Skip to content
Merged
46 changes: 46 additions & 0 deletions .github/workflows/build-uv-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build uv cache

on:
push:
branches:
- main
paths:
- "uv.lock"
- "pyproject.toml"
workflow_dispatch:

permissions:
contents: read

jobs:
build-cache:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.4"
python-version: ${{ matrix.python-version }}
enable-cache: false

- name: Install dependencies and populate cache
run: |
echo "Building global UV cache for Python ${{ matrix.python-version }}..."
uv sync --all-groups --all-extras --no-install-project
echo "Cache populated successfully"

- name: Save uv caches
uses: actions/cache/save@v4
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
37 changes: 29 additions & 8 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Lint

on: [pull_request]

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -15,19 +18,27 @@ jobs:
- name: Fetch Target Branch
run: git fetch origin $TARGET_BRANCH --depth=1

- name: Restore global uv cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-py3.11-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-main-py3.11-

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: |
**/pyproject.toml
**/uv.lock

- name: Set up Python
run: uv python install 3.11
version: "0.8.4"
python-version: "3.11"
enable-cache: false

- name: Install dependencies
run: uv sync --dev --no-install-project
run: uv sync --all-groups --all-extras --no-install-project

- name: Get Changed Python Files
id: changed-files
Expand All @@ -45,3 +56,13 @@ jobs:
| tr ' ' '\n' \
| grep -v 'src/crewai/cli/templates/' \
| xargs -I{} uv run ruff check "{}"

- name: Save uv caches
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-py3.11-${{ hashFiles('uv.lock') }}
29 changes: 0 additions & 29 deletions .github/workflows/security-checker.yml

This file was deleted.

36 changes: 27 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Run Tests
on: [pull_request]

permissions:
contents: write
contents: read

env:
OPENAI_API_KEY: fake-api-key
Expand All @@ -23,19 +23,27 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Restore global uv cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-main-py${{ matrix.python-version }}-

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: |
**/pyproject.toml
**/uv.lock

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
version: "0.8.4"
python-version: ${{ matrix.python-version }}
enable-cache: false

- name: Install the project
run: uv sync --dev --all-extras
run: uv sync --all-groups --all-extras

- name: Run tests (group ${{ matrix.group }} of 8)
run: |
Expand All @@ -48,3 +56,13 @@ jobs:
--durations=10 \
-n auto \
--maxfail=3

- name: Save uv caches
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
36 changes: 27 additions & 9 deletions .github/workflows/type-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Run Type Checks
on: [pull_request]

permissions:
contents: write
contents: read

jobs:
type-checker-matrix:
Expand All @@ -20,19 +20,27 @@ jobs:
with:
fetch-depth: 0 # Fetch all history for proper diff

- name: Restore global uv cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-main-py${{ matrix.python-version }}-

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: |
**/pyproject.toml
**/uv.lock

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
version: "0.8.4"
python-version: ${{ matrix.python-version }}
enable-cache: false

- name: Install dependencies
run: uv sync --dev --all-extras --no-install-project
run: uv sync --all-groups --all-extras

- name: Get changed Python files
id: changed-files
Expand Down Expand Up @@ -66,6 +74,16 @@ jobs:
if: steps.changed-files.outputs.has_changes == 'false'
run: echo "No Python files in src/ were modified - skipping type checks"

- name: Save uv caches
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}

# Summary job to provide single status for branch protection
type-checker:
name: type-checker
Expand Down