From e2bae616f84aab8e6d5e173fc5363370d7680dc6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 7 Feb 2024 17:23:03 +0800 Subject: [PATCH] rtd update --- .github/workflows/ci.yml | 16 ++++++++-------- docs/build.sh | 18 ++++++++++++++++++ docs/docker.sh | 16 ++++++++++++++++ 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100755 docs/build.sh create mode 100755 docs/docker.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5babbfe3a..75a06e393 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,17 +139,17 @@ jobs: ./bin/build.sh - # test-docs: + test-docs: - # needs: [ test-minimal-python ] - # runs-on: ubuntu-latest + needs: [ test-minimal-python ] + runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 + steps: + - uses: actions/checkout@v4 - # - name: Test building docs - # run: | - # # cd docs && ./docker.sh + - name: Test building docs + run: | + # cd docs && ./docker.sh # test-readme: diff --git a/docs/build.sh b/docs/build.sh new file mode 100755 index 000000000..2927a26dd --- /dev/null +++ b/docs/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -ex + +EXCLUDES="../setup.py +echo "SKIPPING " $EXCLUDES +sphinx-apidoc -o source .. $EXCLUDES + +make clean +make html SPHINXOPTS="-W --keep-going -n" +make latexpdf SPHINXOPTS="-W --keep-going -n" +make epub SPHINXOPTS="-W --keep-going -n" + +PLATFORM=`uname` +if [[ "$PLATFORM" == "Darwin" ]] +then + echo "Opening in Darwin.." + open build/html/index.html +fi diff --git a/docs/docker.sh b/docs/docker.sh new file mode 100755 index 000000000..e6b03dcda --- /dev/null +++ b/docs/docker.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -ex + +mkdir -p build + +RUN_INSTALLS="(cp -r /data /cu_cat && cd /cu_cat && python -m pip install -e .[docs,build] )" +RUN_SPHINX="cd /data/docs && ./build.sh || ( echo 'Printing /tmp/sphinx*' && ( cat /tmp/sphinx* || echo no err_file ) && exit 1 )" + +#TODO make a docker layer so we can cache RUN_INSTALLS +docker run \ + --entrypoint=/bin/bash \ + --rm \ + -e USER_ID=$UID \ + -v $(pwd)/..:/data \ + ddidier/sphinx-doc:3.4.3-1 \ + -c "${RUN_INSTALLS} && ${RUN_SPHINX}"