@@ -506,15 +506,34 @@ jobs:
506506 # cd pr-branch
507507 # env LEAN_ABORT_ON_PANIC=1 lake exe shake --gh-style
508508
509+ - name : kill stray runLinter processes
510+ if : ${{ always() && steps.build.outcome == 'success' || steps.build.outcome == 'failure' }}
511+ continue-on-error : true
512+ shell : bash
513+ run : |
514+ echo "Checking for runLinter processes..."
515+ if ps -eo pid,lstart,command | grep -F runLinter | grep -v grep; then
516+ echo "Killing runLinter processes..."
517+ pkill -f runLinter || true
518+ else
519+ echo "No stray runLinter processes found."
520+ fi
521+
509522 - name : lint mathlib
510523 if : ${{ always() && steps.build.outcome == 'success' || steps.build.outcome == 'failure' }}
511524 id : lint
525+ timeout-minutes : 40
512526 run : |
513527 cd pr-branch
528+ set -o pipefail
514529 # Try running with --trace; if it fails due to argument parsing, the PR needs to merge master
515530 # We use .lake/ for the output file because landrun restricts /tmp access
516- if ! env LEAN_ABORT_ON_PANIC=1 stdbuf -oL lake exe runLinter --trace Mathlib 2>&1 | tee .lake/lint_output.txt; then
517- if grep -q "cannot parse arguments" .lake/lint_output.txt; then
531+ for attempt in 1 2; do
532+ if timeout 15m env LEAN_ABORT_ON_PANIC=1 stdbuf -oL lake exe runLinter --trace Mathlib 2>&1 | tee ".lake/lint_output_attempt_${attempt}.txt"; then
533+ break
534+ fi
535+ status=${PIPESTATUS[0]}
536+ if grep -q "cannot parse arguments" ".lake/lint_output_attempt_${attempt}.txt"; then
518537 echo ""
519538 echo "=============================================================================="
520539 echo "ERROR: Your branch uses an older version of runLinter that doesn't support"
@@ -527,9 +546,24 @@ jobs:
527546 echo " git push"
528547 echo "=============================================================================="
529548 echo ""
549+ exit 1
530550 fi
531- exit 1
532- fi
551+ if [ "$status" -eq 124 ]; then
552+ echo "runLinter timed out (attempt $attempt)."
553+ if [ "$attempt" -lt 2 ]; then
554+ echo "Checking for runLinter processes..."
555+ if ps -eo pid,lstart,command | grep -F runLinter | grep -v grep; then
556+ echo "Killing runLinter processes..."
557+ pkill -f runLinter || true
558+ else
559+ echo "No stray runLinter processes found."
560+ fi
561+ echo "Retrying runLinter after timeout..."
562+ continue
563+ fi
564+ fi
565+ exit $status
566+ done
533567
534568 - name : end gh-problem-match-wrap for shake and lint steps
535569 uses : leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
@@ -555,6 +589,15 @@ jobs:
555589 exit 1
556590 fi
557591
592+ - name : list stray runLinter processes
593+ shell : bash
594+ if : always()
595+ run : |
596+ echo "Checking for runLinter processes..."
597+ if ! ps -eo pid,lstart,command | grep -F runLinter | grep -v grep; then
598+ echo "No stray runLinter processes found."
599+ fi
600+
558601 - name : Post comments for lean-pr-testing-NNNN and batteries-pr-testing-NNNN branches
559602 if : always()
560603 shell : bash
@@ -652,34 +695,7 @@ jobs:
652695 lake build AesopTest
653696
654697 # We no longer run `lean4checker` in regular CI, as it is quite expensive for little benefit.
655- # Instead we run it in a cron job on master: see `lean4checker.yml`.
656- # Output is posted to the zulip topic
657- # https://leanprover.zulipchat.com/#narrow/stream/345428-mathlib-reviewers/topic/lean4checker
658-
659- - name : checkout lean4checker
660- if : ${{ (always() && needs.build.outputs.build-outcome == 'success' || needs.build.outputs.build-outcome == 'failure') && contains(github.event.pull_request.changed_files, 'lean-toolchain') }}
661- shell : bash
662- run : |
663- git clone https://github.com/leanprover/lean4checker
664- cd lean4checker
665- # Read lean-toolchain file and checkout appropriate branch
666- TOOLCHAIN=$(cat ../lean-toolchain)
667- if [[ "$TOOLCHAIN" =~ ^leanprover/lean4:v ]]; then
668- VERSION=${TOOLCHAIN#leanprover/lean4:}
669- git checkout "$VERSION"
670- else
671- git checkout master
672- fi
673-
674- - name : run leanchecker on itself
675- if : ${{ (always() && needs.build.outputs.build-outcome == 'success' || needs.build.outputs.build-outcome == 'failure') && contains(github.event.pull_request.changed_files, 'lean-toolchain') }}
676- run : |
677- cd lean4checker
678- # Build lean4checker using the same toolchain
679- cp ../lean-toolchain .
680- lake build
681- lake -q exe lean4checker Lean4Checker
682-
698+ # Instead we run it in a cron job on master: see `daily.yml`.
683699 style_lint :
684700 name : Lint style
685701 if : github.repository == 'leanprover-community/mathlib4' || github.repository == 'leanprover-community/mathlib4-nightly-testing'
0 commit comments