Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem reading logfile causes fatal error #52

Open
rpgoldman opened this issue Apr 22, 2023 · 5 comments
Open

Problem reading logfile causes fatal error #52

rpgoldman opened this issue Apr 22, 2023 · 5 comments

Comments

@rpgoldman
Copy link

When I run this in a github action I get this error:

====================================
Building docs in docs/
====================================
[sphinx-action] Running: ['sphinx-build', '-b', 'html', '.', '_build', '--keep-going', '--no-color', '-w', '/tmp/sphinx-log']
    action.build_all_docs(github_env, [os.environ.get("INPUT_DOCS-FOLDER")])
  File "/sphinx_action/action.py", line 152, in build_all_docs
    return_code, annotations = build_docs(github_env.build_command, docs_dir)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/sphinx_action/action.py", line 134, in build_docs
    with open(log_file, "r") as f:
         ^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/sphinx-log'

Looks like the script assumes that there will be a logfile in /tmp and when that is not true, then we get an error. I can't actually tell if this is a side-effect of build_all_docs failing, or if it succeeded, but the log can't be parsed.

Perhaps the right fix is to check to make sure the log_file is written before reading it. If it's not written, then inspect the return_code and emit a result based on that, together with mention of failure writing the logfile?

@SoundsSerious
Copy link

  • 1 for this appearing recently

@SoundsSerious
Copy link

Looks like this was a previous issue
#5

@m-birke
Copy link

m-birke commented Jun 5, 2023

I faced the same issue

even specified my own build command

    - name: Build HTML with Sphinx
      uses: ammaraskar/sphinx-action@master
      with:
        docs-folder: "doc/"
        build-command: "sphinx-build -b html . build"

But it still appends the options [sphinx-action] Running: ['sphinx-build', '-b', 'html', '.', 'build', '--keep-going', '--no-color', '-w', '/tmp/sphinx-log']

@stephanbcbauer
Copy link

Did you fix this problem? Thx

@jonoomph
Copy link

For anyone interested, here is the solution I went with. This replaces the broken sphinx-action with installing python and using the GitHub runner to build and upload the documentation artifacts. It's a few extra lines, but seems very stable and reliable.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v3
      with:
        python-version: '3.x'

    - name: Install Sphinx & Dependencies
      run: pip install sphinx sphinx_markdown_builder sphinx_rtd_theme
    - name: Build Documentation
      run: cd "$GITHUB_WORKSPACE/doc" && make html

    - uses: actions/upload-artifact@v3
      with:
        name: Documentation
        path: "$GITHUB_WORKSPACE/doc/_build/html/"

RyanDoesMath pushed a commit to Paper-Chart-Extraction-Project/ChartExtractor that referenced this issue May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants