Sorting documentation builds (#1551)

* updating pykanidm to fix mypy issue
* removing mdbook-template requirement
This commit is contained in:
James Hodgkinson 2023-04-18 21:35:40 +10:00 committed by GitHub
parent ab49c7f21d
commit 90d4fe1d58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 205 additions and 62 deletions

View file

@ -16,6 +16,7 @@ jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Restore our cache
uses: actions/cache@v3
with:
@ -26,7 +27,6 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@v3
- name: Update package manager
run: sudo apt-get update
- name: Install dependencies

View file

@ -1,8 +1,7 @@
---
name: "Build Debian Packages"
# yamllint disable-line rule:truthy
on:
"on":
push:
pull_request:
@ -15,11 +14,11 @@ jobs:
strategy:
matrix:
image:
- ubuntu:22.04
- ubuntu:20.04
- ubuntu:18.04
- debian:11
- debian:10
- ubuntu:22.04
- ubuntu:20.04
- ubuntu:18.04
- debian:11
- debian:10
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}

View file

@ -1,4 +1,5 @@
---
# yamllint disable rule:line-length
name: Dependabot auto-approval and auto-merge
"on": pull_request
@ -9,7 +10,8 @@ permissions:
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }} # limit this to PRs opened by dependabot
# limit this to PRs opened by dependabot
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
@ -20,6 +22,7 @@ jobs:
compat-lookup: true
- uses: actions/checkout@v3
- name: Approve a PR if not already approved
run: |
# sets the upstream metadata for `gh pr status`
gh pr checkout "$PR_URL"

View file

@ -8,64 +8,121 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy_book:
generate_tags:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.tags.outputs.tags}}
latest: ${{ steps.previoustag.outputs.tag }}
steps:
- id: tags
name: pull tags
uses: oraad/get-tags-action@v1.0.0
with:
repo: ${{ github.repository }}
limit: 100
- uses: actions/checkout@v3
with:
fetch-depth: 0
clean: false
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y clang build-essential \
librust-openssl-dev libssl-dev \
libsqlite3-dev libudev-dev \
libpam0g-dev
- name: Setup deno
# Documentation: https://github.com/denoland/setup-deno
uses: denoland/setup-deno@v1
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
deno-version: v1.x
prefix: v1
fanout:
uses: './.github/workflows/kanidm_individual_book.yml'
needs: generate_tags
- name: Test document formatting
run: |
make doc/format
strategy:
fail-fast: false
matrix:
# tag: ${{ fromJson(needs.generate_tags.outputs.tags) }}
tag:
- ${{ needs.generate_tags.outputs.latest}}
with:
tag: ${{ matrix.tag }}
parent_id: ${{ github.ref }}
docs_master:
uses: './.github/workflows/kanidm_individual_book.yml'
with:
tag: "master"
parent_id: ${{ github.ref }}
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
deploy:
needs:
- fanout
- docs_master
- generate_tags
runs-on: ubuntu-latest
steps:
- name: Download previously built docs
uses: actions/download-artifact@v3
with:
mdbook-version: "latest"
name: docs
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Extract the files
run: |
find . -name '*.tar.gz' -exec tar zxf "{}" \;
ls -la docs/
cd docs && ln -s ${{ needs.generate_tags.outputs.latest}}/ stable && cd ..
ls -la docs/
- uses: actions-rs/cargo@v1
with:
command: install
args: mdbook-template
- name: Make all the books
run: ./scripts/build_all_the_docs.sh
- name: Install python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# clean: false
- name: pykanidm docs
run: |
python -m pip install poetry
make docs/pykanidm/build
mv pykanidm/site ./docs/pykanidm
# - name: Install deps
# run: |
# sudo apt-get update
# sudo apt-get install -y clang build-essential \
# librust-openssl-dev libssl-dev \
# libsqlite3-dev libudev-dev \
# libpam0g-dev
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
destination_dir: ./docs
# - name: Setup deno
# # Documentation: https://github.com/denoland/setup-deno
# uses: denoland/setup-deno@v1
# with:
# deno-version: v1.x
# - name: Test document formatting
# run: |
# make doc/format
# - name: Setup mdBook
# uses: peaceiris/actions-mdbook@v1
# with:
# mdbook-version: "latest"
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# - uses: actions-rs/cargo@v1
# with:
# command: install
# args: mdbook-template
# - name: Make all the books
# run: ./scripts/build_all_the_docs.sh
# - name: Install python 3.10
# uses: actions/setup-python@v4
# with:
# python-version: "3.10"
# - name: pykanidm docs
# run: |
# python -m pip install poetry
# make docs/pykanidm/build
# mv pykanidm/site ./docs/pykanidm
# - name: Deploy
# uses: peaceiris/actions-gh-pages@v3
# if: ${{ github.ref == 'refs/heads/master' }}
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./docs
# destination_dir: ./docs

View file

@ -0,0 +1,83 @@
---
name: "Github Pages - Branch"
"on":
workflow_call:
inputs:
# the target tag for generating things
tag:
required: true
type: string
# the parent workflow for caching
parent_id:
required: true
type: string
jobs:
generate_mdbook:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.tag }}
- name: Restore our cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y clang build-essential \
librust-openssl-dev libssl-dev \
libsqlite3-dev libudev-dev \
libpam0g-dev
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "latest"
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build the docs
run: |
cargo doc --no-deps
mdbook build *book
rm -rf ./docs/
mkdir -p ./docs/${{ inputs.tag }}/rustdoc/
mv ./*book/book/ ./docs/${{ inputs.tag }}
mv ./target/doc/* ./docs/${{ inputs.tag }}/rustdoc/
- name: pykanidm docs
run: |
python -m pip install poetry
cd pykanidm
poetry install
poetry run mkdocs build
cd ..
mv pykanidm/site ./docs/${{ inputs.tag }}/pykanidm
continue-on-error: true
- name: archive things
run: |
tar czvf ${{ inputs.tag }}.tar.gz ./docs/
- name: Upload artifact
# https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v1
with:
name: docs
path: ${{inputs.tag }}.tar.gz

View file

@ -48,4 +48,5 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
# yamllint disable-line rule:line-length
args: -p kanidm_client -p kanidm_tools -p orca -p daemon -p kanidmd_core

View file

@ -63,7 +63,7 @@ build-backend = "poetry.core.masonry.api"
[tool.pylint.MASTER]
max-line-length=150
disable="W0511,raise-missing-from"
extension-pkg-whitelist="pydantic"
extension-pkg-allow-list="pydantic"
# https://github.com/samuelcolvin/pydantic/issues/1961#issuecomment-759522422
load-plugins="pylint_pydantic,pylint_pytest"
@ -87,3 +87,6 @@ markers = [
[tool.coverage.run]
source = ["kanidm"]
omit = ["tests"]
[tool.mypy]
plugins = "pydantic.mypy"

View file

@ -22,13 +22,13 @@ def test_auth_init_response() -> None:
def test_radiusgroup_vlan_negative() -> None:
"""tests RadiusGroup's vlan validator"""
with pytest.raises(pydantic.error_wrappers.ValidationError):
RadiusGroup(vlan=-1)
RadiusGroup(vlan=-1, spn="crabzrool@foo")
def test_radiusgroup_vlan_zero() -> None:
"""tests RadiusGroup's vlan validator"""
with pytest.raises(pydantic.error_wrappers.ValidationError):
RadiusGroup(vlan=0)
RadiusGroup(vlan=0, spn="crabzrool@foo")
def test_radiusgroup_vlan_4096() -> None:
@ -41,10 +41,7 @@ def test_radiusgroup_vlan_no_name() -> None:
with pytest.raises(
pydantic.error_wrappers.ValidationError, match="spn\n.*field required"
):
RadiusGroup(
vlan=4096,
)
RadiusGroup(vlan=4096) # type: ignore[call-arg]
def test_kanidmconfig_parse_toml() -> None:
"""tests KanidmClientConfig.parse_toml()"""