Remove old py versions #11
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_pull_request | |
| on: [pull_request, push] | |
| jobs: | |
| check_changes: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| has_python_changes: ${{ steps.changed-files.outputs.has_python_changes }} | |
| files: ${{ steps.changed-files.outputs.files }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # To get all history for git diff commands | |
| - name: Get changed Python files | |
| id: changed-files | |
| run: | | |
| # Make sure the scripts are executable | |
| chmod +x .github/scripts/detect_changes.py | |
| # Run the Python script to detect changes | |
| .github/scripts/detect_changes.py | |
| - name: PR information | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: | | |
| if [[ "${{ steps.changed-files.outputs.has_python_changes }}" == "true" ]]; then | |
| echo "This PR contains Python changes that will be linted." | |
| else | |
| echo "This PR contains no Python changes, but still requires manual approval." | |
| fi | |
| lint: | |
| needs: check_changes | |
| if: ${{ needs.check_changes.outputs.has_python_changes == 'true' }} | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tool: [flake8, format, mypy, pytest, pyupgrade, tox] | |
| steps: | |
| # Additional check to ensure we have Python files before proceeding | |
| - name: Verify Python changes | |
| run: | | |
| if [[ "${{ needs.check_changes.outputs.has_python_changes }}" != "true" ]]; then | |
| echo "No Python files were changed. Skipping linting." | |
| exit 0 | |
| fi | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.12 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-dev.txt | |
| # Make all scripts executable | |
| chmod +x .github/scripts/*.py | |
| # Flake8 linting | |
| - name: Lint with flake8 | |
| if: ${{ matrix.tool == 'flake8' }} | |
| id: flake8 | |
| run: | | |
| echo "Linting files: ${{ needs.check_changes.outputs.files }}" | |
| flake8 ${{ needs.check_changes.outputs.files }} --count --show-source --statistics | |
| # Format checking with isort and black | |
| - name: Format check | |
| if: ${{ matrix.tool == 'format' }} | |
| id: format | |
| run: | | |
| echo "Checking format with isort for: ${{ needs.check_changes.outputs.files }}" | |
| isort --profile black --check ${{ needs.check_changes.outputs.files }} | |
| echo "Checking format with black for: ${{ needs.check_changes.outputs.files }}" | |
| black --check ${{ needs.check_changes.outputs.files }} | |
| # Type checking with mypy | |
| - name: Type check with mypy | |
| if: ${{ matrix.tool == 'mypy' }} | |
| id: mypy | |
| run: | | |
| echo "Type checking: ${{ needs.check_changes.outputs.files }}" | |
| mypy --ignore-missing-imports ${{ needs.check_changes.outputs.files }} | |
| # Run tests with pytest using our Python script | |
| - name: Run tests with pytest | |
| if: ${{ matrix.tool == 'pytest' }} | |
| id: pytest | |
| run: | | |
| .github/scripts/run_tests.py "${{ needs.check_changes.outputs.files }}" | |
| # Check Python version compatibility | |
| - name: Check Python version compatibility | |
| if: ${{ matrix.tool == 'pyupgrade' }} | |
| id: pyupgrade | |
| run: pyupgrade --py312-plus ${{ needs.check_changes.outputs.files }} | |
| # Run tox using our Python script | |
| - name: Run tox | |
| if: ${{ matrix.tool == 'tox' }} | |
| id: tox | |
| run: | | |
| echo "Running tox integration for changed files..." | |
| .github/scripts/generate_tox_config.py "${{ needs.check_changes.outputs.files }}" | |
| tox -c tox_pr.ini | |
| summary: | |
| needs: [check_changes, lint] | |
| # Run summary in all cases, regardless of whether lint job ran | |
| if: ${{ always() }} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Summarize results | |
| run: | | |
| chmod +x .github/scripts/generate_summary.py | |
| .github/scripts/generate_summary.py "${{ needs.check_changes.outputs.has_python_changes }}" |