Update pre-commit hooks to lint pyproject.toml #1063
This file contains 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: CI | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
workflow_dispatch: | |
jobs: | |
tests: | |
name: "Python ${{ matrix.python-version }} on ${{ matrix.platform }}" | |
runs-on: "${{ matrix.platform }}" | |
env: | |
USING_COVERAGE: '3.8' | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: ["ubuntu-latest", "windows-latest"] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.8", "pypy3.9"] | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "actions/setup-python@v5" | |
with: | |
python-version: "${{ matrix.python-version }}" | |
allow-prereleases: true | |
- name: "Install dependencies" | |
run: | | |
python -VV | |
python -m site | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions | |
- name: "Run tox targets for ${{ matrix.python-version }}" | |
run: "python -m tox" | |
# We always use a modern Python version for combining coverage to prevent | |
# parsing errors in older versions for modern code. | |
- uses: "actions/setup-python@v5" | |
with: | |
python-version: "3.8" | |
- name: "Combine coverage" | |
run: | | |
set -xe | |
python -m pip install coverage[toml] | |
python -m coverage combine | |
python -m coverage xml | |
if: "contains(env.USING_COVERAGE, matrix.python-version) && matrix.platform == 'ubuntu-latest'" | |
- name: "Upload coverage to Codecov" | |
if: "contains(env.USING_COVERAGE, matrix.python-version) && matrix.platform == 'ubuntu-latest'" | |
uses: "codecov/codecov-action@v4" | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
package: | |
name: "Build & verify package" | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "actions/setup-python@v5" | |
with: | |
python-version: "3.8" | |
- name: "Install pep517 and twine" | |
run: "python -m pip install pep517 twine" | |
- name: "Build package" | |
run: "python -m pep517.build --source --binary ." | |
- name: "List result" | |
run: "ls -l dist" | |
- name: "Check long_description" | |
run: "python -m twine check dist/*" | |
install-dev: | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
name: "Verify dev env" | |
runs-on: "${{ matrix.os }}" | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "actions/setup-python@v5" | |
with: | |
python-version: "3.8" | |
- name: "Install in dev mode" | |
run: "python -m pip install -e .[dev]" | |
- name: "Import package" | |
run: "python -c 'import jwt; print(jwt.__version__)'" |