Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/crewai-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CrewAI Python compatibility

on:
pull_request:
paths:
- 'python/frameworks/crewai/**'
- 'python/tests/test_framework_crewai.py'
- 'python/tests/conftest.py'
- 'python/tests/pytest.ini'
- '.github/workflows/crewai-tests.yml'
push:
branches: [dev]
paths:
- 'python/frameworks/crewai/**'
- 'python/tests/test_framework_crewai.py'
- 'python/tests/conftest.py'
- 'python/tests/pytest.ini'
- '.github/workflows/crewai-tests.yml'

permissions:
contents: read

jobs:
compatibility:
name: CrewAI (${{ matrix.crewai }}, Python ${{ matrix.python }})
runs-on: ubuntu-24.04
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python: ['3.10', '3.12']
crewai: ['0.41.1', 'latest']
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python }}
- name: Install the declared floor or latest CrewAI
env:
CREWAI_VERSION: ${{ matrix.crewai }}
run: |
python -m venv .venv
requirement="crewai==$CREWAI_VERSION"
if [ "$CREWAI_VERSION" = latest ]; then
requirement='crewai>=0.41.1'
fi
# Keep the core dependency at its declared minimum. The general Python
# workflow separately exercises the repository's locked dependencies.
.venv/bin/pip install -e python/frameworks/crewai "$requirement" \
'fi-instrumentation-otel==1.2.2' \
'pytest==8.4.2' 'pytest-asyncio==0.24.0' 'pytest-mock==3.14.0'
.venv/bin/pip check
.venv/bin/python -I -c 'from importlib.metadata import version; print("CrewAI", version("crewai"))'
- name: Run the full wrapper and shared suites without outbound network
run: |
mkdir -p "$RUNNER_TEMP/crewai-home"
sudo unshare --net -- bash -e -c '
ip link set lo up
export HOME="$3"
export CREWAI_DISABLE_TELEMETRY=true CREWAI_DISABLE_TRACKING=true
export CREWAI_TRACING_ENABLED=false OTEL_SDK_DISABLED=false
export OPENAI_API_KEY=synthetic-openai-key
export FI_API_KEY=synthetic-fi-key FI_SECRET_KEY=synthetic-fi-secret
export FI_BASE_URL=http://127.0.0.1:9 FI_GRPC_URL=http://127.0.0.1:9
"$1" -I -m pytest "$2/python/frameworks/crewai/tests" -q \
-p no:cacheprovider -o addopts= -o asyncio_default_fixture_loop_scope=function
"$1" -I -m pytest "$2/python/tests/test_framework_crewai.py" -q \
-p no:cacheprovider -o addopts= -o asyncio_default_fixture_loop_scope=function
' _ "$PWD/.venv/bin/python" "$PWD" "$RUNNER_TEMP/crewai-home"
18 changes: 5 additions & 13 deletions python/frameworks/crewai/tests/test_native_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import inspect
import os
from importlib import import_module
from importlib.metadata import version
from unittest.mock import patch

Expand Down Expand Up @@ -71,29 +70,22 @@ def test_native_telemetry_installed_source_and_opt_out_flags(monkeypatch):
assert flag not in source
assert "https://telemetry.crewai.com:4319" in source
return
# Maintained CrewAI delegates to crewai-core; the repository-locked 0.152
# implements the same checks in CrewAI itself.
cls = (
import_module("crewai_core.telemetry").Telemetry
if version("crewai") == "1.15.33"
else Telemetry
)
# Exercise the installed entry point, whether CrewAI implements the checks
# itself or delegates to crewai-core. Source layout is not the contract.
honored = (
"CREWAI_DISABLE_TELEMETRY",
"CREWAI_DISABLE_TRACKING",
"OTEL_SDK_DISABLED",
)
ignored = ("CREWAI_TELEMETRY_OPT_OUT", "DO_NOT_TRACK")
source = inspect.getsource(cls._is_telemetry_disabled)
for flag in honored + ignored:
monkeypatch.setenv(flag, "false")
assert not Telemetry._is_telemetry_disabled()
for flag in honored:
assert flag in source
monkeypatch.setenv(flag, "true")
assert Telemetry._is_telemetry_disabled()
assert Telemetry._is_telemetry_disabled(), flag
monkeypatch.setenv(flag, "false")
assert not Telemetry._is_telemetry_disabled(), flag
for flag in ignored:
assert flag not in source
monkeypatch.setenv(flag, "true")
assert not Telemetry._is_telemetry_disabled()
assert not Telemetry._is_telemetry_disabled(), flag
Loading