From 3db15aa60753b8215d9823838ca36278a60cbb23 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 13 Jan 2025 20:27:52 +0100 Subject: [PATCH 1/3] Build documentation via tox To build the documentation, run `tox -e doc`. --- doc/.gitignore | 1 + {docs => doc}/Makefile | 0 {docs => doc}/changelog.rst | 0 {docs => doc}/conf.py | 2 +- {docs => doc}/contributing.rst | 0 {docs => doc}/faq.rst | 0 {docs => doc}/index.rst | 0 {docs => doc}/installation.rst | 0 {docs => doc}/license.rst | 0 {docs => doc}/make.bat | 0 {docs => doc}/preparation.rst | 0 {docs => doc}/usage.rst | 0 pyproject.toml | 13 ++++++++++++- 13 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 doc/.gitignore rename {docs => doc}/Makefile (100%) rename {docs => doc}/changelog.rst (100%) rename {docs => doc}/conf.py (96%) rename {docs => doc}/contributing.rst (100%) rename {docs => doc}/faq.rst (100%) rename {docs => doc}/index.rst (100%) rename {docs => doc}/installation.rst (100%) rename {docs => doc}/license.rst (100%) rename {docs => doc}/make.bat (100%) rename {docs => doc}/preparation.rst (100%) rename {docs => doc}/usage.rst (100%) diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 0000000..e35d885 --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1 @@ +_build diff --git a/docs/Makefile b/doc/Makefile similarity index 100% rename from docs/Makefile rename to doc/Makefile diff --git a/docs/changelog.rst b/doc/changelog.rst similarity index 100% rename from docs/changelog.rst rename to doc/changelog.rst diff --git a/docs/conf.py b/doc/conf.py similarity index 96% rename from docs/conf.py rename to doc/conf.py index 9172bce..c483c20 100644 --- a/docs/conf.py +++ b/doc/conf.py @@ -24,4 +24,4 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output html_theme = "alabaster" -html_static_path = ["_static"] +# html_static_path = ["_static"] diff --git a/docs/contributing.rst b/doc/contributing.rst similarity index 100% rename from docs/contributing.rst rename to doc/contributing.rst diff --git a/docs/faq.rst b/doc/faq.rst similarity index 100% rename from docs/faq.rst rename to doc/faq.rst diff --git a/docs/index.rst b/doc/index.rst similarity index 100% rename from docs/index.rst rename to doc/index.rst diff --git a/docs/installation.rst b/doc/installation.rst similarity index 100% rename from docs/installation.rst rename to doc/installation.rst diff --git a/docs/license.rst b/doc/license.rst similarity index 100% rename from docs/license.rst rename to doc/license.rst diff --git a/docs/make.bat b/doc/make.bat similarity index 100% rename from docs/make.bat rename to doc/make.bat diff --git a/docs/preparation.rst b/doc/preparation.rst similarity index 100% rename from docs/preparation.rst rename to doc/preparation.rst diff --git a/docs/usage.rst b/doc/usage.rst similarity index 100% rename from docs/usage.rst rename to doc/usage.rst diff --git a/pyproject.toml b/pyproject.toml index a9643e2..ec20dd9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,4 +27,15 @@ requires-python = ">=3.10" ccompass = "ccompass.CCMPS:main" [project.optional-dependencies] -dev = ["pre-commit>=3"] +dev = ["pre-commit>=3", "tox"] +doc = ["sphinx", "sphinx-rtd-theme"] + +[tool.tox] +requires = ["tox>=4.19"] +env_list = ["doc"] + +[tool.tox.env.doc] +description = "Build the documentation" +extras = ["doc"] +commands = [["sphinx-build", "-W", "-b", "html", "doc/", "doc/_build/html"]] +working_directory = "doc" From e6daf09df389a46109c720bef5b33eeeaae450a7 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 13 Jan 2025 20:30:08 +0100 Subject: [PATCH 2/3] test --- .github/workflows/ci.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 36ed6b9..f519c16 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,7 +70,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . + pip install -e .[dev] + + - name: Build documentation + run: | + tox -e docs - name: Launch C-COMPASS # Ensure that we can open the GUI From fc93abe5f021f9014b973e069089aa3d1f54e343 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 13 Jan 2025 20:36:34 +0100 Subject: [PATCH 3/3] separate job --- .github/workflows/ci.yaml | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f519c16..5ebf28c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,11 +70,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e .[dev] - - - name: Build documentation - run: | - tox -e docs + pip install -e . - name: Launch C-COMPASS # Ensure that we can open the GUI @@ -119,3 +115,31 @@ jobs: echo $! > ccompass_pid.txt sleep 10 kill $(cat ccompass_pid.txt) + + test_docs: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Cache tox + uses: actions/cache@v4 + with: + path: ~/.cache/tox + key: ${{ runner.os }}-tox-${{ hashFiles('pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-tox- + + - name: Install dependencies + run: | + pip install tox + + - name: Build documentation + run: | + tox -e doc