Merge pull request #385 from GeospatialPython/vendor_pre_commit_action #144
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
| # This workflow will run the pre-commit hooks (including linters), and the tests with a variety of Python versions | |
| name: Run pre-commit hooks and tests | |
| on: | |
| push: | |
| pull_request: | |
| workflow_call: | |
| workflow_dispatch: | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| #################################################################### | |
| # "this action is in maintenance-only mode and will not be accepting new features." | |
| # - uses: pre-commit/action@v3.0.1 | |
| # | |
| # pre-commit/action does not intend to bump actions/cache from @v4: | |
| # https://github.com/pre-commit/action/issues/241 | |
| # and has been stuck at @v3.0.1 for 2 years | |
| # | |
| # To bump actions/cache to v5 (to avoid the nuisance Node 20 deprecation | |
| # warning) the action is vendored below: | |
| # | |
| # Copyright (c) 2019 Anthony Sottile. MIT License. | |
| - run: python -m pip install pre-commit | |
| shell: bash | |
| - run: python -m pip freeze --local | |
| shell: bash | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
| - run: pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }} | |
| shell: bash | |
| # | |
| # | |
| ##################################################################### | |
| mypy-strict: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Install mypy | |
| run: pip install mypy | |
| - name: Run mypy --strict | |
| run: mypy --strict ./src/shapefile.py | |
| build_wheel_and_sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Build wheel from the project repo | |
| uses: ./.github/actions/build_wheel_and_sdist | |
| test_on_all_platforms: | |
| needs: build_wheel_and_sdist | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [ | |
| "3.9", | |
| "3.10", | |
| "3.11", | |
| "3.12", | |
| "3.13", | |
| "3.14", | |
| "3.15-dev", | |
| ] | |
| os: [ | |
| "macos-latest", | |
| "ubuntu-24.04", | |
| "windows-latest", | |
| ] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions/checkout@v6 | |
| with: | |
| path: ./Pyshp | |
| - name: Non-network tests | |
| uses: ./Pyshp/.github/actions/test | |
| with: | |
| pyshp_repo_directory: ./Pyshp | |
| - name: Network tests | |
| uses: ./Pyshp/.github/actions/test | |
| with: | |
| extra_args: '-m network' | |
| replace_remote_urls_with_localhost: 'yes' | |
| # Checkout to ./PyShp, as the test job also needs to check out the artefact repo | |
| pyshp_repo_directory: ./Pyshp |