Skip to content

Commit d9c8e7a

Browse files
Update lean-toolchain for leanprover/lean4#11019
2 parents f60fa36 + 97d6356 commit d9c8e7a

File tree

2,508 files changed

+51353
-22162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,508 files changed

+51353
-22162
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,26 @@ In particular, note that most reviewers will only notice your PR
1111
if it passes the continuous integration checks.
1212
Please ask for help on https://leanprover.zulipchat.com if needed.
1313
14-
To indicate co-authors, include at least one commit authored by each
15-
co-author among the commits in the pull request. If necessary, you may
16-
create empty commits to indicate co-authorship, using commands like so:
14+
When merging, all the commits will be squashed into a single commit
15+
listing all co-authors.
16+
17+
Co-authors in the squash commit are gathered from two sources:
18+
19+
First, all authors of commits to this PR branch are included. Thus,
20+
one way to add co-authors is to include at least one commit authored by
21+
each co-author among the commits in the pull request. If necessary, you
22+
may create empty commits to indicate co-authorship, using commands like so:
1723
1824
git commit --author="Author Name <[email protected]>" --allow-empty -m "add Author Name as coauthor"
1925
20-
When merging, all the commits will be squashed into a single commit listing all co-authors.
26+
Second, co-authors can also be listed in lines at the very bottom of
27+
the commit message (that is, directly before the `---`) using the following format:
28+
29+
Co-authored-by: Author Name <[email protected]>
2130
22-
If you are moving or deleting declarations, please include these lines at the bottom of the commit message
23-
(that is, before the `---`) using the following format:
31+
If you are moving or deleting declarations, please include these lines
32+
at the bottom of the commit message (before the `---`, and also before
33+
any "Co-authored-by" lines) using the following format:
2434
2535
Moves:
2636
- Vector.* -> List.Vector.*

.github/build.in.yml

Lines changed: 49 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ env:
1515
concurrency:
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

@@ -42,9 +41,20 @@ jobs:
4241
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.
@@ -78,7 +88,7 @@ jobs:
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
@@ -132,8 +142,23 @@ jobs:
132142
- name: set LEAN_SRC_PATH
133143
shell: bash
134144
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"
145+
cd pr-branch
146+
147+
# Start with the base paths
148+
LEAN_SRC_PATH=".:$TOOLCHAIN_DIR/src/lean/lake"
149+
150+
# Extract package names from lake-manifest.json and validate them
151+
# Only allow A-Z, a-z, 0-9, _, and - characters
152+
# Build the LEAN_SRC_PATH by appending each validated package
153+
PACKAGE_NAMES=$(jq -r '.packages[].name' lake-manifest.json)
154+
for pkg in $PACKAGE_NAMES; do
155+
if [[ "$pkg" =~ ^[A-Za-z0-9_-]+$ ]]; then
156+
LEAN_SRC_PATH="$LEAN_SRC_PATH:.lake/packages/$pkg"
157+
else
158+
echo "Warning: Skipping invalid package name: $pkg"
159+
fi
160+
done
161+
137162
echo "LEAN_SRC_PATH=$LEAN_SRC_PATH"
138163
139164
# Set it as an environment variable for subsequent steps
@@ -281,6 +306,7 @@ jobs:
281306
echo "::endgroup::"
282307
283308
../master-branch/scripts/lake-build-with-retry.sh Mathlib
309+
# results of build at pr-branch/.lake/build_summary_Mathlib.json
284310
- name: end gh-problem-match-wrap for build step
285311
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
286312
with:
@@ -294,7 +320,7 @@ jobs:
294320
295321
- name: upload artifact containing contents of pr-branch
296322
# temporary measure for debugging no-build failures
297-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
323+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
298324
with:
299325
name: mathlib4_artifact
300326
include-hidden-files: true
@@ -328,37 +354,6 @@ jobs:
328354
env:
329355
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
330356

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-
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-
362357
# Note: we should not be including `Archive` and `Counterexamples` in the cache.
363358
# We do this for now for the sake of not rebuilding them in every CI run
364359
# even when they are not touched.
@@ -380,13 +375,15 @@ jobs:
380375
run: |
381376
cd pr-branch
382377
../master-branch/scripts/lake-build-with-retry.sh Archive
378+
# results of build at pr-branch/.lake/build_summary_Archive.json
383379
384380
- name: build counterexamples
385381
id: counterexamples
386382
continue-on-error: true
387383
run: |
388384
cd pr-branch
389385
../master-branch/scripts/lake-build-with-retry.sh Counterexamples
386+
# results of build at pr-branch/.lake/build_summary_Counterexamples.json
390387
391388
- name: Check if building Archive or Counterexamples failed
392389
if: steps.archive.outcome == 'failure' || steps.counterexamples.outcome == 'failure'
@@ -409,41 +406,11 @@ jobs:
409406
export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
410407
411408
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
409+
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
410+
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
414411
env:
415412
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
416413

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-
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-
447414
- name: Check {Mathlib, Tactic, Counterexamples, Archive}.lean
448415
if: always()
449416
run: |
@@ -463,7 +430,7 @@ jobs:
463430
id: test
464431
run: |
465432
cd pr-branch
466-
lake --iofail test
433+
../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_MathlibTest.json lake --iofail test
467434
- name: end gh-problem-match-wrap for test step
468435
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
469436
with:
@@ -487,7 +454,7 @@ jobs:
487454
id: lint
488455
run: |
489456
cd pr-branch
490-
env LEAN_ABORT_ON_PANIC=1 lake exe runLinter Mathlib
457+
env LEAN_ABORT_ON_PANIC=1 ../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_lint.json lake exe runLinter Mathlib
491458
492459
- name: end gh-problem-match-wrap for shake and lint steps
493460
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
@@ -538,41 +505,18 @@ jobs:
538505
runs-on: ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed.
539506
steps:
540507

541-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
508+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
542509
with:
543510
ref: "${{ PR_BRANCH_REF }}"
544511

545512
- name: Configure Lean
546-
uses: leanprover/lean-action@f807b338d95de7813c5c50d018f1c23c9b93b4ec # 2025-04-24
513+
uses: leanprover/lean-action@434f25c2f80ded67bba02502ad3a86f25db50709 # v1.3.0
547514
with:
548515
auto-config: false # Don't run `lake build`, `lake test`, or `lake lint` automatically.
549516
use-github-cache: false
550517
use-mathlib-cache: false # This can be re-enabled once we are confident in the cache again.
551518
reinstall-transient-toolchain: true
552519

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-
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-
576520
- name: get cache for Mathlib
577521
run: |
578522
# Run once without --repo, so we can diagnose what `lake exe cache get` wants to do by itself.
@@ -590,13 +534,13 @@ jobs:
590534
- name: verify that everything was available in the cache
591535
run: |
592536
echo "::group::{verify Mathlib cache}"
593-
lake build --no-build -v Mathlib
537+
lake build --no-build --rehash -v Mathlib
594538
echo "::endgroup::"
595539
echo "::group::{verify Archive cache}"
596-
lake build --no-build -v Archive
540+
lake build --no-build --rehash -v Archive
597541
echo "::endgroup::"
598542
echo "::group::{verify Counterexamples cache}"
599-
lake build --no-build -v Counterexamples
543+
lake build --no-build --rehash -v Counterexamples
600544
echo "::endgroup::"
601545
602546
- name: check declarations in db files
@@ -609,7 +553,7 @@ jobs:
609553
lake exe graph
610554
611555
- name: upload the import graph
612-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
556+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
613557
with:
614558
name: import-graph
615559
path: import_graph.dot
@@ -622,8 +566,9 @@ jobs:
622566

623567
- name: build everything
624568
# make sure everything is available for test/import_all.lean
569+
# and that miscellaneous executables still work
625570
run: |
626-
lake build Batteries Qq Aesop ProofWidgets Plausible
571+
lake build Batteries Qq Aesop ProofWidgets Plausible pole unused
627572
628573
- name: build AesopTest (nightly-testing only)
629574
# Only run on the mathlib4-nightly-testing repository

.github/workflows/PR_summary.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2121
with:
2222
ref: ${{ github.event.pull_request.head.sha }}
2323
fetch-depth: 0
2424
path: pr-branch
2525

2626
# Checkout the master branch into a subdirectory
2727
- name: Checkout master branch
28-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2929
with:
3030
# When testing the scripts, comment out the "ref: master"
3131
ref: master
@@ -60,7 +60,7 @@ jobs:
6060
fi
6161
6262
- name: Set up Python
63-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
63+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
6464
with:
6565
python-version: 3.12
6666

.github/workflows/actionlint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
13+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1414

1515
- name: suggester / actionlint
16-
uses: reviewdog/action-actionlint@a5524e1c19e62881d79c1f1b9b6f09f16356e281 # v1.65.2
16+
uses: reviewdog/action-actionlint@f00ad0691526c10be4021a91b2510f0a769b14d0 # v1.68.0
1717
with:
1818
tool_name: actionlint
1919
fail_level: error
@@ -22,15 +22,15 @@ jobs:
2222
name: check workflows generated by build.in.yml
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2626

2727
- name: update workflows
2828
run: |
2929
cd .github/workflows/
3030
./mk_build_yml.sh
3131
3232
- name: suggester / build.in.yml
33-
uses: reviewdog/action-suggester@4747dbc9f9e37adba0943e681cc20db466642158 # v1.21.0
33+
uses: reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff # v1.24.0
3434
with:
3535
tool_name: mk_build_yml.sh
3636
fail_level: error

0 commit comments

Comments
 (0)