From e872bce3f5ee6d422fad3007ad49d4c777feda78 Mon Sep 17 00:00:00 2001 From: Gustavo Martins Date: Wed, 29 Nov 2023 18:32:50 -0300 Subject: [PATCH] Implement jobs to build and deploy docs ROCKY-20651 --- .github/workflows/ci_cd.yml | 53 ++++++++++++++++++++- pyproject.toml | 4 +- examples/run_examples.py => run_examples.py | 3 +- 3 files changed, 54 insertions(+), 6 deletions(-) rename examples/run_examples.py => run_examples.py (89%) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 266404d6..2825f353 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -11,6 +11,7 @@ env: MAIN_PYTHON_VERSION : '3.10' LIBRARY_NAME: 'ansys-rocky-core' DOCUMENTATION_CNAME: 'rocky.docs.pyansys.com' + DOC_DEPLOYMENT_IMAGE_TAG: v24.1.0 concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -47,7 +48,7 @@ jobs: run: | .venv/Scripts/activate.bat - python examples/run_examples.py + python run_examples.py - name: Test Report uses: dorny/test-reporter@v1 @@ -55,4 +56,52 @@ jobs: with: name: Pytest Report path: build/pytest.xml # Path to test results - reporter: java-junit \ No newline at end of file + reporter: java-junit + + docs_build: + name: Build Documentation + runs-on: [self-hosted, Windows, pyrocky] + env: + ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }} + + steps: + - uses: actions/checkout@v4 + + - name: "Install" + run: | + python -m venv .venv + .venv/Scripts/activate.bat + + pip install -e .[dev] + + - name: Build Source Documentation + run: | + .venv/Scripts/activate.bat + doc\make.bat html + + - name: Zip HTML Documentation before upload + run: | + cd doc\_build\html + Compress-Archive * ../../../HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip + + - name: Upload HTML Documentation + uses: actions/upload-artifact@v3 + with: + name: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }} + path: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip + retention-days: 7 + + + doc-deploy-dev: + name: "Deploy development documentation" + # Deploy development only when merging or pushing to the 'main' branch + if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') + runs-on: ubuntu-latest + needs: docs_build + steps: + - uses: ansys/actions/doc-deploy-dev@v4 + with: + doc-artifact-name: 'HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}' + decompress-artifact: true + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f36e1646..b15afcd9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,8 +24,8 @@ dependencies = [ "numpy >=1.19, <2.0", "ansys-sphinx-theme ==0.9.9", "numpydoc ==1.5.0", - "Sphinx ==6.2.1", - "sphinx-copybutton ==0.5.1", + "Sphinx ==7.2.6", + "sphinx-copybutton ==0.5.2", "sphinx-gallery ==0.14.0", "matplotlib ==3.8.2", # required by sphinx-gallery ] diff --git a/examples/run_examples.py b/run_examples.py similarity index 89% rename from examples/run_examples.py rename to run_examples.py index 5df23c8e..e644435e 100644 --- a/examples/run_examples.py +++ b/run_examples.py @@ -6,9 +6,8 @@ def run_examples() -> None: path = Path(os.path.realpath(__file__)) - examples_path = path.parent + examples_path = path.parent / "examples" example_files = list(examples_path.rglob("*.py")) - example_files.remove(path) example_failed = False for f in example_files: