Skip to content

Commit 219bed6

Browse files
Update lean-toolchain for leanprover/lean4#10785
2 parents 4a3a28c + 985e8a8 commit 219bed6

File tree

1,331 files changed

+24948
-8995
lines changed

Some content is hidden

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

1,331 files changed

+24948
-8995
lines changed

.github/build.in.yml

Lines changed: 31 additions & 99 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.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

@@ -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
@@ -328,37 +342,6 @@ jobs:
328342
env:
329343
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
330344

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-
362345
# Note: we should not be including `Archive` and `Counterexamples` in the cache.
363346
# We do this for now for the sake of not rebuilding them in every CI run
364347
# even when they are not touched.
@@ -409,41 +392,11 @@ jobs:
409392
export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
410393
411394
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
395+
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
396+
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
414397
env:
415398
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
416399

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-
447400
- name: Check {Mathlib, Tactic, Counterexamples, Archive}.lean
448401
if: always()
449402
run: |
@@ -550,29 +503,6 @@ jobs:
550503
use-mathlib-cache: false # This can be re-enabled once we are confident in the cache again.
551504
reinstall-transient-toolchain: true
552505

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-
576506
- name: get cache for Mathlib
577507
run: |
578508
# Run once without --repo, so we can diagnose what `lake exe cache get` wants to do by itself.
@@ -590,13 +520,13 @@ jobs:
590520
- name: verify that everything was available in the cache
591521
run: |
592522
echo "::group::{verify Mathlib cache}"
593-
lake build --no-build -v Mathlib
523+
lake build --no-build --rehash -v Mathlib
594524
echo "::endgroup::"
595525
echo "::group::{verify Archive cache}"
596-
lake build --no-build -v Archive
526+
lake build --no-build --rehash -v Archive
597527
echo "::endgroup::"
598528
echo "::group::{verify Counterexamples cache}"
599-
lake build --no-build -v Counterexamples
529+
lake build --no-build --rehash -v Counterexamples
600530
echo "::endgroup::"
601531
602532
- name: check declarations in db files
@@ -622,14 +552,16 @@ jobs:
622552

623553
- name: build everything
624554
# make sure everything is available for test/import_all.lean
555+
# and that miscellaneous executables still work
625556
run: |
626-
lake build Batteries Qq Aesop ProofWidgets Plausible
557+
lake build Batteries Qq Aesop ProofWidgets Plausible pole unused
627558
628-
- name: build AesopTest (nightly-testing only)
629-
# Only run on the mathlib4-nightly-testing repository
630-
if: github.repository == 'leanprover-community/mathlib4-nightly-testing'
631-
run: |
632-
lake build AesopTest
559+
# temporarily comment out
560+
# - name: build AesopTest (nightly-testing only)
561+
# # Only run on the mathlib4-nightly-testing repository
562+
# if: github.repository == 'leanprover-community/mathlib4-nightly-testing'
563+
# run: |
564+
# lake build AesopTest
633565

634566
# We no longer run `lean4checker` in regular CI, as it is quite expensive for little benefit.
635567
# Instead we run it in a cron job on master: see `lean4checker.yml`.

.github/workflows/bors.yml

Lines changed: 31 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ env:
2525
concurrency:
2626
# label each workflow run; only the latest with each label will run
2727
# workflows on master get more expressive labels
28-
group: ${{ github.workflow }}-${{ github.ref }}.
29-
${{ ( contains(fromJSON( '["refs/heads/master", "refs/heads/staging"]'), github.ref ) && github.run_id) || ''}}
28+
group: ${{ github.workflow }}-${{ github.ref }}-${{ (contains(fromJSON('["refs/heads/master", "refs/heads/staging"]'), github.ref) && github.run_id) || '' }}
3029
# cancel any running workflow with the same label
3130
cancel-in-progress: true
3231

@@ -142,8 +141,23 @@ jobs:
142141
- name: set LEAN_SRC_PATH
143142
shell: bash
144143
run: |
145-
# Construct the LEAN_SRC_PATH using the toolchain directory
146-
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"
144+
cd pr-branch
145+
146+
# Start with the base paths
147+
LEAN_SRC_PATH=".:$TOOLCHAIN_DIR/src/lean/lake"
148+
149+
# Extract package names from lake-manifest.json and validate them
150+
# Only allow A-Z, a-z, 0-9, _, and - characters
151+
# Build the LEAN_SRC_PATH by appending each validated package
152+
PACKAGE_NAMES=$(jq -r '.packages[].name' lake-manifest.json)
153+
for pkg in $PACKAGE_NAMES; do
154+
if [[ "$pkg" =~ ^[A-Za-z0-9_-]+$ ]]; then
155+
LEAN_SRC_PATH="$LEAN_SRC_PATH:.lake/packages/$pkg"
156+
else
157+
echo "Warning: Skipping invalid package name: $pkg"
158+
fi
159+
done
160+
147161
echo "LEAN_SRC_PATH=$LEAN_SRC_PATH"
148162
149163
# Set it as an environment variable for subsequent steps
@@ -338,37 +352,6 @@ jobs:
338352
env:
339353
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
340354

341-
# The cache secrets are available here, so we must not run any untrusted code.
342-
- name: Upload cache to Cloudflare
343-
id: cloudflare-upload-mathlib
344-
if: ${{ always() && steps.get.outcome == 'success' }}
345-
continue-on-error: true
346-
shell: bash
347-
run: |
348-
cd pr-branch
349-
350-
# Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
351-
export MATHLIB_CACHE_S3_TOKEN="${MATHLIB_CACHE_S3_TOKEN_RAW%"${MATHLIB_CACHE_S3_TOKEN_RAW##*[![:space:]]}"}"
352-
353-
echo "Uploading cache to Cloudflare..."
354-
USE_FRO_CACHE=1 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked
355-
env:
356-
MATHLIB_CACHE_S3_TOKEN_RAW: ${{ secrets.MATHLIB_CACHE_S3_TOKEN }}
357-
358-
- name: Report Cloudflare upload failure on Zulip
359-
if: steps.cloudflare-upload-mathlib.outcome == 'failure'
360-
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
361-
with:
362-
api-key: ${{ secrets.ZULIP_API_KEY }}
363-
364-
organization-url: 'https://leanprover.zulipchat.com'
365-
to: 'nightly-testing'
366-
type: 'stream'
367-
topic: 'Cloudflare cache upload failure'
368-
content: |
369-
❌ 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 }}
370-
continue-on-error: true
371-
372355
# Note: we should not be including `Archive` and `Counterexamples` in the cache.
373356
# We do this for now for the sake of not rebuilding them in every CI run
374357
# even when they are not touched.
@@ -419,41 +402,11 @@ jobs:
419402
export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
420403
421404
echo "Uploading Archive and Counterexamples cache to Azure..."
422-
USE_FRO_CACHE=0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Archive.lean
423-
USE_FRO_CACHE=0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Counterexamples.lean
405+
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
406+
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
424407
env:
425408
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
426409

427-
- name: Upload Archive and Counterexamples cache to Cloudflare
428-
id: cloudflare-upload-archive
429-
continue-on-error: true
430-
shell: bash
431-
run: |
432-
cd pr-branch
433-
434-
# Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
435-
export MATHLIB_CACHE_S3_TOKEN="${MATHLIB_CACHE_S3_TOKEN_RAW%"${MATHLIB_CACHE_S3_TOKEN_RAW##*[![:space:]]}"}"
436-
437-
echo "Uploading Archive and Counterexamples cache to Cloudflare..."
438-
USE_FRO_CACHE=1 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Archive.lean
439-
USE_FRO_CACHE=1 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Counterexamples.lean
440-
env:
441-
MATHLIB_CACHE_S3_TOKEN_RAW: ${{ secrets.MATHLIB_CACHE_S3_TOKEN }}
442-
443-
- name: Report Cloudflare Archive/Counterexamples upload failure on Zulip
444-
if: steps.cloudflare-upload-archive.outcome == 'failure'
445-
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
446-
with:
447-
api-key: ${{ secrets.ZULIP_API_KEY }}
448-
449-
organization-url: 'https://leanprover.zulipchat.com'
450-
to: 'nightly-testing'
451-
type: 'stream'
452-
topic: 'Cloudflare cache upload failure'
453-
content: |
454-
❌ 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 }}
455-
continue-on-error: true
456-
457410
- name: Check {Mathlib, Tactic, Counterexamples, Archive}.lean
458411
if: always()
459412
run: |
@@ -560,29 +513,6 @@ jobs:
560513
use-mathlib-cache: false # This can be re-enabled once we are confident in the cache again.
561514
reinstall-transient-toolchain: true
562515

563-
- name: retrieve and test the Cloudflare caches, but don't fail, just report to Zulip, if anything goes wrong
564-
id: cloudflare-cache
565-
continue-on-error: true
566-
run: |
567-
lake exe cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} get
568-
lake build --no-build -v Mathlib
569-
lake exe cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} get Archive Counterexamples
570-
lake build --no-build -v Archive Counterexamples
571-
572-
- name: Report Cloudflare cache failure on Zulip
573-
if: steps.cloudflare-cache.outcome == 'failure'
574-
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
575-
with:
576-
api-key: ${{ secrets.ZULIP_API_KEY }}
577-
578-
organization-url: 'https://leanprover.zulipchat.com'
579-
to: 'nightly-testing'
580-
type: 'stream'
581-
topic: 'Cloudflare cache failure'
582-
content: |
583-
❌ 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 }}
584-
continue-on-error: true
585-
586516
- name: get cache for Mathlib
587517
run: |
588518
# Run once without --repo, so we can diagnose what `lake exe cache get` wants to do by itself.
@@ -600,13 +530,13 @@ jobs:
600530
- name: verify that everything was available in the cache
601531
run: |
602532
echo "::group::{verify Mathlib cache}"
603-
lake build --no-build -v Mathlib
533+
lake build --no-build --rehash -v Mathlib
604534
echo "::endgroup::"
605535
echo "::group::{verify Archive cache}"
606-
lake build --no-build -v Archive
536+
lake build --no-build --rehash -v Archive
607537
echo "::endgroup::"
608538
echo "::group::{verify Counterexamples cache}"
609-
lake build --no-build -v Counterexamples
539+
lake build --no-build --rehash -v Counterexamples
610540
echo "::endgroup::"
611541
612542
- name: check declarations in db files
@@ -632,14 +562,16 @@ jobs:
632562

633563
- name: build everything
634564
# make sure everything is available for test/import_all.lean
565+
# and that miscellaneous executables still work
635566
run: |
636-
lake build Batteries Qq Aesop ProofWidgets Plausible
567+
lake build Batteries Qq Aesop ProofWidgets Plausible pole unused
637568
638-
- name: build AesopTest (nightly-testing only)
639-
# Only run on the mathlib4-nightly-testing repository
640-
if: github.repository == 'leanprover-community/mathlib4-nightly-testing'
641-
run: |
642-
lake build AesopTest
569+
# temporarily comment out
570+
# - name: build AesopTest (nightly-testing only)
571+
# # Only run on the mathlib4-nightly-testing repository
572+
# if: github.repository == 'leanprover-community/mathlib4-nightly-testing'
573+
# run: |
574+
# lake build AesopTest
643575

644576
# We no longer run `lean4checker` in regular CI, as it is quite expensive for little benefit.
645577
# Instead we run it in a cron job on master: see `lean4checker.yml`.

0 commit comments

Comments
 (0)