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.ref }}-${{ (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
@@ -64,11 +63,11 @@ jobs:
6463
6564 # The Hoskinson runners may not have jq installed, so do that now.
6665 - name : ' Setup jq'
67- uses : dcarbone/install-jq-action@f0e10f46ff84f4d32178b4b76e1ef180b16f82c3 # v3.1.1
66+ uses : dcarbone/install-jq-action@b7ef57d46ece78760b4019dbc4080a1ba2a40b45 # v3.2.0
6867
6968 # Checkout the master branch into a subdirectory
7069 - name : Checkout master branch
71- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
70+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
7271 with :
7372 # Recall that on the `leanprover-community/mathlib4-nightly-testing` repository,
7473 # we don't maintain a `master` branch at all.
7877
7978 # Checkout the PR branch into a subdirectory
8079 - name : Checkout PR branch
81- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
80+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
8281 with :
8382 ref : " ${{ PR_BRANCH_REF }}"
8483 path : pr-branch
@@ -132,8 +131,23 @@ jobs:
132131 - name : set LEAN_SRC_PATH
133132 shell : bash
134133 run : |
135- # Construct the LEAN_SRC_PATH using the toolchain directory
136- LEAN_SRC_PATH=".:$TOOLCHAIN_DIR/src/lean/lake:.lake/packages/Cli:.lake/packages/batteries:.lake/packages/Qq:.lake/packages/aesop:.lake/packages/proofwidgets:.lake/packages/importGraph:.lake/packages/LeanSearchClient:.lake/packages/plausible"
134+ cd pr-branch
135+
136+ # Start with the base paths
137+ LEAN_SRC_PATH=".:$TOOLCHAIN_DIR/src/lean/lake"
138+
139+ # Extract package names from lake-manifest.json and validate them
140+ # Only allow A-Z, a-z, 0-9, _, and - characters
141+ # Build the LEAN_SRC_PATH by appending each validated package
142+ PACKAGE_NAMES=$(jq -r '.packages[].name' lake-manifest.json)
143+ for pkg in $PACKAGE_NAMES; do
144+ if [[ "$pkg" =~ ^[A-Za-z0-9_-]+$ ]]; then
145+ LEAN_SRC_PATH="$LEAN_SRC_PATH:.lake/packages/$pkg"
146+ else
147+ echo "Warning: Skipping invalid package name: $pkg"
148+ fi
149+ done
150+
137151 echo "LEAN_SRC_PATH=$LEAN_SRC_PATH"
138152
139153 # Set it as an environment variable for subsequent steps
@@ -281,6 +295,7 @@ jobs:
281295 echo "::endgroup::"
282296
283297 ../master-branch/scripts/lake-build-with-retry.sh Mathlib
298+ # results of build at pr-branch/.lake/build_summary_Mathlib*.json
284299 - name : end gh-problem-match-wrap for build step
285300 uses : leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
286301 with :
@@ -294,7 +309,7 @@ jobs:
294309
295310 - name : upload artifact containing contents of pr-branch
296311 # temporary measure for debugging no-build failures
297- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
312+ uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
298313 with :
299314 name : mathlib4_artifact
300315 include-hidden-files : true
@@ -328,37 +343,6 @@ jobs:
328343 env :
329344 MATHLIB_CACHE_SAS_RAW : ${{ secrets.MATHLIB_CACHE_SAS }}
330345
331- # The cache secrets are available here, so we must not run any untrusted code.
332- - name : Upload cache to Cloudflare
333- id : cloudflare-upload-mathlib
334- if : ${{ always() && steps.get.outcome == 'success' }}
335- continue-on-error : true
336- shell : bash
337- run : |
338- cd pr-branch
339-
340- # Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
341- export MATHLIB_CACHE_S3_TOKEN="${MATHLIB_CACHE_S3_TOKEN_RAW%"${MATHLIB_CACHE_S3_TOKEN_RAW##*[![:space:]]}"}"
342-
343- echo "Uploading cache to Cloudflare..."
344- USE_FRO_CACHE=1 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked
345- env :
346- MATHLIB_CACHE_S3_TOKEN_RAW : ${{ secrets.MATHLIB_CACHE_S3_TOKEN }}
347-
348- - name : Report Cloudflare upload failure on Zulip
349- if : steps.cloudflare-upload-mathlib.outcome == 'failure'
350- uses : zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
351- with :
352- api-key : ${{ secrets.ZULIP_API_KEY }}
353- email : ' github-mathlib4-bot@leanprover.zulipchat.com'
354- organization-url : ' https://leanprover.zulipchat.com'
355- to : ' nightly-testing'
356- type : ' stream'
357- topic : ' Cloudflare cache upload failure'
358- content : |
359- ❌ Cloudflare cache upload (Mathlib) [failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for PR #${{ github.event.pull_request.number || 'push' }} on commit ${{ github.sha }}
360- continue-on-error : true
361-
362346 # Note: we should not be including `Archive` and `Counterexamples` in the cache.
363347 # We do this for now for the sake of not rebuilding them in every CI run
364348 # even when they are not touched.
@@ -380,13 +364,15 @@ jobs:
380364 run : |
381365 cd pr-branch
382366 ../master-branch/scripts/lake-build-with-retry.sh Archive
367+ # results of build at pr-branch/.lake/build_summary_Archive*.json
383368
384369 - name : build counterexamples
385370 id : counterexamples
386371 continue-on-error : true
387372 run : |
388373 cd pr-branch
389374 ../master-branch/scripts/lake-build-with-retry.sh Counterexamples
375+ # results of build at pr-branch/.lake/build_summary_Counterexamples*.json
390376
391377 - name : Check if building Archive or Counterexamples failed
392378 if : steps.archive.outcome == 'failure' || steps.counterexamples.outcome == 'failure'
@@ -409,41 +395,11 @@ jobs:
409395 export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
410396
411397 echo "Uploading Archive and Counterexamples cache to Azure..."
412- USE_FRO_CACHE=0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Archive.lean
413- USE_FRO_CACHE=0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Counterexamples.lean
398+ 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
399+ 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
414400 env :
415401 MATHLIB_CACHE_SAS_RAW : ${{ secrets.MATHLIB_CACHE_SAS }}
416402
417- - name : Upload Archive and Counterexamples cache to Cloudflare
418- id : cloudflare-upload-archive
419- continue-on-error : true
420- shell : bash
421- run : |
422- cd pr-branch
423-
424- # Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
425- export MATHLIB_CACHE_S3_TOKEN="${MATHLIB_CACHE_S3_TOKEN_RAW%"${MATHLIB_CACHE_S3_TOKEN_RAW##*[![:space:]]}"}"
426-
427- echo "Uploading Archive and Counterexamples cache to Cloudflare..."
428- USE_FRO_CACHE=1 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Archive.lean
429- USE_FRO_CACHE=1 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Counterexamples.lean
430- env :
431- MATHLIB_CACHE_S3_TOKEN_RAW : ${{ secrets.MATHLIB_CACHE_S3_TOKEN }}
432-
433- - name : Report Cloudflare Archive/Counterexamples upload failure on Zulip
434- if : steps.cloudflare-upload-archive.outcome == 'failure'
435- uses : zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
436- with :
437- api-key : ${{ secrets.ZULIP_API_KEY }}
438- email : ' github-mathlib4-bot@leanprover.zulipchat.com'
439- organization-url : ' https://leanprover.zulipchat.com'
440- to : ' nightly-testing'
441- type : ' stream'
442- topic : ' Cloudflare cache upload failure'
443- content : |
444- ❌ Cloudflare cache upload (Archive/Counterexamples) [failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for PR #${{ github.event.pull_request.number || 'push' }} on commit ${{ github.sha }}
445- continue-on-error : true
446-
447403 - name : Check {Mathlib, Tactic, Counterexamples, Archive}.lean
448404 if : always()
449405 run : |
@@ -538,41 +494,18 @@ jobs:
538494 runs-on : ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed.
539495 steps :
540496
541- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
497+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
542498 with :
543499 ref : " ${{ PR_BRANCH_REF }}"
544500
545501 - name : Configure Lean
546- uses : leanprover/lean-action@f807b338d95de7813c5c50d018f1c23c9b93b4ec # 2025-04-24
502+ uses : leanprover/lean-action@434f25c2f80ded67bba02502ad3a86f25db50709 # v1.3.0
547503 with :
548504 auto-config : false # Don't run `lake build`, `lake test`, or `lake lint` automatically.
549505 use-github-cache : false
550506 use-mathlib-cache : false # This can be re-enabled once we are confident in the cache again.
551507 reinstall-transient-toolchain : true
552508
553- - name : retrieve and test the Cloudflare caches, but don't fail, just report to Zulip, if anything goes wrong
554- id : cloudflare-cache
555- continue-on-error : true
556- run : |
557- lake exe cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} get
558- lake build --no-build -v Mathlib
559- lake exe cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} get Archive Counterexamples
560- lake build --no-build -v Archive Counterexamples
561-
562- - name : Report Cloudflare cache failure on Zulip
563- if : steps.cloudflare-cache.outcome == 'failure'
564- uses : zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
565- with :
566- api-key : ${{ secrets.ZULIP_API_KEY }}
567- email : ' github-mathlib4-bot@leanprover.zulipchat.com'
568- organization-url : ' https://leanprover.zulipchat.com'
569- to : ' nightly-testing'
570- type : ' stream'
571- topic : ' Cloudflare cache failure'
572- content : |
573- ❌ Cloudflare cache retrieval/test [failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for PR #${{ github.event.pull_request.number || 'push' }} on commit ${{ github.sha }}
574- continue-on-error : true
575-
576509 - name : get cache for Mathlib
577510 run : |
578511 # Run once without --repo, so we can diagnose what `lake exe cache get` wants to do by itself.
@@ -590,13 +523,13 @@ jobs:
590523 - name : verify that everything was available in the cache
591524 run : |
592525 echo "::group::{verify Mathlib cache}"
593- lake build --no-build -v Mathlib
526+ lake build --no-build --rehash - v Mathlib
594527 echo "::endgroup::"
595528 echo "::group::{verify Archive cache}"
596- lake build --no-build -v Archive
529+ lake build --no-build --rehash - v Archive
597530 echo "::endgroup::"
598531 echo "::group::{verify Counterexamples cache}"
599- lake build --no-build -v Counterexamples
532+ lake build --no-build --rehash - v Counterexamples
600533 echo "::endgroup::"
601534
602535 - name : check declarations in db files
@@ -609,7 +542,7 @@ jobs:
609542 lake exe graph
610543
611544 - name : upload the import graph
612- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
545+ uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
613546 with :
614547 name : import-graph
615548 path : import_graph.dot
@@ -622,8 +555,9 @@ jobs:
622555
623556 - name : build everything
624557 # make sure everything is available for test/import_all.lean
558+ # and that miscellaneous executables still work
625559 run : |
626- lake build Batteries Qq Aesop ProofWidgets Plausible
560+ lake build Batteries Qq Aesop ProofWidgets Plausible pole unused
627561
628562 - name : build AesopTest (nightly-testing only)
629563 # Only run on the mathlib4-nightly-testing repository
0 commit comments