1515concurrency :
1616 # label each workflow run; only the latest with each label will run
1717 # workflows on master get more expressive labels
18- group : ${{ github.workflow }}-${{ github.ref }}-${{ (contains(fromJSON('["refs/heads/master", "refs/heads/staging"]'), github.ref) && github.run_id) || '' }}
18+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github. ref }}-${{ (github.event_name == 'push' && contains(fromJSON('["refs/heads/master", "refs/heads/staging"]'), github.ref) && github.run_id) || '' }}
1919 # cancel any running workflow with the same label
2020 cancel-in-progress : true
2121
@@ -38,12 +38,23 @@ jobs:
3838 lint-outcome : ${{ steps.lint.outcome }}
3939 mk_all-outcome : ${{ steps.mk_all.outcome }}
4040 noisy-outcome : ${{ steps.noisy.outcome }}
41- shake-outcome : ${{ steps.shake.outcome }}
41+ # shake-outcome: ${{ steps.shake.outcome }}
4242 test-outcome : ${{ steps.test.outcome }}
4343 defaults : # On Hoskinson runners, landrun is already installed.
44- run :
44+ run : # note that .pr-branch/.lake must be created in a step below before we use this
4545 shell : landrun --rox /usr --ro /etc/timezone --rw /dev --rox /home/lean/.elan --rox /home/lean/actions-runner/_work --rox /home/lean/.cache/mathlib/ --rw pr-branch/.lake/ --env PATH --env HOME --env GITHUB_OUTPUT --env CI -- bash -euxo pipefail {0}
4646 steps :
47+ - name : job info
48+ env :
49+ WORKFLOW : ${{ github.workflow }}
50+ PR_NUMBER : ${{ github.event.pull_request.number }}
51+ REF : ${{ github.ref }}
52+ EVENT_NAME : ${{ github.event_name }}
53+ RUN_ID : ${{ github.run_id }}
54+ CONCURRENCY_GROUP : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ (github.event_name == 'push' && contains(fromJSON('["refs/heads/master", "refs/heads/staging"]'), github.ref) && github.run_id) || '' }}
55+ shell : bash # there is no script body, so this is safe to "run" outside landrun.
56+ run : |
57+ # We just populate the env vars for this step to make them viewable in the logs
4758 - name : cleanup
4859 shell : bash # This *just* deletes old files, so is safe to run outside landrun.
4960 run : |
@@ -227,6 +238,51 @@ jobs:
227238 echo "✅ All inputRevs in lake-manifest.json are valid"
228239 fi
229240
241+ - name : verify ProofWidgets lean-toolchain matches on versioned releases
242+ # Only enforce this on the main mathlib4 repository, not on nightly-testing
243+ if : github.repository == 'leanprover-community/mathlib4'
244+ shell : bash
245+ run : |
246+ cd pr-branch
247+
248+ # Read the lean-toolchain file
249+ TOOLCHAIN=$(cat lean-toolchain | tr -d '[:space:]')
250+ echo "Lean toolchain: $TOOLCHAIN"
251+
252+ # Check if toolchain matches the versioned release pattern: leanprover/lean4:vX.Y.Z (with optional suffix like -rc1)
253+ if [[ "$TOOLCHAIN" =~ ^leanprover/lean4:v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?$ ]]; then
254+ echo "✓ Detected versioned Lean release: $TOOLCHAIN"
255+ echo "Verifying ProofWidgets lean-toolchain matches..."
256+
257+ # Check if ProofWidgets lean-toolchain exists
258+ if [ ! -f .lake/packages/proofwidgets/lean-toolchain ]; then
259+ echo "❌ Error: .lake/packages/proofwidgets/lean-toolchain does not exist"
260+ echo "This file should be created by 'lake env' during dependency download."
261+ exit 1
262+ fi
263+
264+ # Read ProofWidgets lean-toolchain
265+ PROOFWIDGETS_TOOLCHAIN=$(cat .lake/packages/proofwidgets/lean-toolchain | tr -d '[:space:]')
266+ echo "ProofWidgets toolchain: $PROOFWIDGETS_TOOLCHAIN"
267+
268+ # Compare the two
269+ if [ "$TOOLCHAIN" != "$PROOFWIDGETS_TOOLCHAIN" ]; then
270+ echo "❌ Error: Lean toolchain mismatch!"
271+ echo " Main lean-toolchain: $TOOLCHAIN"
272+ echo " ProofWidgets lean-toolchain: $PROOFWIDGETS_TOOLCHAIN"
273+ echo ""
274+ echo "When using a versioned Lean release (leanprover/lean4:vX.Y.Z),"
275+ echo "the ProofWidgets dependency must use the same toolchain."
276+ echo "Please update the ProofWidgets dependency to use $TOOLCHAIN"
277+ exit 1
278+ else
279+ echo "✅ ProofWidgets lean-toolchain matches: $TOOLCHAIN"
280+ fi
281+ else
282+ echo "ℹ Lean toolchain is not a versioned release (pattern: leanprover/lean4:vX.Y.Z)"
283+ echo "Skipping ProofWidgets toolchain verification."
284+ fi
285+
230286 - name : get cache (1/3 - setup and initial fetch)
231287 id : get_cache_part1_setup
232288 shell : bash # only runs `cache get` from `master-branch`, so doesn't need to be inside landrun
@@ -295,7 +351,7 @@ jobs:
295351 echo "::endgroup::"
296352
297353 ../master-branch/scripts/lake-build-with-retry.sh Mathlib
298- # results of build at pr-branch/.lake/build_summary_Mathlib* .json
354+ # results of build at pr-branch/.lake/build_summary_Mathlib.json
299355 - name : end gh-problem-match-wrap for build step
300356 uses : leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
301357 with :
@@ -364,15 +420,15 @@ jobs:
364420 run : |
365421 cd pr-branch
366422 ../master-branch/scripts/lake-build-with-retry.sh Archive
367- # results of build at pr-branch/.lake/build_summary_Archive* .json
423+ # results of build at pr-branch/.lake/build_summary_Archive.json
368424
369425 - name : build counterexamples
370426 id : counterexamples
371427 continue-on-error : true
372428 run : |
373429 cd pr-branch
374430 ../master-branch/scripts/lake-build-with-retry.sh Counterexamples
375- # results of build at pr-branch/.lake/build_summary_Counterexamples* .json
431+ # results of build at pr-branch/.lake/build_summary_Counterexamples.json
376432
377433 - name : Check if building Archive or Counterexamples failed
378434 if : steps.archive.outcome == 'failure' || steps.counterexamples.outcome == 'failure'
@@ -401,7 +457,7 @@ jobs:
401457 MATHLIB_CACHE_SAS_RAW : ${{ secrets.MATHLIB_CACHE_SAS }}
402458
403459 - name : Check {Mathlib, Tactic, Counterexamples, Archive}.lean
404- if : always()
460+ if : ${{ always() && steps.mk_all.outcome != 'skipped' }}
405461 run : |
406462 if [[ "${{ steps.mk_all.outcome }}" != "success" ]]; then
407463 echo "Please run 'lake exe mk_all' to regenerate the import all files"
@@ -419,7 +475,7 @@ jobs:
419475 id : test
420476 run : |
421477 cd pr-branch
422- lake --iofail test
478+ ../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_MathlibTest.json lake --iofail test
423479 - name : end gh-problem-match-wrap for test step
424480 uses : leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
425481 with :
@@ -432,18 +488,20 @@ jobs:
432488 action : add # In order to be able to run a multiline script, we need to add/remove the problem matcher before and after.
433489 linters : gcc
434490
435- - name : check for unused imports
436- id : shake
437- run : |
438- cd pr-branch
439- env LEAN_ABORT_ON_PANIC=1 lake exe shake --gh-style
491+ # With the arrival of the module system, the old `shake` is no longer functional.
492+ # This will be replaced soon.
493+ # - name: check for unused imports
494+ # id: shake
495+ # run: |
496+ # cd pr-branch
497+ # env LEAN_ABORT_ON_PANIC=1 lake exe shake --gh-style
440498
441499 - name : lint mathlib
442500 if : ${{ always() && steps.build.outcome == 'success' || steps.build.outcome == 'failure' }}
443501 id : lint
444502 run : |
445503 cd pr-branch
446- env LEAN_ABORT_ON_PANIC=1 lake exe runLinter Mathlib
504+ env LEAN_ABORT_ON_PANIC=1 ../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_lint.json lake exe runLinter Mathlib
447505
448506 - name : end gh-problem-match-wrap for shake and lint steps
449507 uses : leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
0 commit comments