From 9fed4598cef3def44b4609cbb66a4578fe49c16d Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sun, 28 Nov 2021 22:51:10 +0100 Subject: [PATCH] Test if docs can build in CI --- .github/workflows/{linkcheck.yml => ci.yml} | 15 +++++++++++++-- ci/build-requirements.txt | 1 + ci/docker-build.sh | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) rename .github/workflows/{linkcheck.yml => ci.yml} (60%) create mode 100644 ci/build-requirements.txt create mode 100644 ci/docker-build.sh diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/ci.yml similarity index 60% rename from .github/workflows/linkcheck.yml rename to .github/workflows/ci.yml index 9ae100c..c4e978a 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: linkcheck +name: CI on: push: @@ -8,10 +8,21 @@ on: workflow_dispatch: jobs: - linkcheck: + build: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v2 + - name: Build docs + run: bash ci/docker-build.sh + + + linkcheck: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Verify links run: bash ci/docker-linkcheck.sh diff --git a/ci/build-requirements.txt b/ci/build-requirements.txt new file mode 100644 index 0000000..016bb16 --- /dev/null +++ b/ci/build-requirements.txt @@ -0,0 +1 @@ +mkdocs diff --git a/ci/docker-build.sh b/ci/docker-build.sh new file mode 100644 index 0000000..8d42682 --- /dev/null +++ b/ci/docker-build.sh @@ -0,0 +1,16 @@ +#! /bin/bash + +set -e +set -o pipefail +set -x + +this_dir="$(readlink -f -- "$(dirname -- "${BASH_SOURCE[0]}")")" +image="python:3-alpine" + +# as we use a pipe to stdin and thus cannot use -it, Ctrl-C does not work by default +# turns out that combining -i with --init solves that problem +# see https://stackoverflow.com/a/60812082 +docker run --rm -i -v "$this_dir"/..:/ws -w /ws --init "$image" sh <<\EOF + pip install -r ci/build-requirements.txt + mkdocs build +EOF