CI #4257
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
| name: CI | |
| on: | |
| push: | |
| branches-ignore: | |
| - "wip*" | |
| tags: | |
| - "v*" | |
| pull_request: | |
| schedule: | |
| # Daily at 3:21 | |
| - cron: "21 3 * * *" | |
| workflow_dispatch: | |
| permissions: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| list: | |
| name: List nox sessions | |
| runs-on: ubuntu-latest | |
| outputs: | |
| noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b | |
| 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: | |
| name: Test | |
| 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.14(format)" | |
| posargs: coverage github | |
| - os: ubuntu-latest | |
| noxenv: "tests-3.14(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)" | |
| - os: windows-latest | |
| noxenv: "tests-3.14(no-extras)" | |
| - os: windows-latest | |
| noxenv: "tests-3.14(format)" | |
| - os: windows-latest | |
| noxenv: "tests-3.14(format-nongpl)" | |
| - os: windows-latest | |
| noxenv: "tests-3.14t(no-extras)" | |
| - os: windows-latest | |
| noxenv: "tests-3.14t(format)" | |
| - os: windows-latest | |
| noxenv: "tests-3.14t(format-nongpl)" | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| 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@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 | |
| with: | |
| python-version: | | |
| 3.10 | |
| 3.11 | |
| 3.12 | |
| 3.13 | |
| 3.14 | |
| 3.14t | |
| pypy-3.11-v7.3.22 | |
| 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@08807647e7069bb48b6ef5acd8ec9567f424441b | |
| with: | |
| enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning] | |
| - name: Run nox | |
| run: uvx nox -s "${{ matrix.noxenv }}" -- ${{ matrix.posargs }} # zizmor: ignore[template-injection] | |
| packaging: | |
| name: Build and publish | |
| needs: ci | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: PyPI | |
| url: https://pypi.org/p/jsonschema | |
| permissions: | |
| contents: write # for creating GitHub releases via `gh release create` | |
| id-token: write # for trusted publishing to PyPI | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b | |
| with: | |
| enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning] | |
| - name: Build our distributions | |
| run: uv run --frozen --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@cef221092ed1bacb1cc03d23a2d87d1d172e277b | |
| - name: Create a GitHub Release | |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release create "${GITHUB_REF_NAME}" dist/* --generate-notes |