Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
  • Loading branch information
rissson committed Nov 5, 2024
0 parents commit f9866e6
Show file tree
Hide file tree
Showing 53 changed files with 4,436 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[doc.extern-map.registries]
crates-io = "https://docs.rs/"
3 changes: 3 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
avoid-breaking-exported-api = true
disallowed-types = ["std::collections::HashMap", "std::collections::HashSet"]
msrv = "1.77"
19 changes: 19 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
layout_poetry() {
if [[ ! -f pyproject.toml ]]; then
log_error 'No pyproject.toml found. Use `poetry new` or `poetry init` to create one first.'
exit 2
fi

local VENV=$(poetry run poetry env info --path)
if [[ -z $VENV || ! -d $VENV/bin ]]; then
log_error 'No poetry virtual environment found. Use `poetry install` to create one first.'
exit 2
fi

export VIRTUAL_ENV=$VENV
export POETRY_ACTIVE=1
PATH_add "$VENV/bin"
}

use flake
layout_poetry
217 changes: 217 additions & 0 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
---
name: Python CI

"on":
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main

env:
DEBIAN_FRONTEND: noninteractive

jobs:
lint:
strategy:
fail-fast: false
matrix:
job:
- black
- mypy
- ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install poetry || true
- uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
cache: "poetry"
- run: poetry install --only=dev
- uses: taiki-e/install-action@v2
with:
tool: just
- run: poetry run just ci-lint-${{ matrix.job }}
build:
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: pipx install poetry || true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- run: poetry install --only=dev
- uses: taiki-e/install-action@v2
with:
tool: just
- run: poetry run just ci-build-python
- uses: actions/upload-artifact@v4
with:
name: python-${{ matrix.python-version }}-build
path: dist
test:
needs: build
strategy:
fail-fast: false
matrix:
job:
- mit
# Several issues in k5test preventing us from running kadmind with it currently
# - h5l
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
runs-on: ubuntu-latest
env:
KRB5_TRACE: /dev/stderr
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
pipx install poetry || true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- run: poetry install --only=test
- uses: taiki-e/install-action@v2
with:
tool: just
- uses: actions/download-artifact@v4
with:
name: python-${{ matrix.python-version }}-build
path: dist
- run: |
PATH="/usr/lib/heimdal-servers:$PATḦ" poetry run just ci-test-python-${{ matrix.job }}
check:
if: always()
needs:
- lint
- build
- test
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
build-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pipx install poetry || true
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
cache: "poetry"
- run: poetry install --only=dev
- uses: taiki-e/install-action@v2
with:
tool: just
- run: poetry run just ci-build-python-sdist
- uses: actions/upload-artifact@v4
with:
name: python-cibw-sdist
path: dist/*.tar.gz
build-wheels-matrix:
# needs:
# - check
# - build
# - test
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pipx install poetry || true
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
cache: "poetry"
- run: poetry install --only=dev
- id: set-matrix
name: compute matrix
run: |
MATRIX="$(
{
cibuildwheel --print-build-identifiers --platform linux --archs x86_64,aarch64,ppc64le,s390x \
| sed 's/.*/{"cibw-only": "&", "os": "ubuntu-latest"}/' \
&& cibuildwheel --print-build-identifiers --platform macos --archs x86_64 \
| sed 's/.*/{"cibw-only": "&", "os": "macos-13" }/' \
&& cibuildwheel --print-build-identifiers --platform macos --archs arm64 \
| sed 's/.*/{"cibw-only": "&", "os": "macos-14" }/' \
} | 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 }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-qemu-action@v3
if: runner.os == 'Linux'
with:
platforms: all
- uses: pypa/[email protected]
env:
CIBW_BUILD: "${{ matrix.cibw-only }}"
CIBW_BEFORE_ALL_LINUX: "curl -sSf https://sh.rustup.rs | sh -s -- -y && yum install -y krb5-devel clang-devel"
CIBW_BEFORE_ALL_MACOS: "curl -sSf https://sh.rustup.rs | sh -s -- -y && brew install llvm krb5"
CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH"
CIBW_ENVIRONMENT_MACOS: "PKG_CONFIG_PATH=/opt/homebrew/opt/krb5/lib/pkgconfig:/usr/local/opt/krb5/lib/pkgconfig MACOSX_DEPLOYMENT_TARGET=14.0"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_PPC64LE_IMAGE: manylinux_2_28
CIBW_MANYLINUX_S390X_IMAGE: manylinux_2_28
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux_2_28
- uses: actions/upload-artifact@v4
with:
name: python-cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
release:
needs:
- check
- build-sdist
- build-wheels
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/python-kadmin-rs/version/')
steps:
- uses: actions/download-artifact@v4
with:
pattern: python-cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
120 changes: 120 additions & 0 deletions .github/workflows/ci-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
---
name: Rust CI

"on":
push:
branches:
- main
pull_request:
branches:
- main

env:
DEBIAN_FRONTEND: noninteractive

jobs:
lint:
strategy:
fail-fast: false
matrix:
job:
- clippy
include:
- job: rustfmt
toolchain: nightly
components: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- if: ${{ matrix.toolchain }}
name: Setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
components: ${{ matrix.components }}
- if: ${{ ! matrix.toolchain }}
name: Setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@v2
with:
tool: just
- name: Lint
run: just ci-lint-${{ matrix.job }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@v2
with:
tool: just
- name: Build
run: just ci-build-rust
test:
strategy:
fail-fast: false
matrix:
job:
- rust
- sanity
runs-on: ubuntu-latest
env:
KRB5_TRACE: /dev/stderr
steps:
- uses: actions/checkout@v4
- name: Install poetry & deps
shell: bash
run: |
pipx install poetry || true
- name: Setup python and restore poetry
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
cache: "poetry"
- name: Install Python dependencies
run: poetry install --only=test
- name: Setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@v2
with:
tool: just
- name: Test
run: poetry run just ci-test-${{ matrix.job }}
check:
if: always()
needs:
- lint
- build
- test
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
release:
needs:
- check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- crate: kadmin-sys
extra_args: "--no-verify"
- crate: kadmin
extra_args: ""
if: github.event_name == 'push' && startsWith(github.ref, format('refs/tags/{0}/version/', matrix.crate))
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@v2
with:
tool: just
- run: just ci-build-deps
- run: cargo publish --package ${{ matrix.crate }} ${{ matrix.extra_args }}
Loading

0 comments on commit f9866e6

Please sign in to comment.