| 1 |
--- |
| 2 |
name: CI |
| 3 |
|
| 4 |
on: |
| 5 |
push: |
| 6 |
branches: ["master"] |
| 7 |
pull_request: |
| 8 |
branches: ["master"] |
| 9 |
workflow_dispatch: |
| 10 |
|
| 11 |
permissions: |
| 12 |
contents: read |
| 13 |
|
| 14 |
jobs: |
| 15 |
tests: |
| 16 |
name: "Python ${{ matrix.python-version }} on ${{ matrix.platform }}" |
| 17 |
runs-on: "${{ matrix.platform }}" |
| 18 |
env: |
| 19 |
USING_COVERAGE: '3.9' |
| 20 |
|
| 21 |
strategy: |
| 22 |
fail-fast: false |
| 23 |
matrix: |
| 24 |
platform: ["ubuntu-latest", "windows-latest"] |
| 25 |
python-version: |
| 26 |
- "3.9" |
| 27 |
- "3.10" |
| 28 |
- "3.11" |
| 29 |
- "3.12" |
| 30 |
- "3.13" |
| 31 |
- "3.14" |
| 32 |
- "pypy3.9" |
| 33 |
- "pypy3.10" |
| 34 |
- "pypy3.11" |
| 35 |
|
| 36 |
steps: |
| 37 |
- uses: "actions/checkout@v6" |
| 38 |
- uses: "actions/setup-python@v6" |
| 39 |
|
| 40 |
with: |
| 41 |
python-version: "${{ matrix.python-version }}" |
| 42 |
allow-prereleases: true |
| 43 |
|
| 44 |
- name: "Install dependencies" |
| 45 |
run: | |
| 46 |
python -VV |
| 47 |
python -m site |
| 48 |
python -m pip install --upgrade pip setuptools wheel |
| 49 |
python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions |
| 50 |
|
| 51 |
- name: "Run tox targets for ${{ matrix.python-version }}" |
| 52 |
run: "python -m tox" |
| 53 |
|
| 54 |
# We always use a modern Python version for combining coverage to prevent |
| 55 |
# parsing errors in older versions for modern code. |
| 56 |
- uses: "actions/setup-python@v6" |
| 57 |
with: |
| 58 |
python-version: "3.9" |
| 59 |
|
| 60 |
- name: "Combine coverage" |
| 61 |
run: | |
| 62 |
set -xe |
| 63 |
python -m pip install coverage[toml] |
| 64 |
python -m coverage combine |
| 65 |
python -m coverage xml |
| 66 |
if: "contains(env.USING_COVERAGE, matrix.python-version) && matrix.platform == 'ubuntu-latest'" |
| 67 |
|
| 68 |
- name: "Upload coverage to Codecov" |
| 69 |
if: "contains(env.USING_COVERAGE, matrix.python-version) && matrix.platform == 'ubuntu-latest'" |
| 70 |
uses: "codecov/codecov-action@v5" |
| 71 |
with: |
| 72 |
fail_ci_if_error: true |
| 73 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 74 |
verbose: true |
| 75 |
|
| 76 |
package: |
| 77 |
name: "Build & verify package" |
| 78 |
runs-on: "ubuntu-latest" |
| 79 |
|
| 80 |
steps: |
| 81 |
- uses: "actions/checkout@v6" |
| 82 |
- uses: "actions/setup-python@v6" |
| 83 |
|
| 84 |
with: |
| 85 |
python-version: "3.9" |
| 86 |
|
| 87 |
- name: "Install build and twine" |
| 88 |
run: "python -m pip install build twine" |
| 89 |
|
| 90 |
- name: "Build package" |
| 91 |
run: "python -m build" |
| 92 |
|
| 93 |
- name: "List result" |
| 94 |
run: "ls -l dist" |
| 95 |
|
| 96 |
- name: "Check long_description" |
| 97 |
run: "python -m twine check dist/*" |
| 98 |
|
| 99 |
install-dev: |
| 100 |
strategy: |
| 101 |
matrix: |
| 102 |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] |
| 103 |
python-version: ["3.9", "3.13"] |
| 104 |
|
| 105 |
name: "Verify dev env (Python ${{ matrix.python-version }}, ${{ matrix.os }})" |
| 106 |
runs-on: "${{ matrix.os }}" |
| 107 |
|
| 108 |
steps: |
| 109 |
- uses: "actions/checkout@v6" |
| 110 |
- uses: "actions/setup-python@v6" |
| 111 |
|
| 112 |
with: |
| 113 |
python-version: "${{ matrix.python-version }}" |
| 114 |
|
| 115 |
- name: "Install with no extras" |
| 116 |
run: "python -m pip install ." |
| 117 |
|
| 118 |
- name: "Import package" |
| 119 |
run: "python -c 'import jwt; print(jwt.__version__)'" |
| 120 |
|
| 121 |
- name: "Install with crypto extra" |
| 122 |
run: "python -m pip install .[crypto]" |
| 123 |
|
| 124 |
- name: "Import package with crypto" |
| 125 |
run: "python -c 'import jwt; print(jwt.__version__)'" |
| 126 |
|
| 127 |
- name: "Install in dev mode" |
| 128 |
run: "python -m pip install -e .[dev]" |
| 129 |
|
| 130 |
- name: "Import package in dev mode" |
| 131 |
run: "python -c 'import jwt; print(jwt.__version__)'" |