|
38 | 38 | lint-outcome: ${{ steps.lint.outcome }} |
39 | 39 | mk_all-outcome: ${{ steps.mk_all.outcome }} |
40 | 40 | noisy-outcome: ${{ steps.noisy.outcome }} |
41 | | - shake-outcome: ${{ steps.shake.outcome }} |
| 41 | + # shake-outcome: ${{ steps.shake.outcome }} |
42 | 42 | test-outcome: ${{ steps.test.outcome }} |
43 | 43 | defaults: # On Hoskinson runners, landrun is already installed. |
44 | 44 | run: # note that .pr-branch/.lake must be created in a step below before we use this |
@@ -238,6 +238,51 @@ jobs: |
238 | 238 | echo "✅ All inputRevs in lake-manifest.json are valid" |
239 | 239 | fi |
240 | 240 |
|
| 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 | +
|
241 | 286 | - name: get cache (1/3 - setup and initial fetch) |
242 | 287 | id: get_cache_part1_setup |
243 | 288 | shell: bash # only runs `cache get` from `master-branch`, so doesn't need to be inside landrun |
@@ -412,7 +457,7 @@ jobs: |
412 | 457 | MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }} |
413 | 458 |
|
414 | 459 | - name: Check {Mathlib, Tactic, Counterexamples, Archive}.lean |
415 | | - if: always() |
| 460 | + if: ${{ always() && steps.mk_all.outcome != 'skipped' }} |
416 | 461 | run: | |
417 | 462 | if [[ "${{ steps.mk_all.outcome }}" != "success" ]]; then |
418 | 463 | echo "Please run 'lake exe mk_all' to regenerate the import all files" |
@@ -443,11 +488,13 @@ jobs: |
443 | 488 | action: add # In order to be able to run a multiline script, we need to add/remove the problem matcher before and after. |
444 | 489 | linters: gcc |
445 | 490 |
|
446 | | - - name: check for unused imports |
447 | | - id: shake |
448 | | - run: | |
449 | | - cd pr-branch |
450 | | - 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 |
451 | 498 |
|
452 | 499 | - name: lint mathlib |
453 | 500 | if: ${{ always() && steps.build.outcome == 'success' || steps.build.outcome == 'failure' }} |
|
0 commit comments