Skip to content

Commit

Permalink
🚇 Add pipeline to create PDFs from notebooks (#3)
Browse files Browse the repository at this point in the history
Since we remove the output of notebooks before committing them
(`pre-commit`+`nbstripout` to reduce git cluttering) we can't directly
compare differences in plots. This PR adds a pipeline to run the
notebooks and generate PDFs from them so we can compare proposed changes
with the current state in an easier fashion.

See [this CI run on my
fork](https://github.com/s-weigand/pyglotaran-release-paper-supplementary-information/actions/runs/4276690589)
for a preview.

Note that the changes to the notebooks are caused by `papermill` running
the notebook which adds additional `tags` metadata to each cell and the
now required `id` field due to upgrading the `nbformat` version.

### Change summary

- [🔧 Remove papermill generated metadata from
notebook](dc722c4)
- [🧹 Add pdf build folder to
gitignore](a999ca8)
- [👌 Added custom template to avoid missing utf8 chars in code
cells](d21360e)
- [✨ Added script to build PDFs from
notebooks](b362ef8)
- [🔧 Added conda env
file](6288233)
- [🚇 Added pipeline to build
pdfs](1e4c7ab)
- [🩹 Added jpg to resource copy
pattern](aa02bc3)
- [🧹 Cleanup mention of master thesis is build
pipeline](626749d)
- [🧹 Notebooks after running them with papermill with added
metadata](1b2790c)
  • Loading branch information
s-weigand authored Feb 26, 2023
1 parent c1dc8ca commit 179a214
Show file tree
Hide file tree
Showing 11 changed files with 820 additions and 190 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build-pdfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build-PDFs

on:
# For now commented out since private repositories only have a limited amount of CI time
# push:
# pull_request:
workflow_dispatch:

jobs:
build:
name: 🚀 Compile PDFs ${{ matrix.case_study }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
case_study: [4TT, dPSI, rc]
steps:
- name: Checkout repo
uses: actions/checkout@v3

- uses: actions/cache@v3
name: Tectonic Cache
with:
path: ~/.cache/Tectonic
key: ${{ runner.os }}-tectonic-${{ hashFiles('**/_preamble*.tex') }}
restore-keys: |
${{ runner.os }}-tectonic-
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@v15
with:
cache-env: true

- name: Setup tectonic and biber
uses: wtfjoke/setup-tectonic@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
biber-version: "2.17"

- name: Run notebooks and build PDFs
run: |
python scripts/create_notebook_pdf.py ${{ matrix.case_study }}
- name: Upload PDFs
uses: actions/upload-artifact@v3
with:
name: pdfs
path: pdfs/*.pdf
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,6 @@ guide/

# Corrected 4TT data generate after the first analysis step
4TT/data/corr4TT.ascii

# Generated PDFs and tex source
pdfs
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repos:
args:
- "--drop-empty-cells"
- "--extra-keys"
- "metadata.vscode metadata.language_info.version"
- "metadata.vscode metadata.language_info.version cell.metadata.papermill metadata.papermill"

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.6.1
Expand Down
Loading

0 comments on commit 179a214

Please sign in to comment.