kadmin 0.7.2

Rust bindings for the Kerberos administration interface (kadm5)
Documentation
---
name: Python CI

"on":
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
  release:
    types:
      - released

env:
  DEBIAN_FRONTEND: noninteractive
  CARGO_INCREMENTAL: "false"
  SCCACHE_GHA_ENABLED: "true"
  RUSTC_WRAPPER: "sccache"

jobs:
  lint:
    strategy:
      fail-fast: false
      matrix:
        job:
          - black
          - mypy
          - ruff
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v5
      - run: uv sync --all-groups
      - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
      - uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
      - uses: taiki-e/install-action@3fa6878dc4ae603f73960271565a082bf196ab96 # v2.77.2
        with:
          tool: just
      - run: just ci-lint-${{ matrix.job }}
  build:
    strategy:
      fail-fast: false
      matrix:
        python-version:
          - "3.11"
          - "pypy3.11"
          - "3.12"
          - "3.13"
          - "3.14"
          - "3.14t"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v5
        with:
          python-version: ${{ matrix.python-version }}
      - run: uv sync --all-groups
      - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
      - uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
      - uses: taiki-e/install-action@3fa6878dc4ae603f73960271565a082bf196ab96 # v2.77.2
        with:
          tool: just
      - run: just ci-build-python
      - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: python-${{ matrix.python-version }}-build
          path: target/wheels/
  test:
    needs: build
    strategy:
      fail-fast: false
      matrix:
        job:
          - mit
          # Several issues in k5test preventing us from running kadmind with it currently
          # - heimdal
        python-version:
          - "3.11"
          - "pypy3.11"
          - "3.12"
          - "3.13"
          - "3.14"
          - "3.14t"
    runs-on: ubuntu-latest
    env:
      KRB5_TRACE: /dev/stderr
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v5
        with:
          python-version: ${{ matrix.python-version }}
      - run: uv sync --all-groups
      - uses: taiki-e/install-action@3fa6878dc4ae603f73960271565a082bf196ab96 # v2.77.2
        with:
          tool: just
      - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          name: python-${{ matrix.python-version }}-build
          path: target/wheels/
      - run: |
          PATH="/usr/lib/heimdal-servers:$PATH" just ci-test-python-${{ matrix.job }}
  check-python:
    if: always()
    needs:
      - lint
      - build
      - test
    runs-on: ubuntu-latest
    steps:
      - uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
        with:
          jobs: ${{ toJSON(needs) }}
  build-sdist:
    needs: check-python
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 0
      - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v5
      - run: uv sync --all-groups
      - uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
      - uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
      - uses: taiki-e/install-action@3fa6878dc4ae603f73960271565a082bf196ab96 # v2.77.2
        with:
          tool: just
      - run: just ci-build-python-sdist
      - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: python-cibw-sdist
          path: dist
  build-wheels-matrix:
    needs: check-python
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 0
      - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v5
      - run: uv sync --all-groups
      - id: set-matrix
        name: compute matrix
        run: |
          MATRIX="$(
            {
              uv run cibuildwheel --print-build-identifiers --platform linux --archs x86_64 \
                | sed 's/.*/{"cibw-only": "&", "os": "ubuntu-latest"}/' \
              && uv run cibuildwheel --print-build-identifiers --platform linux --archs aarch64 \
                | sed 's/.*/{"cibw-only": "&", "os": "ubuntu-24.04-arm"}/' \
              && uv run cibuildwheel --print-build-identifiers --platform macos --archs x86_64 \
                | sed 's/.*/{"cibw-only": "&", "os": "macos-15-intel" }/' \
              && uv run cibuildwheel --print-build-identifiers --platform macos --archs arm64 \
                | sed 's/.*/{"cibw-only": "&", "os": "macos-latest" }/'
            } | jq --slurp --compact-output '{"include": .}'
          )"
          echo matrix="$MATRIX" >> "$GITHUB_OUTPUT"
  build-wheels:
    needs: build-wheels-matrix
    strategy:
      fail-fast: false
      matrix: ${{ fromJson(needs.build-wheels-matrix.outputs.matrix) }}
    runs-on: ${{ matrix.os }}
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 0
      - uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
        with:
          only: "${{ matrix.cibw-only }}"
        env:
          RUSTC_WRAPPER: ""
      - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: python-cibw-wheels-${{ matrix.cibw-only }}
          path: ./wheelhouse/*.whl
  merge-dist-artifacts:
    needs:
      - build-sdist
      - build-wheels
    runs-on: ubuntu-latest
    steps:
      - uses: actions/upload-artifact/merge@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: python-dist
          pattern: python-cibw-*
          delete-merged: false
  release:
    needs:
      - check-python
      - merge-dist-artifacts
    runs-on: ubuntu-latest
    environment: pypi
    permissions:
      id-token: write
    if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/kadmin/version/')
    steps:
      - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          pattern: python-cibw-*
          path: dist
          merge-multiple: true
      - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1