| name: CI |
| |
| on: |
| push: |
| branches-ignore: |
| - "wip*" |
| tags: |
| - "v*" |
| pull_request: |
| schedule: |
| # Daily at 3:21 |
| - cron: "21 3 * * *" |
| workflow_dispatch: |
| |
| permissions: {} |
| |
| jobs: |
| list: |
| runs-on: ubuntu-latest |
| outputs: |
| noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }} |
| steps: |
| - uses: actions/checkout@v4 |
| with: |
| persist-credentials: false |
| - name: Set up uv |
| uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba |
| with: |
| enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning] |
| - id: noxenvs-matrix |
| run: | |
| echo >>$GITHUB_OUTPUT noxenvs=$( |
| uvx nox --list-sessions --json | jq '[.[].session]' |
| ) |
| |
| ci: |
| needs: list |
| runs-on: ${{ matrix.os }} |
| |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [macos-latest, ubuntu-latest, windows-latest] |
| noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }} |
| posargs: [""] |
| include: |
| - os: ubuntu-latest |
| noxenv: "tests-3.13(format)" |
| posargs: coverage github |
| - os: ubuntu-latest |
| noxenv: "tests-3.13(no-extras)" |
| posargs: coverage github |
| exclude: |
| - os: macos-latest |
| noxenv: "docs(dirhtml)" |
| - os: macos-latest |
| noxenv: "docs(doctest)" |
| - os: macos-latest |
| noxenv: "docs(linkcheck)" |
| - os: macos-latest |
| noxenv: "docs(man)" |
| - os: macos-latest |
| noxenv: "docs(spelling)" |
| - os: macos-latest |
| noxenv: "docs(style)" |
| - os: windows-latest |
| noxenv: "docs(dirhtml)" |
| - os: windows-latest |
| noxenv: "docs(doctest)" |
| - os: windows-latest |
| noxenv: "docs(linkcheck)" |
| - os: windows-latest |
| noxenv: "docs(spelling)" |
| - os: windows-latest |
| noxenv: "docs(style)" |
| |
| steps: |
| - uses: actions/checkout@v4 |
| with: |
| persist-credentials: false |
| - name: Install dependencies |
| run: sudo apt-get update && sudo apt-get install -y libenchant-2-dev |
| if: runner.os == 'Linux' && startsWith(matrix.noxenv, 'docs') |
| - name: Install dependencies |
| run: brew install enchant |
| if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs') |
| - name: Set up Python |
| uses: actions/setup-python@v5 |
| with: |
| python-version: | |
| 3.9 |
| 3.10 |
| 3.11 |
| 3.12 |
| 3.13 |
| pypy3.11 |
| allow-prereleases: true |
| - name: Enable UTF-8 on Windows |
| run: echo "PYTHONUTF8=1" >> $env:GITHUB_ENV |
| if: runner.os == 'Windows' && startsWith(matrix.noxenv, 'tests') |
| |
| - name: Set up uv |
| uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba |
| with: |
| enable-cache: true |
| |
| - name: Run nox |
| run: uvx nox -s "${{ matrix.noxenv }}" -- ${{ matrix.posargs }} # zizmor: ignore[template-injection] |
| |
| packaging: |
| needs: ci |
| runs-on: ubuntu-latest |
| environment: |
| name: PyPI |
| url: https://pypi.org/p/jsonschema |
| |
| permissions: |
| contents: write |
| id-token: write |
| |
| steps: |
| - uses: actions/checkout@v4 |
| with: |
| fetch-depth: 0 |
| persist-credentials: false |
| - name: Set up uv |
| uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba |
| with: |
| enable-cache: true |
| |
| - name: Build our distributions |
| run: uv run --with 'build[uv]' -m build --installer=uv |
| |
| - name: Publish to PyPI |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc |
| - name: Create a GitHub Release |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 |
| with: |
| files: | |
| dist/* |
| generate_release_notes: true |