todogroup / ospology

📖 OSPOlogy - The Study of OSPOs
https://todogroup.org
Creative Commons Attribution 4.0 International
186 stars 82 forks source link

[OSPO Book] GH Actions Bug:No such file or directory #308

Closed anajsana closed 10 months ago

anajsana commented 1 year ago

@koozz just noticed that when merged your PR: https://github.com/todogroup/ospology/pull/306 GitHub actions drops the following error when trying to generate the pdf 🤔:

pandoc: ospo-book/chapters/*.md: openBinaryFile: does not exist (No such file or directory)

koozz commented 1 year ago

You can assign it to me, I will have a look.

koozz commented 1 year ago

I tried fixing this with the suggested pandoc docker image, but ran into an error.

I also tried to run it as it previously was, though I did need to install the package texlive-latex-base too.

Ended up with the same error as with the pandoc-docker image attempt:

Error producing PDF.
! LaTeX Error: File `titlesec.sty' not found.

Has this latex file worked before? Was another add-on or file added locally? Where should this titlesec come from?

thisisobate commented 1 year ago

@anajsana @koozz it looks like wildcard substitution does not work inside GitHub Actions yaml files args fields.

Remember that wildcard substitution (say, pandoc *.md) or other shell features frequently used with pandoc do not work inside GitHub Actions yaml files args: fields. Only GitHub Actions context and expression syntax can be used here.

Take a look at this pandoc example doc

koozz commented 1 year ago

I tried that too, not the most fancy way, but then I run into the error that titlesec.sty cannot be found.

My current draft is now:

name: Build PDF
on:
  push:
    branches:
      - main
    paths:
      - 'ospo-book/**'
  pull_request:
    branches:
      - main
    paths:
      - 'ospo-book/**'
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v3
    - name: Gather input
      id: gather
      run: echo "files=$(ls ospo-book/chapters/*.md | xargs)" >> $GITHUB_OUTPUT
    - name: Generate book
      uses: docker://pandoc/core:3.1
      with:
        args: -N -s --template=ospo-book/docs/template.latex --output ospo-book/docs/output.pdf ${{ steps.gather.outputs.files }}
    - name: Upload artifact
      uses: actions/upload-artifact@v3
      with:
        name: book-pdf
        path: ospo-book/docs/output.pdf
thisisobate commented 1 year ago

@koozz Can you try replacing docker://pandoc/core:3.1 with docker://pandoc/latex:3.1 instead?

If it doesn't work, then try add this new step right after the "Gather input" step:

- name: Install TeXlive
        run: sudo apt-get update && sudo apt-get install texlive texlive-publishers texlive-science latexmk cm-super texlive-base texlive-latex-recommended \
  texlive-science texlive-latex-extra texlive-extra-utils
anajsana commented 1 year ago
  • name: Install TeXlive run: sudo apt-get update && sudo apt-get install texlive texlive-publishers texlive-science latexmk cm-super texlive-base texlive-latex-recommended \ texlive-science texlive-latex-extra texlive-extra-utils

Thanks for helping on this @thisisobate ! I've reviewed the file that is in main branch and it uses latex:3.1 but keeps failing: https://github.com/todogroup/ospology/blob/d8c2ca8e71c00910ae295e6368cec145ec4bb3e5/.github/workflows/build-pdf.yml#L20

Which line do you suggest to include the TeXlive step? Thank you! 🙂

thisisobate commented 1 year ago

Sorry for my late response @anajsana I suggest you include the TeXlive step in line 19

Let me know how it goes

https://github.com/todogroup/ospology/blob/d8c2ca8e71c00910ae295e6368cec145ec4bb3e5/.github/workflows/build-pdf.yml#L19