Files
crewAI/.github/workflows/linter.yml
Matt Aitchison 0bdc5a093e ci: optimize test workflows — reduce jobs, share venv via artifact
- Restructure tests.yml: install once per Python version, share .venv
  via artifact instead of 32 independent installs
- Reduce test groups from 8 to 4 (tests only take ~60s per group)
- Only test Python 3.12+3.13 on PRs; full matrix on push to main
- Switch all workflows from manual actions/cache to setup-uv built-in
  caching, eliminating cache race conditions
- Add --frozen flag to uv sync for deterministic CI installs
- Re-enable duration-based test splitting with least_duration algorithm
  (was disabled due to a bug in the path filter)
- Fix update-test-durations path filter (tests/**/*.py never matched
  actual test dirs under lib/)
- Add concurrency group with cancel-in-progress for PR runs
- Add gate jobs to satisfy existing branch protection required checks
2026-02-25 16:14:38 -06:00

48 lines
1.3 KiB
YAML

name: Lint
on: [pull_request]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
env:
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch Target Branch
run: git fetch origin $TARGET_BRANCH --depth=1
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.4"
python-version: "3.11"
enable-cache: true
- name: Install dependencies
run: uv sync --all-groups --all-extras --frozen --no-install-project
- name: Get Changed Python Files
id: changed-files
run: |
merge_base=$(git merge-base origin/"$TARGET_BRANCH" HEAD)
changed_files=$(git diff --name-only --diff-filter=ACMRTUB "$merge_base" | grep '\.py$' || true)
echo "files<<EOF" >> $GITHUB_OUTPUT
echo "$changed_files" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Run Ruff on Changed Files
if: ${{ steps.changed-files.outputs.files != '' }}
run: |
echo "${{ steps.changed-files.outputs.files }}" \
| tr ' ' '\n' \
| grep -v 'src/crewai/cli/templates/' \
| grep -v '/tests/' \
| xargs -I{} uv run ruff check "{}"