mirror of
https://github.com/crewAIInc/crewAI.git
synced 2025-12-16 04:18:35 +00:00
chore(dev): update tooling & CI workflows - Upgrade ruff, mypy (strict), pre-commit; add hooks, stubs, config consolidation - Add bandit to dev deps and update uv.lock - Enhance ruff rules (modern Python style, B006 for mutable defaults) - Update workflows to use uv, matrix strategy, and changed-file type checking - Include tests in type checking; fix job names and add summary job for branch protection
48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
name: Lint
|
|
|
|
on: [pull_request]
|
|
|
|
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:
|
|
enable-cache: true
|
|
cache-dependency-glob: |
|
|
**/pyproject.toml
|
|
**/uv.lock
|
|
|
|
- name: Set up Python
|
|
run: uv python install 3.11
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --dev --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/' \
|
|
| xargs -I{} uv run ruff check "{}"
|