mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-08 20:18:16 +00:00
* fix: bump litellm to >=1.83.0 to address CVE-2026-35030 Bump litellm from <=1.82.6 to >=1.83.0 to fix JWT auth bypass via OIDC cache key collision (CVE-2026-35030). Also widen devtools openai pin from ~=1.83.0 to >=1.83.0,<3 to resolve the version conflict (litellm 1.83.0 requires openai>=2.8.0). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: resolve mypy errors from litellm bump - Remove unused type: ignore[import-untyped] on instructor import - Remove all unused type: ignore[union-attr] comments (litellm types fixed) - Add hasattr guard for tool_call.function — new litellm adds ChatCompletionMessageCustomToolCall to the union which lacks .function * fix: tighten litellm pin to ~=1.83.0 (patch-only bumps) >=1.83.0,<2 is too wide — litellm has had breaking changes between minors. ~=1.83.0 means >=1.83.0,<1.84.0 — gets CVE patches but won't pull in breaking minor releases. * ci: bump uv from 0.8.4 to 0.11.3 * fix: resolve mypy errors in openai completion from 2.x type changes Use isinstance checks with concrete openai response types instead of string comparisons for proper type narrowing. Update code interpreter handling for outputs/OutputImage API changes in openai 2.x. * fix: pre-cache tiktoken encoding before VCR intercepts requests --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Alex <alex@crewai.com> Co-authored-by: Greyson LaLonde <greyson@crewai.com>
101 lines
3.2 KiB
YAML
101 lines
3.2 KiB
YAML
name: Run Tests
|
|
|
|
on: [pull_request]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
tests:
|
|
name: tests (${{ matrix.python-version }})
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
python-version: ['3.10', '3.11', '3.12', '3.13']
|
|
group: [1, 2, 3, 4, 5, 6, 7, 8]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
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:
|
|
version: "0.11.3"
|
|
python-version: ${{ matrix.python-version }}
|
|
enable-cache: false
|
|
|
|
- name: Install the project
|
|
run: uv sync --all-groups --all-extras
|
|
|
|
- name: Restore test durations
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: .test_durations_py*
|
|
key: test-durations-py${{ matrix.python-version }}
|
|
|
|
- name: Run tests (group ${{ matrix.group }} of 8)
|
|
run: |
|
|
PYTHON_VERSION_SAFE=$(echo "${{ matrix.python-version }}" | tr '.' '_')
|
|
DURATION_FILE="../../.test_durations_py${PYTHON_VERSION_SAFE}"
|
|
|
|
# Temporarily always skip cached durations to fix test splitting
|
|
# When durations don't match, pytest-split runs duplicate tests instead of splitting
|
|
echo "Using even test splitting (duration cache disabled until fix merged)"
|
|
DURATIONS_ARG=""
|
|
|
|
# Original logic (disabled temporarily):
|
|
# if [ ! -f "$DURATION_FILE" ]; then
|
|
# echo "No cached durations found, tests will be split evenly"
|
|
# DURATIONS_ARG=""
|
|
# elif git diff origin/${{ github.base_ref }}...HEAD --name-only 2>/dev/null | grep -q "^tests/.*\.py$"; then
|
|
# echo "Test files have changed, skipping cached durations to avoid mismatches"
|
|
# DURATIONS_ARG=""
|
|
# else
|
|
# echo "No test changes detected, using cached test durations for optimal splitting"
|
|
# DURATIONS_ARG="--durations-path=${DURATION_FILE}"
|
|
# fi
|
|
|
|
cd lib/crewai && uv run pytest \
|
|
-vv \
|
|
--splits 8 \
|
|
--group ${{ matrix.group }} \
|
|
$DURATIONS_ARG \
|
|
--durations=10 \
|
|
--maxfail=3
|
|
|
|
- name: Run tool tests (group ${{ matrix.group }} of 8)
|
|
run: |
|
|
cd lib/crewai-tools && uv run pytest \
|
|
-vv \
|
|
--splits 8 \
|
|
--group ${{ matrix.group }} \
|
|
--durations=10 \
|
|
--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') }}
|