Skip to content

[pre-commit.ci] pre-commit autoupdate #2780

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #2780

Workflow file for this run

name: CI
on:
push:
branches-ignore:
- "wip*"
tags:
- "v*"
pull_request:
schedule:
# Daily at 8:33
- cron: "33 8 * * *"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
list:
name: List nox sessions
runs-on: ubuntu-latest
outputs:
noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
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: 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.14
posargs: coverage github
exclude:
- os: windows-latest
noxenv: "docs(style)"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: "recursive"
- 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: 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@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
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: Packaging
needs: ci
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/p/referencing
permissions:
contents: write # for creating GitHub releases
id-token: write # for PyPI trusted publishing
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: "recursive"
- name: Set up uv
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
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@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1
- name: Create a GitHub Release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
run: gh release create --generate-notes "$GITHUB_REF_NAME" dist/*
env:
GH_TOKEN: ${{ github.token }}