| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches-ignore: |
| 6 |
- "wip*" |
| 7 |
tags: |
| 8 |
- "v*" |
| 9 |
pull_request: |
| 10 |
schedule: |
| 11 |
# Daily at 3:21 |
| 12 |
- cron: "21 3 * * *" |
| 13 |
workflow_dispatch: |
| 14 |
|
| 15 |
permissions: {} |
| 16 |
|
| 17 |
jobs: |
| 18 |
list: |
| 19 |
runs-on: ubuntu-latest |
| 20 |
outputs: |
| 21 |
noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }} |
| 22 |
steps: |
| 23 |
- uses: actions/checkout@v6 |
| 24 |
with: |
| 25 |
persist-credentials: false |
| 26 |
- name: Set up uv |
| 27 |
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 |
| 28 |
with: |
| 29 |
enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning] |
| 30 |
- id: noxenvs-matrix |
| 31 |
run: | |
| 32 |
echo >>$GITHUB_OUTPUT noxenvs=$( |
| 33 |
uvx nox --list-sessions --json | jq '[.[].session]' |
| 34 |
) |
| 35 |
|
| 36 |
ci: |
| 37 |
needs: list |
| 38 |
runs-on: ${{ matrix.os }} |
| 39 |
|
| 40 |
strategy: |
| 41 |
fail-fast: false |
| 42 |
matrix: |
| 43 |
os: [macos-latest, ubuntu-latest, windows-latest] |
| 44 |
noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }} |
| 45 |
posargs: [""] |
| 46 |
include: |
| 47 |
- os: ubuntu-latest |
| 48 |
noxenv: "tests-3.14(format)" |
| 49 |
posargs: coverage github |
| 50 |
- os: ubuntu-latest |
| 51 |
noxenv: "tests-3.14(no-extras)" |
| 52 |
posargs: coverage github |
| 53 |
exclude: |
| 54 |
- os: macos-latest |
| 55 |
noxenv: "docs(dirhtml)" |
| 56 |
- os: macos-latest |
| 57 |
noxenv: "docs(doctest)" |
| 58 |
- os: macos-latest |
| 59 |
noxenv: "docs(linkcheck)" |
| 60 |
- os: macos-latest |
| 61 |
noxenv: "docs(man)" |
| 62 |
- os: macos-latest |
| 63 |
noxenv: "docs(spelling)" |
| 64 |
- os: macos-latest |
| 65 |
noxenv: "docs(style)" |
| 66 |
- os: windows-latest |
| 67 |
noxenv: "docs(dirhtml)" |
| 68 |
- os: windows-latest |
| 69 |
noxenv: "docs(doctest)" |
| 70 |
- os: windows-latest |
| 71 |
noxenv: "docs(linkcheck)" |
| 72 |
- os: windows-latest |
| 73 |
noxenv: "docs(spelling)" |
| 74 |
- os: windows-latest |
| 75 |
noxenv: "docs(style)" |
| 76 |
- os: windows-latest |
| 77 |
noxenv: "tests-3.14(no-extras)" |
| 78 |
- os: windows-latest |
| 79 |
noxenv: "tests-3.14(format)" |
| 80 |
- os: windows-latest |
| 81 |
noxenv: "tests-3.14(format-nongpl)" |
| 82 |
- os: windows-latest |
| 83 |
noxenv: "tests-3.14t(no-extras)" |
| 84 |
- os: windows-latest |
| 85 |
noxenv: "tests-3.14t(format)" |
| 86 |
- os: windows-latest |
| 87 |
noxenv: "tests-3.14t(format-nongpl)" |
| 88 |
|
| 89 |
steps: |
| 90 |
- uses: actions/checkout@v6 |
| 91 |
with: |
| 92 |
persist-credentials: false |
| 93 |
- name: Install dependencies |
| 94 |
run: sudo apt-get update && sudo apt-get install -y libenchant-2-dev |
| 95 |
if: runner.os == 'Linux' && startsWith(matrix.noxenv, 'docs') |
| 96 |
- name: Install dependencies |
| 97 |
run: brew install enchant |
| 98 |
if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs') |
| 99 |
- name: Set up Python |
| 100 |
uses: actions/setup-python@v6 |
| 101 |
with: |
| 102 |
python-version: | |
| 103 |
3.10 |
| 104 |
3.11 |
| 105 |
3.12 |
| 106 |
3.13 |
| 107 |
3.14 |
| 108 |
3.14t |
| 109 |
pypy3.11 |
| 110 |
allow-prereleases: true |
| 111 |
- name: Enable UTF-8 on Windows |
| 112 |
run: echo "PYTHONUTF8=1" >> $env:GITHUB_ENV |
| 113 |
if: runner.os == 'Windows' && startsWith(matrix.noxenv, 'tests') |
| 114 |
|
| 115 |
- name: Set up uv |
| 116 |
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 |
| 117 |
with: |
| 118 |
enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning] |
| 119 |
|
| 120 |
- name: Run nox |
| 121 |
run: uvx nox -s "${{ matrix.noxenv }}" -- ${{ matrix.posargs }} # zizmor: ignore[template-injection] |
| 122 |
|
| 123 |
packaging: |
| 124 |
needs: ci |
| 125 |
runs-on: ubuntu-latest |
| 126 |
environment: |
| 127 |
name: PyPI |
| 128 |
url: https://pypi.org/p/jsonschema |
| 129 |
|
| 130 |
permissions: |
| 131 |
contents: write |
| 132 |
id-token: write |
| 133 |
|
| 134 |
steps: |
| 135 |
- uses: actions/checkout@v6 |
| 136 |
with: |
| 137 |
fetch-depth: 0 |
| 138 |
persist-credentials: false |
| 139 |
- name: Set up uv |
| 140 |
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 |
| 141 |
with: |
| 142 |
enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning] |
| 143 |
|
| 144 |
- name: Build our distributions |
| 145 |
run: uv run --frozen --with 'build[uv]' -m build --installer=uv |
| 146 |
|
| 147 |
- name: Publish to PyPI |
| 148 |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 149 |
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e |
| 150 |
- name: Create a GitHub Release |
| 151 |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 152 |
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b |
| 153 |
with: |
| 154 |
files: | |
| 155 |
dist/* |
| 156 |
generate_release_notes: true |