ammaraskar / sphinx-action

Github action that builds docs using sphinx and places errors inline
Apache License 2.0
189 stars 114 forks source link

Does not work with python3.10 #43

Open spagh-eddie opened 2 years ago

spagh-eddie commented 2 years ago

This syntax is causing the action to fail. The syntax is for python3.10.

# file.py

with (
    open(...) as f,  # this is line 119
    open(...) as g,
):
    do_cool_stuff()

error message:

[AutoAPI] Reading files... [ 26%] /github/workspace/.../file.py

Extension error (autoapi.extension):
Handler <function run_autoapi at 0x7f0ef2a43af0> for event 'builder-inited' threw an exception (exception: Parsing Python code failed:
invalid syntax (<unknown>, line 119))
make: *** [Makefile:20: html] Error 2
[sphinx-action] Starting sphinx-action build.
Running: 
====================================
Building docs in docs/
====================================
[sphinx-action] Running: ['make', 'html', '-e']
[sphinx-action] Build failed with 0 warnings
Traceback (most recent call last):
  File "/entrypoint.py", line 22, in <module>
    action.build_all_docs(github_env, [os.environ.get("INPUT_DOCS-FOLDER")])
  File "/sphinx_action/action.py", line 167, in build_all_docs
    raise RuntimeError("Build failed")
RuntimeError: Build failed

our action file:

name: Sphinx build

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Build HTML
      uses: ammaraskar/sphinx-action@0.4  # uses the /docs/requirements.txt file
hwayne commented 2 years ago

I think it's because the dockerfile uses the Sphinx 2.4.4 container, which is out of date.

flywire commented 1 year ago

Does that mean there is no Deploying a Sphinx project online?

hwayne commented 1 year ago

@flywire I ended up just building my own project manually:

      - name: directly build sphinx
        run: |
          pip install -r requirements.txt
          sphinx-build -D todo_include_todos=0 docs ./docs/_build/html/

Way easier than figuring out how to config this action overall.

SunC0der commented 1 year ago

Found an alternative solution: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-static-site-generators-with-python

He codes the html generation also manually and deploys the created webpage with his github action