7878
7979 # Checkout the master branch into a subdirectory
8080 - name : Checkout master branch
81- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 .0.0
81+ uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 .0.1
8282 with :
8383 # Recall that on the `leanprover-community/mathlib4-nightly-testing` repository,
8484 # we don't maintain a `master` branch at all.
8888
8989 # Checkout the PR branch into a subdirectory
9090 - name : Checkout PR branch
91- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 .0.0
91+ uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 .0.1
9292 with :
9393 ref : " ${{ PR_BRANCH_REF }}"
9494 path : pr-branch
@@ -365,7 +365,7 @@ jobs:
365365
366366 - name : upload artifact containing contents of pr-branch
367367 # temporary measure for debugging no-build failures
368- uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 .0.0
368+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 .0.0
369369 with :
370370 name : mathlib4_artifact
371371 include-hidden-files : true
@@ -395,7 +395,7 @@ jobs:
395395 # do not try to upload files just downloaded
396396
397397 echo "Uploading cache to Azure..."
398- USE_FRO_CACHE =0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked
398+ MATHLIB_CACHE_USE_CLOUDFLARE =0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked
399399 env :
400400 MATHLIB_CACHE_SAS_RAW : ${{ secrets.MATHLIB_CACHE_SAS }}
401401
@@ -451,8 +451,8 @@ jobs:
451451 export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
452452
453453 echo "Uploading Archive and Counterexamples cache to Azure..."
454- USE_FRO_CACHE =0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked Archive.lean
455- USE_FRO_CACHE =0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked Counterexamples.lean
454+ MATHLIB_CACHE_USE_CLOUDFLARE =0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked Archive.lean
455+ MATHLIB_CACHE_USE_CLOUDFLARE =0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked Counterexamples.lean
456456 env :
457457 MATHLIB_CACHE_SAS_RAW : ${{ secrets.MATHLIB_CACHE_SAS }}
458458
@@ -495,13 +495,58 @@ jobs:
495495 # run: |
496496 # cd pr-branch
497497 # env LEAN_ABORT_ON_PANIC=1 lake exe shake --gh-style
498-
499498 - name : lint mathlib
500499 if : ${{ always() && steps.build.outcome == 'success' || steps.build.outcome == 'failure' }}
501500 id : lint
501+ timeout-minutes : 40
502502 run : |
503503 cd pr-branch
504- env LEAN_ABORT_ON_PANIC=1 ../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_lint.json lake exe runLinter Mathlib
504+ set -o pipefail
505+ # Try running with --trace; if it fails due to argument parsing, the PR needs to merge master
506+ # We use .lake/ for the output file because landrun restricts /tmp access
507+ for attempt in 1 2; do
508+ if timeout 10m env LEAN_ABORT_ON_PANIC=1 stdbuf -oL lake exe runLinter --trace Mathlib 2>&1 | tee ".lake/lint_output_attempt_${attempt}.txt"; then
509+ break
510+ fi
511+ status=${PIPESTATUS[0]}
512+ if grep -q "cannot parse arguments" ".lake/lint_output_attempt_${attempt}.txt"; then
513+ echo ""
514+ echo "=============================================================================="
515+ echo "ERROR: Your branch uses an older version of runLinter that doesn't support"
516+ echo "the --trace flag. Please merge 'master' into your PR branch to get the"
517+ echo "updated linter, then push again."
518+ echo ""
519+ echo "You can do this with:"
520+ echo " git fetch upstream"
521+ echo " git merge upstream/master"
522+ echo " git push"
523+ echo "=============================================================================="
524+ echo ""
525+ exit 1
526+ fi
527+ if [ "$status" -eq 124 ]; then
528+ echo "runLinter timed out (attempt $attempt)."
529+ if [ "$attempt" -lt 2 ]; then
530+ echo "Retrying runLinter after timeout..."
531+ continue
532+ fi
533+ fi
534+ exit $status
535+ done
536+
537+ # We need to separate this step from the previous script because it needs to run outside of landrun
538+ - name : kill stray runLinter processes
539+ if : ${{ steps.lint.outcome == 'failure' }}
540+ continue-on-error : true
541+ shell : bash
542+ run : |
543+ echo "Checking for runLinter processes..."
544+ if pgrep -af runLinter; then
545+ echo "Killing runLinter processes..."
546+ pkill -f runLinter || true
547+ else
548+ echo "No stray runLinter processes found."
549+ fi
505550
506551 - name : end gh-problem-match-wrap for shake and lint steps
507552 uses : leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
@@ -552,7 +597,7 @@ jobs:
552597 runs-on : ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed.
553598 steps :
554599
555- - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 .0.0
600+ - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 .0.1
556601 with :
557602 ref : " ${{ PR_BRANCH_REF }}"
558603
@@ -600,7 +645,7 @@ jobs:
600645 lake exe graph
601646
602647 - name : upload the import graph
603- uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 .0.0
648+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 .0.0
604649 with :
605650 name : import-graph
606651 path : import_graph.dot
@@ -615,7 +660,7 @@ jobs:
615660 # make sure everything is available for test/import_all.lean
616661 # and that miscellaneous executables still work
617662 run : |
618- lake build Batteries Qq Aesop ProofWidgets Plausible pole unused
663+ lake build Batteries Qq Aesop ProofWidgets Plausible
619664
620665 - name : build AesopTest (nightly-testing only)
621666 # Only run on the mathlib4-nightly-testing repository
@@ -624,34 +669,7 @@ jobs:
624669 lake build AesopTest
625670
626671 # We no longer run `lean4checker` in regular CI, as it is quite expensive for little benefit.
627- # Instead we run it in a cron job on master: see `lean4checker.yml`.
628- # Output is posted to the zulip topic
629- # https://leanprover.zulipchat.com/#narrow/stream/345428-mathlib-reviewers/topic/lean4checker
630-
631- - name : checkout lean4checker
632- if : ${{ (always() && needs.build.outputs.build-outcome == 'success' || needs.build.outputs.build-outcome == 'failure') && contains(github.event.pull_request.changed_files, 'lean-toolchain') }}
633- shell : bash
634- run : |
635- git clone https://github.com/leanprover/lean4checker
636- cd lean4checker
637- # Read lean-toolchain file and checkout appropriate branch
638- TOOLCHAIN=$(cat ../lean-toolchain)
639- if [[ "$TOOLCHAIN" =~ ^leanprover/lean4:v ]]; then
640- VERSION=${TOOLCHAIN#leanprover/lean4:}
641- git checkout "$VERSION"
642- else
643- git checkout master
644- fi
645-
646- - name : run leanchecker on itself
647- if : ${{ (always() && needs.build.outputs.build-outcome == 'success' || needs.build.outputs.build-outcome == 'failure') && contains(github.event.pull_request.changed_files, 'lean-toolchain') }}
648- run : |
649- cd lean4checker
650- # Build lean4checker using the same toolchain
651- cp ../lean-toolchain .
652- lake build
653- lake -q exe lean4checker Lean4Checker
654-
672+ # Instead we run it in a cron job on master: see `daily.yml`.
655673 style_lint :
656674 name : Lint styleJOB_NAME
657675 if : FORK_CONDITION
@@ -688,15 +706,6 @@ jobs:
688706 echo "number=${{ steps.PR_from_push.outputs.number || github.event.pull_request.number }}" | tee -a "$GITHUB_OUTPUT"
689707 echo "pr_labels=${{ steps.PR_from_push.outputs.pr_labels || join(github.event.pull_request.labels.*.name, ',') }}" | tee -a "$GITHUB_OUTPUT"
690708
691- - if : contains(steps.PR.outputs.pr_labels, 'bench-after-CI')
692- name : If `bench-after-CI` is present, add a `!bench` comment.
693- uses : GrantBirki/comment@608e41b19bc973020ec0e189ebfdae935d7fe0cc # v2.1.1
694- with :
695- token : ${{ secrets.AUTO_MERGE_TOKEN }}
696- issue-number : ${{ steps.PR.outputs.number }}
697- body : |
698- !bench
699-
700709 - id : remove_labels
701710 name : Remove "awaiting-CI"
702711 # we use curl rather than octokit/request-action so that the job won't fail
@@ -713,7 +722,7 @@ jobs:
713722 # unfortunately we cannot query only for 'auto-merge-after-CI' events
714723 # so we have to process this with jq in the next step
715724 id : get-timeline
716- uses : octokit/graphql-action@8ad880e4d437783ea2ab17010324de1075228110 # v2.3 .2
725+ uses : octokit/graphql-action@ddde8ebb2493e79f390e6449c725c21663a67505 # v3.0 .2
717726 with :
718727 query : |
719728 query($owner: String!, $name: String!, $number: Int!) {
0 commit comments