Bump gitpython from 3.1.46 to 3.1.57 #200
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Lint | |
| on: | |
| pull_request: | |
| paths: | |
| - 'src/**/*.py' | |
| - 'tests/**/*.py' | |
| - 'backend/**/*.py' | |
| - 'pyproject.toml' | |
| - 'uv.lock' | |
| - 'backend/pyproject.toml' | |
| - 'backend/uv.lock' | |
| - '.github/workflows/lint.yml' | |
| # Cancel in-flight runs on the same PR when a new push lands. | |
| concurrency: | |
| group: lint-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Ruff and mypy on changed files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # Need the full base ref locally so we can compute the diff | |
| # against the PR's merge base. | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Compute changed Python files | |
| id: changed | |
| run: | | |
| base="${{ github.event.pull_request.base.sha }}" | |
| head="${{ github.event.pull_request.head.sha }}" | |
| # Diff against the merge base so we only see files touched in the PR. | |
| merge_base=$(git merge-base "$base" "$head") | |
| mapfile -t files < <(git diff --name-only --diff-filter=ACMR "$merge_base" "$head" -- '*.py' ':!src/quoptuna/backend/base/pennylane_models/*') | |
| if [ "${#files[@]}" -eq 0 ]; then | |
| echo "No Python files changed." | |
| echo "files=" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| printf '%s\n' "${files[@]}" | |
| # Pass as a single space-separated string to subsequent steps. | |
| echo "files=${files[*]}" >> "$GITHUB_OUTPUT" | |
| - name: Ruff lint (no autofix) | |
| if: steps.changed.outputs.files != '' | |
| run: | | |
| # Lint violations fail the build. Auto-fixing lint | |
| # ("ruff check --fix") is intentionally NOT enabled here. | |
| # Ruff resolves the closest pyproject.toml per file, so root | |
| # files use the root config and backend/ files use | |
| # backend/pyproject.toml automatically. | |
| # Safe lint fixes and formatting are auto-applied by | |
| # `.github/workflows/autofix.yml`. | |
| uv run ruff check --no-fix --output-format=github ${{ steps.changed.outputs.files }} | |
| - name: Mypy | |
| if: steps.changed.outputs.files != '' | |
| run: | | |
| # Split changed files by project so each is checked with the | |
| # config that applies to it: | |
| # - src/quoptuna/* runs from src/ (root [tool.mypy], mypy_path=quoptuna) | |
| # - tests/* runs from the repo root | |
| # - backend/app/* runs from backend/ (no [tool.mypy], mypy defaults) | |
| src_files=() | |
| test_files=() | |
| backend_files=() | |
| read -ra changed_files <<< "${{ steps.changed.outputs.files }}" | |
| for f in "${changed_files[@]}"; do | |
| case "$f" in | |
| src/*) src_files+=("${f#src/}") ;; | |
| tests/*) test_files+=("$f") ;; | |
| backend/*) backend_files+=("${f#backend/}") ;; | |
| esac | |
| done | |
| if [ "${#src_files[@]}" -gt 0 ]; then | |
| (cd src && uv run mypy "${src_files[@]}") | |
| fi | |
| if [ "${#test_files[@]}" -gt 0 ]; then | |
| uv run mypy "${test_files[@]}" | |
| fi | |
| if [ "${#backend_files[@]}" -gt 0 ]; then | |
| (cd backend && uv run mypy "${backend_files[@]}") | |
| fi |