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 }}.
19- ${{ ( 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) || '' }}
2019 # cancel any running workflow with the same label
2120 cancel-in-progress : true
2221
@@ -39,12 +38,23 @@ jobs:
3938 lint-outcome : ${{ steps.lint.outcome }}
4039 mk_all-outcome : ${{ steps.mk_all.outcome }}
4140 noisy-outcome : ${{ steps.noisy.outcome }}
42- shake-outcome : ${{ steps.shake.outcome }}
41+ # shake-outcome: ${{ steps.shake.outcome }}
4342 test-outcome : ${{ steps.test.outcome }}
4443 defaults : # On Hoskinson runners, landrun is already installed.
45- run :
44+ run : # note that .pr-branch/.lake must be created in a step below before we use this
4645 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}
4746 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
4858 - name : cleanup
4959 shell : bash # This *just* deletes old files, so is safe to run outside landrun.
5060 run : |
@@ -64,11 +74,11 @@ jobs:
6474
6575 # The Hoskinson runners may not have jq installed, so do that now.
6676 - name : ' Setup jq'
67- uses : dcarbone/install-jq-action@f0e10f46ff84f4d32178b4b76e1ef180b16f82c3 # v3.1.1
77+ uses : dcarbone/install-jq-action@b7ef57d46ece78760b4019dbc4080a1ba2a40b45 # v3.2.0
6878
6979 # Checkout the master branch into a subdirectory
7080 - name : Checkout master branch
71- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
81+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
7282 with :
7383 # Recall that on the `leanprover-community/mathlib4-nightly-testing` repository,
7484 # we don't maintain a `master` branch at all.
7888
7989 # Checkout the PR branch into a subdirectory
8090 - name : Checkout PR branch
81- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
91+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
8292 with :
8393 ref : " ${{ PR_BRANCH_REF }}"
8494 path : pr-branch
@@ -228,6 +238,51 @@ jobs:
228238 echo "✅ All inputRevs in lake-manifest.json are valid"
229239 fi
230240
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+
231286 - name : get cache (1/3 - setup and initial fetch)
232287 id : get_cache_part1_setup
233288 shell : bash # only runs `cache get` from `master-branch`, so doesn't need to be inside landrun
@@ -296,6 +351,7 @@ jobs:
296351 echo "::endgroup::"
297352
298353 ../master-branch/scripts/lake-build-with-retry.sh Mathlib
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 :
@@ -309,7 +365,7 @@ jobs:
309365
310366 - name : upload artifact containing contents of pr-branch
311367 # temporary measure for debugging no-build failures
312- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
368+ uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
313369 with :
314370 name : mathlib4_artifact
315371 include-hidden-files : true
@@ -364,13 +420,15 @@ jobs:
364420 run : |
365421 cd pr-branch
366422 ../master-branch/scripts/lake-build-with-retry.sh Archive
423+ # results of build at pr-branch/.lake/build_summary_Archive.json
367424
368425 - name : build counterexamples
369426 id : counterexamples
370427 continue-on-error : true
371428 run : |
372429 cd pr-branch
373430 ../master-branch/scripts/lake-build-with-retry.sh Counterexamples
431+ # results of build at pr-branch/.lake/build_summary_Counterexamples.json
374432
375433 - name : Check if building Archive or Counterexamples failed
376434 if : steps.archive.outcome == 'failure' || steps.counterexamples.outcome == 'failure'
@@ -399,7 +457,7 @@ jobs:
399457 MATHLIB_CACHE_SAS_RAW : ${{ secrets.MATHLIB_CACHE_SAS }}
400458
401459 - name : Check {Mathlib, Tactic, Counterexamples, Archive}.lean
402- if : always()
460+ if : ${{ always() && steps.mk_all.outcome != 'skipped' }}
403461 run : |
404462 if [[ "${{ steps.mk_all.outcome }}" != "success" ]]; then
405463 echo "Please run 'lake exe mk_all' to regenerate the import all files"
@@ -417,7 +475,7 @@ jobs:
417475 id : test
418476 run : |
419477 cd pr-branch
420- lake --iofail test
478+ ../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_MathlibTest.json lake --iofail test
421479 - name : end gh-problem-match-wrap for test step
422480 uses : leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
423481 with :
@@ -430,18 +488,20 @@ jobs:
430488 action : add # In order to be able to run a multiline script, we need to add/remove the problem matcher before and after.
431489 linters : gcc
432490
433- - name : check for unused imports
434- id : shake
435- run : |
436- cd pr-branch
437- 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
438498
439499 - name : lint mathlib
440500 if : ${{ always() && steps.build.outcome == 'success' || steps.build.outcome == 'failure' }}
441501 id : lint
442502 run : |
443503 cd pr-branch
444- 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
445505
446506 - name : end gh-problem-match-wrap for shake and lint steps
447507 uses : leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
@@ -492,12 +552,12 @@ jobs:
492552 runs-on : ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed.
493553 steps :
494554
495- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
555+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
496556 with :
497557 ref : " ${{ PR_BRANCH_REF }}"
498558
499559 - name : Configure Lean
500- uses : leanprover/lean-action@f807b338d95de7813c5c50d018f1c23c9b93b4ec # 2025-04-24
560+ uses : leanprover/lean-action@434f25c2f80ded67bba02502ad3a86f25db50709 # v1.3.0
501561 with :
502562 auto-config : false # Don't run `lake build`, `lake test`, or `lake lint` automatically.
503563 use-github-cache : false
@@ -540,7 +600,7 @@ jobs:
540600 lake exe graph
541601
542602 - name : upload the import graph
543- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
603+ uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
544604 with :
545605 name : import-graph
546606 path : import_graph.dot
0 commit comments