Skip to content

Commit

Permalink
pyauditor docs test
Browse files Browse the repository at this point in the history
  • Loading branch information
dirksammel committed Nov 2, 2023
1 parent 9cd2faf commit ca86889
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/pyauditor_docs.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 12 additions & 5 deletions scripts/docs_pyauditor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ca86889

Please sign in to comment.