From 6abc06bcddd71ca5f245f4dd7c3912a7ef5596b8 Mon Sep 17 00:00:00 2001 From: mmcky Date: Fri, 7 Nov 2025 15:43:08 +1100 Subject: [PATCH 1/5] Migrate cache.yml to use composite actions with global caching Changes: - Use setup-lecture-env@main for Conda environment (global cache) - Use setup-latex@main for LaTeX packages (global cache) - Use build-lectures@main for Jupyter Book builds - Add latex-requirements.txt with version pinning - Add push:branches:[main] trigger for golden cache creation This establishes the global caching infrastructure: - Conda cache: shared across all workflows - LaTeX cache: shared across all workflows - Version-pinned LaTeX packages for explicit invalidation --- .github/workflows/cache.yml | 48 ++++++++++++++++++------------------- latex-requirements.txt | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 latex-requirements.txt diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index d5e21df..d81f174 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -1,5 +1,7 @@ name: Build Cache [using jupyter-book] on: + push: + branches: [main] schedule: # Execute cache weekly at 3am on Monday - cron: '0 3 * * 1' @@ -10,41 +12,39 @@ jobs: steps: - name: Checkout uses: actions/checkout@v5 - - name: Setup Anaconda - uses: conda-incubator/setup-miniconda@v3 + + # Use composite action for environment setup + - name: Setup Lecture Environment + uses: quantecon/actions/setup-lecture-env@main with: - auto-update-conda: true - auto-activate-base: true - miniconda-version: 'latest' - python-version: "3.13" - environment-file: environment.yml - activate-environment: quantecon + python-version: '3.13' + environment-file: 'environment.yml' + environment-name: 'quantecon' + - name: graphviz Support # TODO: required? run: | sudo apt-get -qq update && sudo apt-get install -y graphviz - - name: Install latex dependencies - run: | - sudo apt-get -qq update - sudo apt-get install -y \ - texlive-latex-recommended \ - texlive-latex-extra \ - texlive-fonts-recommended \ - texlive-fonts-extra \ - texlive-xetex \ - latexmk \ - xindy \ - dvipng \ - cm-super + + # Use composite action for LaTeX setup + - name: Install LaTeX Dependencies + uses: quantecon/actions/setup-latex@main + + # Use composite action for building - name: Build HTML - shell: bash -l {0} - run: | - jb build lectures --path-output ./ -W --keep-going + id: build + uses: quantecon/actions/build-lectures@main + with: + builder: 'html' + source-dir: 'lectures' + extra-args: '-W --keep-going' + - name: Upload Execution Reports (HTML) uses: actions/upload-artifact@v5 if: failure() with: name: execution-reports path: _build/html/reports + - name: Upload "_build" folder (cache) uses: actions/upload-artifact@v5 with: diff --git a/latex-requirements.txt b/latex-requirements.txt new file mode 100644 index 0000000..390ce15 --- /dev/null +++ b/latex-requirements.txt @@ -0,0 +1,43 @@ +# LaTeX packages required for Jupyter Book PDF builds# LaTeX packages required for Jupyter Book PDF builds + +# Version pinning ensures reproducibility and explicit cache invalidation# Version pinning ensures reproducibility and explicit cache invalidation + +# Last updated: 2024-11-07# Last updated: 2024-11-07 + +# TexLive: 2023 (Ubuntu 24.04 LTS Noble ships with 2023.20240207-1)# TexLive: 2023 (Ubuntu 24.04 LTS Noble ships with 2023.20240207-1) + +# Reference: https://packages.ubuntu.com/noble/texlive-base# Reference: https://packages.ubuntu.com/noble/texlive-base + + + +# Core LaTeX distribution (TexLive 2023)# Core LaTeX distribution (TexLive 2023) + +texlive-latex-recommended=2023.20240207-1texlive-latex-recommended=2023.20240207-1 + +texlive-latex-extra=2023.20240207-1texlive-latex-extra=2023.20240207-1 + +texlive-fonts-recommended=2023.20240207-1texlive-fonts-recommended=2023.20240207-1 + +texlive-fonts-extra=2023.20240207-1texlive-fonts-extra=2023.20240207-1 + +texlive-xetex=2023.20240207-1texlive-xetex=2023.20240207-1 + +texlive-luatex=2023.20240207-1texlive-luatex=2023.20240207-1 + + + +# Build tools# Build tools + +# Note: Versions will be determined on first run# Note: Update these versions when testing on actual runner + +latexmklatexmk + +xindyxindy + +dvipngdvipng + +ghostscriptghostscript + +cm-supercm-super + +cm-super From 812380e68a980971645c130f0493ffce7c6fd841 Mon Sep 17 00:00:00 2001 From: mmcky Date: Fri, 7 Nov 2025 15:45:44 +1100 Subject: [PATCH 2/5] Fix latex-requirements.txt formatting (remove duplicates) --- latex-requirements.txt | 62 ++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 42 deletions(-) diff --git a/latex-requirements.txt b/latex-requirements.txt index 390ce15..15ef3a2 100644 --- a/latex-requirements.txt +++ b/latex-requirements.txt @@ -1,43 +1,21 @@ -# LaTeX packages required for Jupyter Book PDF builds# LaTeX packages required for Jupyter Book PDF builds - -# Version pinning ensures reproducibility and explicit cache invalidation# Version pinning ensures reproducibility and explicit cache invalidation - -# Last updated: 2024-11-07# Last updated: 2024-11-07 - -# TexLive: 2023 (Ubuntu 24.04 LTS Noble ships with 2023.20240207-1)# TexLive: 2023 (Ubuntu 24.04 LTS Noble ships with 2023.20240207-1) - -# Reference: https://packages.ubuntu.com/noble/texlive-base# Reference: https://packages.ubuntu.com/noble/texlive-base - - - -# Core LaTeX distribution (TexLive 2023)# Core LaTeX distribution (TexLive 2023) - -texlive-latex-recommended=2023.20240207-1texlive-latex-recommended=2023.20240207-1 - -texlive-latex-extra=2023.20240207-1texlive-latex-extra=2023.20240207-1 - -texlive-fonts-recommended=2023.20240207-1texlive-fonts-recommended=2023.20240207-1 - -texlive-fonts-extra=2023.20240207-1texlive-fonts-extra=2023.20240207-1 - -texlive-xetex=2023.20240207-1texlive-xetex=2023.20240207-1 - -texlive-luatex=2023.20240207-1texlive-luatex=2023.20240207-1 - - - -# Build tools# Build tools - -# Note: Versions will be determined on first run# Note: Update these versions when testing on actual runner - -latexmklatexmk - -xindyxindy - -dvipngdvipng - -ghostscriptghostscript - -cm-supercm-super - +# LaTeX packages required for Jupyter Book PDF builds +# Version pinning ensures reproducibility and explicit cache invalidation +# Last updated: 2024-11-07 +# TexLive: 2023 (Ubuntu 24.04 LTS Noble ships with 2023.20240207-1) +# Reference: https://packages.ubuntu.com/noble/texlive-base + +# Core LaTeX distribution (TexLive 2023) +texlive-latex-recommended=2023.20240207-1 +texlive-latex-extra=2023.20240207-1 +texlive-fonts-recommended=2023.20240207-1 +texlive-fonts-extra=2023.20240207-1 +texlive-xetex=2023.20240207-1 +texlive-luatex=2023.20240207-1 + +# Build tools +# Note: Versions will be determined on first run +latexmk +xindy +dvipng +ghostscript cm-super From 8cc74bbfa42fbc6a1c5243b3a7b4b3f22729e939 Mon Sep 17 00:00:00 2001 From: mmcky Date: Fri, 7 Nov 2025 15:48:08 +1100 Subject: [PATCH 3/5] Remove push trigger from cache.yml - use weekly schedule only Long-running cache builds should only run: - Weekly on schedule (Monday 3am) - Manual dispatch when needed - Not on every main push (dependencies change rarely) --- .github/workflows/cache.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index d81f174..46261ea 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -1,7 +1,5 @@ name: Build Cache [using jupyter-book] on: - push: - branches: [main] schedule: # Execute cache weekly at 3am on Monday - cron: '0 3 * * 1' From a60c8240fd02d957907ba99be98350e262d9f07a Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Fri, 7 Nov 2025 15:54:41 +1100 Subject: [PATCH 4/5] Update latex-requirements.txt --- latex-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/latex-requirements.txt b/latex-requirements.txt index 15ef3a2..ff2ab68 100644 --- a/latex-requirements.txt +++ b/latex-requirements.txt @@ -1,6 +1,6 @@ # LaTeX packages required for Jupyter Book PDF builds # Version pinning ensures reproducibility and explicit cache invalidation -# Last updated: 2024-11-07 +# Last updated: 2025-11-07 # TexLive: 2023 (Ubuntu 24.04 LTS Noble ships with 2023.20240207-1) # Reference: https://packages.ubuntu.com/noble/texlive-base From 59afd5aec807d3aac29068f0cd155fcfb93a48bb Mon Sep 17 00:00:00 2001 From: mmcky Date: Fri, 7 Nov 2025 15:56:10 +1100 Subject: [PATCH 5/5] Disable Google Colab workflow for testing phase Renamed collab.yml to collab.yml.disabled to prevent execution during cache migration testing --- .github/workflows/{collab.yml => collab.yml.disabled} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{collab.yml => collab.yml.disabled} (100%) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml.disabled similarity index 100% rename from .github/workflows/collab.yml rename to .github/workflows/collab.yml.disabled