Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/notebook-smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Notebook smoke

on:
pull_request:
paths:
- "_notebooks/**/*.ipynb"
- "scripts/smoke_notebooks.py"
- "scripts/smoke.yml"
- "requirements-smoke.txt"
- ".github/workflows/notebook-smoke.yml"
schedule:
# Weekly full suite (Sunday 04:00 UTC)
- cron: "0 4 * * 0"
workflow_dispatch:
inputs:
only:
description: "Optional notebook prefixes (space-separated), e.g. 01 12. Empty = all except skipped."
required: false
default: ""

concurrency:
group: notebook-smoke-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
smoke:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: requirements-smoke.txt

- name: Install smoke dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-smoke.txt

- name: Cache pods / notebook data downloads
uses: actions/cache@v4
with:
path: |
~/.pods_data
_notebooks/data
key: pods-data-${{ runner.os }}-${{ hashFiles('requirements-smoke.txt') }}
restore-keys: |
pods-data-${{ runner.os }}-

- name: Run notebook smoke tests
env:
MPLBACKEND: Agg
JUPYTER_PLATFORM_DIRS: "1"
run: |
set -euo pipefail
ONLY="${{ github.event.inputs.only }}"
if [ -n "${ONLY}" ]; then
# shellcheck disable=SC2086
python scripts/smoke_notebooks.py --only ${ONLY}
else
python scripts/smoke_notebooks.py
fi

- name: Upload smoke results
if: always()
uses: actions/upload-artifact@v4
with:
name: notebook-smoke-results
path: |
_notebooks/test-results/summary.json
_notebooks/test-results/*.ok
_notebooks/test-results/*.fail
if-no-files-found: ignore
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.ipynb_checkpoints/
.DS_Store
__pycache__/
.venv/
_notebooks/test-results/
14 changes: 10 additions & 4 deletions _lamd/_lamd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@ author:
layout: lecture
room:
venue: Virtual (Zoom)
talkcss: https://inverseprobability.com/assets/css/talks.css
talktheme: white
talkcss: mlatcl.css
talkfontsize: xs
bibdir: $HOME/lawrennd/bibliography
postsdir: ../_lectures/
slidesdir: ../slides/
slidesdir: ../slides/ # Compiled slide HTML. copy_web_diagrams writes published figures into slides/diagrams/ here
notesdir: ../_notes/
notebooksdir: ../_notebooks/
practicalsdir: ../_practicals/
snippetsdir: $HOME/lawrennd/snippets
writediagramsdir: .
macrosdir: $HOME/lawrennd/lamd/lamd/macros
people: ../_people/people.yml
writediagramsdir: . # Where the build writes newly created diagrams (not the shared library)
scriptsdir: ./scripts/
diagramsdir: ./slides/diagrams/
diagramsdir: $HOME/lawrennd/slides/diagrams/ # Filesystem SOURCE library. copy_web_diagrams reads from here; not a URL
diagramswebpath: slides/diagrams/ # Published URL path after url+baseurl. HTML \diagramsDir uses this, not diagramsdir
slidesheader: slides-header.html
posts: True
docx: False
notespdf: False
Expand Down
54 changes: 43 additions & 11 deletions _lamd/compile.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
#/bin/bash

FILES=""
SKIP=true
while read stub; do
if $SKIP; then
SKIP=false
else
maketalk $stub
fi
done < lectures.csv
#!/bin/bash
# Compile lectures and worksheets listed in the CSVs (skip header row).
set -euo pipefail

cd "$(dirname "$0")"

compile_list() {
local csv="$1"
local skip=true
local stub
while IFS= read -r stub || [[ -n "$stub" ]]; do
stub="${stub//$'\r'/}"
[[ -z "$stub" ]] && continue
if $skip; then
skip=false
continue
fi
echo "maketalk ${stub}.md"
maketalk "${stub}.md"
done < "$csv"
}

compile_list lectures.csv
if [[ -f worksheets.csv ]]; then
compile_list worksheets.csv
fi

# Printable assessment handouts (pandoc), not LaMD.
handouts_dir="../assessments/handouts"
if [[ -f "${handouts_dir}/handouts.csv" ]]; then
skip=true
while IFS= read -r stub || [[ -n "$stub" ]]; do
stub="${stub//$'\r'/}"
[[ -z "$stub" ]] && continue
if $skip; then
skip=false
continue
fi
echo "pandoc ${stub}.md -> tex/pdf"
pandoc "${handouts_dir}/${stub}.md" -s -o "${handouts_dir}/${stub}.tex"
pandoc "${handouts_dir}/${stub}.md" -o "${handouts_dir}/${stub}.pdf"
done < "${handouts_dir}/handouts.csv"
fi
1 change: 1 addition & 0 deletions _lamd/worksheets.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worksheetId
Loading
Loading