From d2af14c8e1653545e56bdb01ef772027fe06c363 Mon Sep 17 00:00:00 2001 From: "R. Kent James" Date: Sat, 13 Apr 2024 09:34:32 -0700 Subject: [PATCH 1/3] Run sphinx-build as a module, ensures pipx compatibility --- .github/workflows/test.yml | 19 ++++++++++++++++--- .../verbs/build/builders/sphinx_builder.py | 14 +++++--------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0792a38..e9419a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,14 +25,27 @@ jobs: - name: Install pip run: apt update && apt install -y python3-pip python3-pytest + - name: Install apt dependencies + run: apt update && apt install -y doxygen graphviz + + - name: Smoke test of pipx install + run: | + apt install -y pipx python3-sphinx + PATH="$HOME/.local/bin:$PATH" + pipx install . + rosdoc2 build -d tmp/docs_build -c /tmp/cross_references -o /tmp/docs_output -p test/packages/full_package + if [ ! -f /tmp/docs_output/full_package/index.html ]; then + echo "Failed to find any output from rosdoc2" + exit 2 + else + echo "rosdoc2 ran successfully under pipx" + fi + - name: Install pip dependencies run: | python3 -m pip install -U pycodestyle flake8 flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-import-order flake8-quotes python3 -m pip install .[test] python3 -m pip freeze - - name: Install apt dependencies - run: sudo apt update && sudo apt install -y doxygen graphviz - - name: Run tests run: python3 -m pytest --verbose test diff --git a/rosdoc2/verbs/build/builders/sphinx_builder.py b/rosdoc2/verbs/build/builders/sphinx_builder.py index 514bb9e..6de9931 100644 --- a/rosdoc2/verbs/build/builders/sphinx_builder.py +++ b/rosdoc2/verbs/build/builders/sphinx_builder.py @@ -19,6 +19,7 @@ import subprocess import setuptools +from sphinx.cmd.build import main as sphinx_main from ..builder import Builder from ..collect_inventory_files import collect_inventory_files @@ -550,17 +551,12 @@ def build(self, *, doc_build_folder, output_staging_directory): # Invoke Sphinx-build. sphinx_output_dir = os.path.abspath( os.path.join(wrapped_sphinx_directory, 'sphinx_output')) - cmd = [ - 'sphinx-build', - wrapped_sphinx_directory, - sphinx_output_dir, - ] logger.info( - f"Running Sphinx-build: '{' '.join(cmd)}' in '{wrapped_sphinx_directory}'" + f"Running sphinx_build with: [{wrapped_sphinx_directory}, '{sphinx_output_dir}]'" ) - completed_process = subprocess.run(cmd, cwd=wrapped_sphinx_directory) - msg = f"Sphinx-build exited with return code '{completed_process.returncode}'" - if completed_process.returncode == 0: + returncode = sphinx_main([wrapped_sphinx_directory, sphinx_output_dir]) + msg = f"sphinx_build exited with return code '{returncode}'" + if returncode == 0: logger.info(msg) else: raise RuntimeError(msg) From 394447d448df535014529ddc627707e82a9e7cb9 Mon Sep 17 00:00:00 2001 From: "R. Kent James" Date: Sun, 14 Apr 2024 16:00:44 -0700 Subject: [PATCH 2/3] Move pipx install to separate test --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e9419a2..9d9e716 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,36 @@ on: - main jobs: + install_tests: + name: Install check using pipx + runs-on: ubuntu-latest + strategy: + matrix: + container: ['ros:iron', 'ros:rolling'] + container: ${{ matrix.container }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pip + run: apt update && apt install -y python3-pip python3-pytest + + - name: Install apt dependencies + run: apt update && apt install -y doxygen graphviz pipx python3-sphinx + + - name: Smoke test of pipx install + run: | + PATH="$HOME/.local/bin:$PATH" + pipx install . + rosdoc2 build -d tmp/docs_build -c /tmp/cross_references -o /tmp/docs_output -p test/packages/full_package + if [ ! -f /tmp/docs_output/full_package/index.html ]; then + echo "Failed to find any output from rosdoc2" + exit 2 + else + echo "rosdoc2 ran successfully under pipx" + fi + unit_tests: name: Unit Tests runs-on: ubuntu-latest From b934ec2d4c426729df8a3e67cb472e13826693b0 Mon Sep 17 00:00:00 2001 From: "R. Kent James" Date: Mon, 15 Apr 2024 19:56:56 -0700 Subject: [PATCH 3/3] Remove redundant pipx test --- .github/workflows/test.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d9e716..46f2750 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,19 +58,6 @@ jobs: - name: Install apt dependencies run: apt update && apt install -y doxygen graphviz - - name: Smoke test of pipx install - run: | - apt install -y pipx python3-sphinx - PATH="$HOME/.local/bin:$PATH" - pipx install . - rosdoc2 build -d tmp/docs_build -c /tmp/cross_references -o /tmp/docs_output -p test/packages/full_package - if [ ! -f /tmp/docs_output/full_package/index.html ]; then - echo "Failed to find any output from rosdoc2" - exit 2 - else - echo "rosdoc2 ran successfully under pipx" - fi - - name: Install pip dependencies run: | python3 -m pip install -U pycodestyle flake8 flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-import-order flake8-quotes