From ca868894735d263d1dbfda66d93d817d141e6829 Mon Sep 17 00:00:00 2001 From: Dirk Sammel Date: Tue, 31 Oct 2023 14:51:00 +0100 Subject: [PATCH] pyauditor docs test --- .github/workflows/build_and_test.yml | 4 +++ .github/workflows/pyauditor_docs.yml | 48 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 6 ++-- scripts/docs_pyauditor.sh | 17 +++++++--- 4 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/pyauditor_docs.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 42d223d57..7773eed8b 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -42,6 +42,10 @@ jobs: with: python-version: ${{ matrix.python-version }} + pyauditor-docs: + needs: build-pyauditor-linux + uses: ./.github/workflows/pyauditor_docs.yml + release: if: "startsWith(github.ref, 'refs/tags/')" needs: [build-pyauditor-linux, build-pyauditor-windows, build-pyauditor-macos] diff --git a/.github/workflows/pyauditor_docs.yml b/.github/workflows/pyauditor_docs.yml new file mode 100644 index 000000000..6eec8bba8 --- /dev/null +++ b/.github/workflows/pyauditor_docs.yml @@ -0,0 +1,48 @@ +name: pyauditor-docs + +on: + workflow_call: + +jobs: + pyauditor-docs: + runs-on: ubuntu-latest + env: + SQLX_OFFLINE: true + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Set up toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Cache dependencies + uses: Swatinem/rust-cache@v2 + with: + prefix-key: cache-dependencies-docs + + - name: Download wheel + uses: actions/download-artifact@v3 + with: + name: pyauditor-wheels + + - name: Install pyauditor + run: | + pip install --upgrade pip + ls | grep manylinux | grep 39 | xargs pip install + + - name: Build pyauditor docs + run: CI_MODE=true SKIP_COMPILATION=true ./scripts/docs_pyauditor.sh + + - name: Deploy pyauditor docs + if: github.ref == 'refs/heads/main' + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: pyauditor/docs/_build/html + target-folder: pyauditor + token: ${{ secrets.GITHUB_TOKEN }} + clean: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa4b0f12e..ea432c815 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,11 +7,13 @@ jobs: release-pyauditor: runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v3 + - name: Download pyauditor wheels + uses: actions/download-artifact@v3 with: name: pyauditor-wheels - - uses: actions/setup-python@v4 + - name: Setup python + uses: actions/setup-python@v4 with: python-version: 3.9 diff --git a/scripts/docs_pyauditor.sh b/scripts/docs_pyauditor.sh index 2dd5e6509..0b8c01cbc 100755 --- a/scripts/docs_pyauditor.sh +++ b/scripts/docs_pyauditor.sh @@ -6,20 +6,27 @@ ENV_DIR=${ENV_DIR:=".env_test"} function make_docs() { cd pyauditor - python -m venv $ENV_DIR - source $ENV_DIR/bin/activate - pip install maturin + if [[ -z "${CI_MODE}" ]] + then + python -m venv $ENV_DIR + source $ENV_DIR/bin/activate + pip install --upgrade pip + fi + if [[ -z "${SKIP_COMPILATION}" ]] + then + pip install maturin + SQLX_OFFLINE=true maturin develop + fi pip install sphinx pip install sphinx_rtd_theme pip install myst-parser - SQLX_OFFLINE=true maturin develop cd docs make html } cleanup_exit() { setsid nohup bash -c " - rm -rf $ENV_DIR + rm -rf $ENV_DIR " } trap "cleanup_exit" SIGINT SIGQUIT SIGTERM EXIT