From b7909ec2c1ff96dcfc8613f7bf05c0355dc8a9ee Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Thu, 11 Jun 2026 13:21:35 +1000 Subject: [PATCH 1/3] Tooling scaffolding refresh: Dependabot, linkcheck, pin bumps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mechanical items from the lecture-dp tooling review (tracking: #22): - Add .github/dependabot.yml (github-actions + conda weekly, with the jupyter-book >=2.0 ignore — jb 2.x is the MyST-MD rewrite and not a drop-in upgrade) - Add linkcheck.yml (weekly lychee run against the live site; this repo deploys Pages via the OIDC artifact workflow, so there is no gh-pages branch to check out — the site is mirrored with wget instead) - Bump actions/checkout v4 -> v6, upload-artifact v4 -> v7, download-artifact v4 -> v6 (Dependabot keeps these current from here) - cache.yml: rebuild the build cache when environment.yml changes on main (previously stale for up to a week after env changes) - environment.yml: bump sphinx-proof 0.3.0 -> 0.4.0, sphinxcontrib-youtube 1.4.1 -> 1.5.0, sphinx-togglebutton 0.3.2 -> 0.4.5 (matches the versions the sibling lecture repos run with the same jupyter-book pin) - Remove the placeholder google_analytics_id (G-XXXXXXXXXX); re-add with a real GA4 measurement ID if analytics are wanted The quantecon-book-theme pin (==0.15.1) is deliberately NOT bumped here — that needs a visual layout review and is tracked in #23. Co-Authored-By: Claude Fable 5 --- .github/dependabot.yml | 22 +++++++++++++++++++++ .github/workflows/cache.yml | 5 ++++- .github/workflows/ci.yml | 4 ++-- .github/workflows/linkcheck.yml | 35 +++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 6 +++--- environment.yml | 6 +++--- lectures/_config.yml | 2 -- 7 files changed, 69 insertions(+), 11 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/linkcheck.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ecad092 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,22 @@ +version: 2 +enable-beta-ecosystems: true # required for the conda ecosystem +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + commit-message: + prefix: ⬆️ + - package-ecosystem: conda + directory: / + schedule: + interval: weekly + commit-message: + prefix: ⬆️ + ignore: + - dependency-name: jupyter-book + # jupyter-book 2.x is the MyST-MD rewrite and is not a drop-in + # upgrade for the Sphinx-based 1.x pipeline this repo uses. + versions: ['>=2.0'] + - dependency-name: python + # Python version is constrained by the anaconda distribution diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index 5b49b2b..556dd75 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -3,6 +3,9 @@ on: schedule: - cron: '0 2 * * 1' # Every Monday at 2am UTC workflow_dispatch: # Manual trigger when needed + push: + branches: [main] + paths: [environment.yml] # Rebuild cache when the environment changes jobs: build: @@ -15,7 +18,7 @@ jobs: packages: read steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index def98e5..8729f14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: packages: read steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 @@ -29,7 +29,7 @@ jobs: upload-failure-reports: true - name: Upload Build Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: html-build path: ${{ steps.build.outputs.build-path }} diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml new file mode 100644 index 0000000..32933ea --- /dev/null +++ b/.github/workflows/linkcheck.yml @@ -0,0 +1,35 @@ +name: Link Checker +on: + schedule: + # Weekly on Sunday 23:00 UTC (Monday morning in Australia) + - cron: '0 23 * * 0' + workflow_dispatch: + +jobs: + linkcheck: + runs-on: ubuntu-latest + permissions: + issues: write # required for peter-evans/create-issue-from-file + steps: + # This repo deploys GitHub Pages via the artifact workflow (OIDC), so + # there is no gh-pages branch to check out — mirror the live site instead. + - name: Mirror published site + run: | + wget --quiet --recursive --no-parent --no-host-directories \ + --accept html https://dp.quantecon.org/ || true + find . -name '*.html' | head -5 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v2 + with: + fail: false + args: --accept 403,503 '**/*.html' + + - name: Create Issue From File + if: steps.lychee.outputs.exit_code != 0 + uses: peter-evans/create-issue-from-file@v6 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue, linkchecker diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cdc1e84..da826a7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,7 +26,7 @@ jobs: packages: read steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 @@ -41,7 +41,7 @@ jobs: upload-failure-reports: true - name: Upload Build Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: html-build path: ${{ steps.build.outputs.build-path }} @@ -59,7 +59,7 @@ jobs: url: ${{ steps.deployment.outputs.page-url }} steps: - name: Download Build Artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v6 with: name: html-build path: _build/html diff --git a/environment.yml b/environment.yml index a53d533..8802fec 100644 --- a/environment.yml +++ b/environment.yml @@ -11,7 +11,7 @@ dependencies: - sphinx-tojupyter==0.6.0 - sphinxext-rediraffe==0.3.0 - sphinx-exercise==1.2.1 - - sphinx-proof==0.3.0 - - sphinxcontrib-youtube==1.4.1 - - sphinx-togglebutton==0.3.2 + - sphinx-proof==0.4.0 + - sphinxcontrib-youtube==1.5.0 + - sphinx-togglebutton==0.4.5 - sphinx-reredirects==1.1.0 diff --git a/lectures/_config.yml b/lectures/_config.yml index 5861734..692737b 100644 --- a/lectures/_config.yml +++ b/lectures/_config.yml @@ -87,8 +87,6 @@ sphinx: og_logo_url: https://assets.quantecon.org/img/qe-og-logo.png description: This website presents a set of lectures on dynamic programming, designed and written by Thomas J. Sargent and John Stachurski. keywords: Python, QuantEcon, Quantitative Economics, Economics, Dynamic Programming, Tom J. Sargent, John Stachurski - analytics: - google_analytics_id: G-XXXXXXXXXX launch_buttons: colab_url : https://colab.research.google.com intersphinx_mapping: From abc3e86c870a27eb559a3f5ebe7c5b1bfe3566d6 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 22 Jun 2026 09:06:41 +1000 Subject: [PATCH 2/3] FIX: surface linkcheck mirror failures instead of false-green runs Previously `wget ... || true` let the job report success even when the mirror failed, so lychee ran against an empty directory and reported no broken links (false negative, per Copilot review on #26). Now count the mirrored HTML files: if zero, skip lychee and open an issue noting the mirror failed; otherwise run lychee as before. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/linkcheck.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 32933ea..0f890d6 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -14,20 +14,38 @@ jobs: # This repo deploys GitHub Pages via the artifact workflow (OIDC), so # there is no gh-pages branch to check out — mirror the live site instead. - name: Mirror published site + id: mirror run: | wget --quiet --recursive --no-parent --no-host-directories \ --accept html https://dp.quantecon.org/ || true - find . -name '*.html' | head -5 + count=$(find . -name '*.html' | wc -l | tr -d ' ') + echo "Mirrored $count HTML file(s) from https://dp.quantecon.org/" + if [ "$count" -eq 0 ]; then + # Mirror failed (site down or wget broke). Don't run lychee against + # an empty mirror and report green — surface the failure instead. + echo "ok=false" >> "$GITHUB_OUTPUT" + mkdir -p lychee + { + echo "## Link Checker — mirror failed" + echo + echo "\`wget\` mirrored **0 HTML files** from https://dp.quantecon.org/, so the link check did not run." + echo "The live site may be down, or the mirror step may be broken — please investigate." + } > lychee/out.md + else + echo "ok=true" >> "$GITHUB_OUTPUT" + fi - name: Link Checker id: lychee + if: steps.mirror.outputs.ok == 'true' uses: lycheeverse/lychee-action@v2 with: fail: false args: --accept 403,503 '**/*.html' + # Open an issue if the mirror failed, or if lychee found broken links. - name: Create Issue From File - if: steps.lychee.outputs.exit_code != 0 + if: steps.mirror.outputs.ok != 'true' || steps.lychee.outputs.exit_code != 0 uses: peter-evans/create-issue-from-file@v6 with: title: Link Checker Report From 30b6d49ab6c761a47d20ad80fe660b56d63a9c63 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 22 Jun 2026 12:30:52 +1000 Subject: [PATCH 3/3] FIX: correct build-jupyter-cache input name (builder -> builders) The Build Cache workflow passed `builder:` (singular), but the quantecon/actions/build-jupyter-cache input is `builders` (plural), so the value was silently ignored. It was harmless only because the action default is already `html`; renaming makes the intent explicit and avoids a silent no-op if the builder set ever changes. Refs QuantEcon/lecture-dp#31 Co-Authored-By: Claude Opus 4.8 --- .github/workflows/cache.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index 556dd75..88ada8a 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -25,5 +25,5 @@ jobs: - name: Build and Cache Lectures uses: quantecon/actions/build-jupyter-cache@v0.6.0 with: - builder: 'html' + builders: 'html' create-issue-on-failure: true