name: CI on: push: branches: - main pull_request: permissions: write-all concurrency: group: ${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: lint: env: SKIP: no-commit-to-branch runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: persist-credentials: false - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 with: python-version: "3.14" # renovate: customPinnedDependency=python,datasource=python-version - uses: j178/prek-action@4e14d07f9231acabce116ccfca13b13dd9755ece # v3.0.0 # Make sure commit messages follow the conventional commits convention: # https://www.conventionalcommits.org commitlint: name: Lint Commit Messages runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: fetch-depth: 0 persist-credentials: false - uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1 test: strategy: fail-fast: false matrix: python-version: - "3.12" - "3.13" - "3.14" # renovate: depName=python datasource=python-version os: - ubuntu-latest - windows-latest - macOS-latest runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: persist-credentials: false - name: Set up Python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 with: python-version: ${{ matrix.python-version }} - name: Extract UV version run: | echo "UV_VERSION=$(./scripts/get-pyproject-uv.version.sh)" >> "$GITHUB_ENV" shell: bash - name: Setup UV uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 with: version: ${{ env.UV_VERSION }} - name: Verify lock consistency run: uv lock --check shell: bash - name: Sync Dependencies run: uv sync --frozen --all-groups shell: bash - name: Test with Pytest run: uv run pytest --cov-report=xml shell: bash - name: Upload coverage to Codecov uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7 with: token: ${{ secrets.CODECOV_TOKEN }} release: needs: - test - lint - commitlint runs-on: ubuntu-latest environment: release permissions: id-token: write contents: write steps: # Checkout must work for both PRs (including forks) and pushes to main - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: fetch-depth: 0 persist-credentials: false ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }} repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }} - name: Set up Python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 with: python-version: "3.14" # renovate: customPinnedDependency=python,datasource=python-version # Do a dry run of PSR - name: Test release uses: python-semantic-release/python-semantic-release@9a026e9303981c866c3425723009becb2437c757 # v10.6.2 if: github.event_name == 'pull_request' with: no_operation_mode: true vcs_release: false push: false tag: false github_token: ${{ github.token }} # On main branch: actual PSR + upload to PyPI & GitHub - name: Release uses: python-semantic-release/python-semantic-release@9a026e9303981c866c3425723009becb2437c757 # v10.6.2 id: release if: github.event_name == 'push' && github.ref_name == 'main' with: verbosity: 2 # equivalent to "-vv" github_token: ${{ secrets.GITHUB_TOKEN }} - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1 if: steps.release.outputs.released == 'true' with: packages-dir: dist - name: Publish package distributions to GitHub Releases uses: python-semantic-release/publish-action@6d89e2de8d40ecb3717316ecbbf15a6fa8ea9039 # v10.6.2 if: steps.release.outputs.released == 'true' with: github_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ steps.release.outputs.tag }}