From 575bd2cc16edfbd43714959643705a67c31f18c8 Mon Sep 17 00:00:00 2001 From: Quentin Monnet Date: Tue, 15 Apr 2025 12:19:05 +0100 Subject: [PATCH] ci: Add CI job to check API ref doc build Make sure that the API reference builds with no warnings, before we attempt to synchronise it with the docs repo. Signed-off-by: Quentin Monnet --- .github/workflows/ci.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 173a1562d..6274742b4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -193,6 +193,37 @@ jobs: with: limit-access-to-actor: true + build-api-ref: + # To do: Run only if docs/api.md is changed, but checking changed files + # probably takes just as long as running this job. + runs-on: lab-h + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build API reference documentation + run: | + image_name='ghcr.io/githedgehog/hhdocs' + image_version='20241202' + image="${image_name}:${image_version}" + + # Create a new directory, copy docs/api.md + dir='./api-ref-build-test' + mkdir -p "${dir}/docs" + cp docs/api.md "${dir}/docs/" + + # Create minimal mkdocs.yml config file; warn on broken links + echo 'site_name: API Reference Build Test' > "${dir}/mkdocs.yml" + echo 'validation:' >> "${dir}/mkdocs.yml" + echo ' absolute_links: warn' >> "${dir}/mkdocs.yml" + echo ' unrecognized_links: warn' >> "${dir}/mkdocs.yml" + echo ' anchors: warn' >> "${dir}/mkdocs.yml" + + # Make sure that docs/api.md builds as HTML with no warnings + docker run --rm -v "${dir}":/docs "${image}" mkdocs build --strict + publish: runs-on: lab-h if: startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push'