Skip to content

run notebooks / compile latex #9

run notebooks / compile latex

run notebooks / compile latex #9

Workflow file for this run

name: run notebooks / compile latex
on:
workflow_dispatch:
pull_request:
branches:
- master
schedule:
- cron: "30 2 * * 3" # every wednesday on 2:30am UTC
jobs:
build:
runs-on: ubuntu-latest
env:
DIR: tutorial_latex_deu
FILE: sig_sys_ex
strategy:
matrix:
python-version: ["3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: pip install jupyter nbconvert
- run: pip install -r requirements.txt
- name: Find notebooks
id: find-notebooks
run: |
find . -name "*.ipynb" > notebooks.txt
cat notebooks.txt
shell: bash
- name: Execute notebooks
run: |
cat notebooks.txt | while read -r notebook; do
jupyter nbconvert --to notebook --ExecutePreprocessor.kernel_name=python3 --execute --inplace "$notebook"
done
continue-on-error: false
shell: bash
- name: Check for errors
run: |
if grep "raise Exception(" *.ipynb; then
echo "Error found in notebook(s)."
exit 1
else
echo "No errors found in notebooks."
fi
shell: bash
- name: Install TeXlive
run: sudo apt-get update && sudo apt-get install texlive texlive-publishers texlive-science texlive-fonts-extra texlive-lang-german latexmk cm-super
- name: LaTeX compile
working-directory: ${{ env.DIR }}
run: pdflatex ${{ env.FILE }}; bibtex ${{ env.FILE }}; pdflatex ${{ env.FILE }}; pdflatex ${{ env.FILE }};
- name: move
run: mkdir -p github_artifacts && mv ${{ env.DIR }}/${{ env.FILE }}.pdf ./github_artifacts/
- name: Upload pdf as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.FILE }}.pdf
path: ./github_artifacts