Skip to content

Commit 29017da

Browse files
author
leanprover-community-mathlib4-bot
committed
Update lean-toolchain for leanprover/lean4#12481
2 parents a2f67d2 + 953f7b0 commit 29017da

File tree

3,801 files changed

+37806
-16768
lines changed

Some content is hidden

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

3,801 files changed

+37806
-16768
lines changed

.github/workflows/PR_summary.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,23 @@ jobs:
216216
echo "Compute technical debt changes"
217217
techDebtVar="$(../master-branch/scripts/technical-debt-metrics.sh pr_summary)"
218218
219+
echo "Compute documentation reminder"
220+
workflowFilesChanged="$(grep '^\.github/workflows/' changed_files.txt || true)"
221+
if [ -n "${workflowFilesChanged}" ]
222+
then
223+
# Format each changed workflow path as a Markdown bullet: "- `path`"
224+
workflowFilesChangedMarkdown="$(sed "s|^|- \`|; s|\$|\`|" <<< "${workflowFilesChanged}")"
225+
workflowDocsReminder="$(printf "### Workflow documentation reminder\nThis PR modifies files under \`.github/workflows/\`.\nPlease update \`docs/workflows.md\` if the workflow inventory, triggers, or behavior changed.\n\nModified workflow files:\n%s\n" "${workflowFilesChangedMarkdown}")"
226+
else
227+
workflowDocsReminder=""
228+
fi
229+
219230
# store in a file, to avoid "long arguments" error.
220231
printf '%s [%s](%s)%s\n\n%s\n\n---\n\n%s\n\n---\n\n%s\n' "${title}" "$(git rev-parse --short HEAD)" "${hashURL}" "${high_percentages}" "${importCount}" "${declDiff}" "${techDebtVar}" > please_merge_master.md
232+
if [ -n "${workflowDocsReminder}" ]
233+
then
234+
printf '\n\n---\n\n%s\n' "${workflowDocsReminder}" >> please_merge_master.md
235+
fi
221236
222237
echo "Include any errors about removed or renamed files without deprecation,"
223238
echo "as well as errors about extraneous deprecated_module additions."

.github/workflows/actionlint.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,16 @@ jobs:
1616
uses: reviewdog/action-actionlint@e58ee9d111489c31395fbe4857b0be6e7635dbda # v1.70.0
1717
with:
1818
tool_name: actionlint
19-
fail_level: error
19+
fail_level: any
20+
21+
ensure-sha-pinned-actions:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
27+
# Using our fork's PR branch until upstream merges the improved error reporting:
28+
# https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/pull/288
29+
# TODO: Update to upstream release once merged.
30+
- name: Ensure all actions are pinned to SHA
31+
uses: kim-em/github-actions-ensure-sha-pinned-actions@00f51cdb5bbc21f5bc873ef3a2dceef45df213af # improve-error-reporting

.github/workflows/build_template.yml

Lines changed: 141 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
build-outcome: ${{ steps.build.outcome }}
3838
archive-outcome: ${{ steps.archive.outcome }}
3939
counterexamples-outcome: ${{ steps.counterexamples.outcome }}
40+
cache-staging-has-files: ${{ steps.cache_staging_check.outputs.has_files }}
4041
get-cache-outcome: ${{ steps.get.outcome }}
4142
lint-outcome: ${{ steps.lint.outcome }}
4243
mk_all-outcome: ${{ steps.mk_all.outcome }}
@@ -242,6 +243,31 @@ jobs:
242243
echo "✅ All inputRevs in lake-manifest.json are valid"
243244
fi
244245
246+
- name: validate ProofWidgets source repository
247+
# Only enforce this on the main mathlib4 repository, not on nightly-testing
248+
if: github.repository == 'leanprover-community/mathlib4'
249+
shell: bash
250+
run: |
251+
cd pr-branch
252+
253+
expected_url='https://github.com/leanprover-community/ProofWidgets4'
254+
proofwidgets_count=$(jq '[.packages[] | select(.name == "proofwidgets")] | length' lake-manifest.json)
255+
if [ "$proofwidgets_count" -ne 1 ]; then
256+
echo "❌ Error: expected exactly one proofwidgets entry in lake-manifest.json, found $proofwidgets_count"
257+
exit 1
258+
fi
259+
260+
proofwidgets_url=$(jq -r '.packages[] | select(.name == "proofwidgets") | .url' lake-manifest.json)
261+
normalized_url="${proofwidgets_url%.git}"
262+
if [ "$normalized_url" != "$expected_url" ]; then
263+
echo "❌ Error: invalid ProofWidgets source URL in lake-manifest.json"
264+
echo " expected: $expected_url"
265+
echo " found: $proofwidgets_url"
266+
exit 1
267+
fi
268+
269+
echo "✅ ProofWidgets source URL is trusted: $proofwidgets_url"
270+
245271
- name: verify ProofWidgets lean-toolchain matches on versioned releases
246272
# Only enforce this on the main mathlib4 repository, not on nightly-testing
247273
if: github.repository == 'leanprover-community/mathlib4'
@@ -297,7 +323,7 @@ jobs:
297323
298324
# Fail quickly if the cache is completely cold, by checking for Mathlib.Init
299325
echo "Attempting to fetch olean for Mathlib/Init.lean from cache..."
300-
../tools-branch/.lake/build/bin/cache get Mathlib/Init.lean
326+
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get Mathlib/Init.lean
301327
302328
- name: get cache (2/3 - test Mathlib.Init cache)
303329
id: get_cache_part2_test
@@ -317,15 +343,23 @@ jobs:
317343
if [[ "${{ steps.get_cache_part2_test.outcome }}" == "success" ]]; then
318344
echo "Fetching all remaining cache..."
319345
320-
../tools-branch/.lake/build/bin/cache get
346+
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get
321347
322348
# Run again with --repo, to ensure we actually get the oleans.
323-
../tools-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} get
349+
../tools-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} --skip-proofwidgets get
324350
else
325351
echo "WARNING: 'lake build --no-build -v Mathlib.Init' failed."
326352
echo "No cache for 'Mathlib.Init' available or it could not be prepared."
327353
fi
328354
355+
- name: fetch ProofWidgets release
356+
# We need network access for ProofWidgets frontend assets.
357+
# Run inside landrun so PR-controlled code remains sandboxed.
358+
shell: landrun --unrestricted-network --rox /etc --rox /usr --rw /dev --rox /home/lean/.elan --rox /home/lean/actions-runner/_work --rw pr-branch/.lake/ --env PATH --env HOME --env GITHUB_OUTPUT --env CI -- bash -euxo pipefail {0}
359+
run: |
360+
cd pr-branch
361+
lake build proofwidgets:release
362+
329363
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
330364
id: mk_all
331365
continue-on-error: true # Allow workflow to continue, outcome checked later
@@ -367,31 +401,6 @@ jobs:
367401
cd pr-branch
368402
du .lake/build/lib/lean/Mathlib || echo "This code should be unreachable"
369403
370-
# The cache secrets are available here, so we must not run any untrusted code.
371-
- name: Upload cache to Azure
372-
# We only upload the cache if the build started (whether succeeding, failing, or cancelled)
373-
# but not if any earlier step failed or was cancelled.
374-
# See discussion at https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Some.20files.20not.20found.20in.20the.20cache/near/407183836
375-
if: ${{ always() && steps.get.outcome == 'success' }}
376-
shell: bash
377-
run: |
378-
cd pr-branch
379-
380-
# Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
381-
export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
382-
383-
# Use the trusted cache tool from tools-branch
384-
# TODO: this is not doing anything currently, and needs to be integrated with put-unpacked
385-
# ../tools-branch/.lake/build/bin/cache commit || true
386-
# run this in CI if it gets an incorrect lake hash for existing cache files somehow
387-
# ../tools-branch/.lake/build/bin/cache put!
388-
# do not try to upload files just downloaded
389-
390-
echo "Uploading cache to Azure..."
391-
MATHLIB_CACHE_USE_CLOUDFLARE=0 ../tools-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked
392-
env:
393-
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
394-
395404
# Note: we should not be including `Archive` and `Counterexamples` in the cache.
396405
# We do this for now for the sake of not rebuilding them in every CI run
397406
# even when they are not touched.
@@ -404,8 +413,8 @@ jobs:
404413
shell: bash
405414
run: |
406415
cd pr-branch
407-
../tools-branch/.lake/build/bin/cache get Archive.lean
408-
../tools-branch/.lake/build/bin/cache get Counterexamples.lean
416+
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get Archive.lean
417+
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get Counterexamples.lean
409418
410419
- name: build archive
411420
id: archive
@@ -423,6 +432,53 @@ jobs:
423432
../tools-branch/scripts/lake-build-with-retry.sh Counterexamples
424433
# results of build at pr-branch/.lake/build_summary_Counterexamples.json
425434
435+
- name: prepare staging directory
436+
if: ${{ always() && (steps.build.outcome == 'success' || steps.build.outcome == 'failure' || steps.build.outcome == 'cancelled') }}
437+
shell: bash
438+
run: |
439+
# Clean the staging directory first, though it should be empty at this point, to be safe
440+
rm -rf cache-staging
441+
mkdir -p cache-staging
442+
443+
- name: stage Mathlib cache files
444+
if: ${{ always() && (steps.build.outcome == 'success' || steps.build.outcome == 'failure' || steps.build.outcome == 'cancelled') }}
445+
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 /home/lean/.cache/mathlib/ --rw pr-branch/.lake/ --rw cache-staging/ --env PATH --env HOME --env GITHUB_OUTPUT --env CI -- bash -euxo pipefail {0}
446+
run: |
447+
cd pr-branch
448+
lake env ../tools-branch/.lake/build/bin/cache --staging-dir="../cache-staging" stage
449+
450+
- name: stage Archive cache files
451+
if: ${{ steps.archive.outcome == 'success' }}
452+
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 /home/lean/.cache/mathlib/ --rw pr-branch/.lake/ --rw cache-staging/ --env PATH --env HOME --env GITHUB_OUTPUT --env CI -- bash -euxo pipefail {0}
453+
run: |
454+
cd pr-branch
455+
lake env ../tools-branch/.lake/build/bin/cache --staging-dir="../cache-staging" stage Archive.lean
456+
457+
- name: stage Counterexamples cache files
458+
if: ${{ steps.counterexamples.outcome == 'success' }}
459+
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 /home/lean/.cache/mathlib/ --rw pr-branch/.lake/ --rw cache-staging/ --env PATH --env HOME --env GITHUB_OUTPUT --env CI -- bash -euxo pipefail {0}
460+
run: |
461+
cd pr-branch
462+
lake env ../tools-branch/.lake/build/bin/cache --staging-dir="../cache-staging" stage Counterexamples.lean
463+
464+
- name: check cache staging contents
465+
id: cache_staging_check
466+
if: ${{ always() && (steps.build.outcome == 'success' || steps.build.outcome == 'failure' || steps.build.outcome == 'cancelled') }}
467+
shell: bash
468+
run: |
469+
if find cache-staging -type f -name '*.ltar' -print -quit | grep -q .; then
470+
echo "has_files=true" >> "$GITHUB_OUTPUT"
471+
else
472+
echo "has_files=false" >> "$GITHUB_OUTPUT"
473+
fi
474+
475+
- name: upload cache staging artifact
476+
if: ${{ always() && steps.cache_staging_check.outputs.has_files == 'true' }}
477+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
478+
with:
479+
name: cache-staging
480+
path: cache-staging/
481+
426482
- name: Check if building Archive or Counterexamples failed
427483
if: steps.archive.outcome == 'failure' || steps.counterexamples.outcome == 'failure'
428484
run: |
@@ -434,21 +490,6 @@ jobs:
434490
fi
435491
exit 1
436492
437-
# The cache secrets are available here, so we must not run any untrusted code.
438-
- name: Upload Archive and Counterexamples cache to Azure
439-
shell: bash
440-
run: |
441-
cd pr-branch
442-
443-
# Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
444-
export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
445-
446-
echo "Uploading Archive and Counterexamples cache to Azure..."
447-
MATHLIB_CACHE_USE_CLOUDFLARE=0 ../tools-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked Archive.lean
448-
MATHLIB_CACHE_USE_CLOUDFLARE=0 ../tools-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked Counterexamples.lean
449-
env:
450-
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
451-
452493
- name: Check {Mathlib, Tactic, Counterexamples, Archive}.lean
453494
if: ${{ always() && steps.mk_all.outcome != 'skipped' }}
454495
run: |
@@ -595,9 +636,60 @@ jobs:
595636
tools-branch/scripts/lean-pr-testing-comments.sh lean
596637
tools-branch/scripts/lean-pr-testing-comments.sh batteries
597638
639+
upload_cache:
640+
name: Upload to cache
641+
needs: [build]
642+
runs-on: ubuntu-latest # These steps run on a GitHub runner; no landrun sandboxing is needed.
643+
# We only upload the cache if the build started (whether succeeding, failing, or cancelled)
644+
# but not if any earlier step failed or was cancelled.
645+
# See discussion at https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Some.20files.20not.20found.20in.20the.20cache/near/407183836
646+
if: ${{ always() && needs.build.outputs.cache-staging-has-files == 'true' }}
647+
steps:
648+
- name: Checkout tools branch
649+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
650+
with:
651+
ref: ${{ inputs.tools_branch_ref != '' && inputs.tools_branch_ref || (github.repository == 'leanprover-community/mathlib4-nightly-testing' && 'nightly-testing-green' || 'master') }}
652+
fetch-depth: 1
653+
654+
- name: Configure Lean
655+
uses: leanprover/lean-action@c544e89643240c6b398f14a431bcdc6309e36b3e # v1.4.0
656+
with:
657+
auto-config: false # Don't run `lake build`, `lake test`, or `lake lint` automatically.
658+
use-github-cache: false
659+
use-mathlib-cache: false # This can be re-enabled once we are confident in the cache again.
660+
reinstall-transient-toolchain: true
661+
662+
- name: build cache executable
663+
run: |
664+
lake build cache
665+
CACHE_BIN="$(pwd)/.lake/build/bin/cache"
666+
if [ ! -x "$CACHE_BIN" ]; then
667+
echo "cache binary not found: $CACHE_BIN"
668+
exit 1
669+
fi
670+
echo "CACHE_BIN=$CACHE_BIN" >> "$GITHUB_ENV"
671+
672+
- name: Download cache staging artifact
673+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
674+
with:
675+
name: cache-staging
676+
path: cache-staging
677+
678+
- name: Upload staged cache to Azure
679+
shell: bash
680+
run: |
681+
# Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
682+
export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
683+
684+
echo "Uploading cache to Azure..."
685+
MATHLIB_CACHE_USE_CLOUDFLARE=0 lake env "$CACHE_BIN" put-staged --staging-dir="cache-staging" --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }}
686+
env:
687+
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
688+
598689
post_steps:
599690
name: Post-Build Step
600-
needs: [build]
691+
needs: [build, upload_cache]
692+
if: ${{ always() && needs.build.result == 'success' && (needs.upload_cache.result == 'success' || needs.upload_cache.result == 'skipped') }}
601693
runs-on: ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed.
602694
steps:
603695

@@ -674,6 +766,7 @@ jobs:
674766
675767
# We no longer run `lean4checker` in regular CI, as it is quite expensive for little benefit.
676768
# Instead we run it in a cron job on master: see `daily.yml`.
769+
677770
style_lint:
678771
name: Lint style
679772
runs-on: ubuntu-latest
@@ -686,7 +779,8 @@ jobs:
686779

687780
final:
688781
name: Post-CI job
689-
if: ${{ inputs.run_post_ci }}
782+
# ensure that this runs iff direct dependencies succeeded even if transitive dependencies were skipped
783+
if: ${{ always() && inputs.run_post_ci && needs.style_lint.result == 'success' && needs.build.result == 'success' && needs.post_steps.result == 'success' }}
690784
needs: [style_lint, build, post_steps]
691785
runs-on: ubuntu-latest
692786
steps:

.github/workflows/commit_verification.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ permissions:
2222

2323
env:
2424
TRANSIENT_PREFIX: "transient: "
25-
AUTO_PREFIX: "x: "
25+
# Support both "x " and "x: " (legacy) prefixes
26+
AUTO_PREFIX_COLON: "x: "
27+
AUTO_PREFIX_SPACE: "x "
2628

2729
jobs:
2830
verify:
@@ -46,8 +48,9 @@ jobs:
4648
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
4749
4850
# Check if any commits have transient or auto prefix
51+
# Auto prefix can be "x " or "x: " (legacy)
4952
HAS_SPECIAL=$(git log --format="%s" "$BASE_SHA..$HEAD_SHA" | \
50-
grep -E "^(${TRANSIENT_PREFIX}|${AUTO_PREFIX})" || true)
53+
grep -E "^(${TRANSIENT_PREFIX}|${AUTO_PREFIX_COLON}|${AUTO_PREFIX_SPACE})" || true)
5154
5255
if [[ -n "$HAS_SPECIAL" ]]; then
5356
echo "has_special=true" >> "$GITHUB_OUTPUT"

.github/workflows/daily.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ jobs:
314314
reinstall-transient-toolchain: true
315315

316316
- name: Install Rust
317-
uses: dtolnay/rust-toolchain@stable
317+
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
318318

319319
- name: Check Mathlib using nanoda # make sure this name is consistent with "Get job status and URLs" in the notify job
320320
id: nanoda

.github/workflows/export_telemetry.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ permissions:
1515

1616
jobs:
1717
otel-export:
18-
if: github.repository == 'leanprover-community/mathlib4'
18+
if: ${{ github.repository == 'leanprover-community/mathlib4' || github.repository == 'leanprover-community/mathlib4-nightly-testing' }}
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Export workflow telemetry
2222
uses: corentinmusard/otel-cicd-action@7e307f7baefcf4929d94d2844bc72d87566a75c3 # v3.0.0
2323
with:
24-
otlpEndpoint: ${{ secrets.OTLP_ENDPOINT_ALT }}
25-
otlpHeaders: ${{ secrets.OTLP_HEADERS_ALT }}
24+
otlpEndpoint: ${{ vars.OTLP_ENDPOINT }}
25+
otlpHeaders: ${{ secrets.OTLP_HEADERS }}
2626
otelServiceName: "mathlib-ci"
2727
githubToken: ${{ secrets.GITHUB_TOKEN }}
2828
runId: ${{ github.event.workflow_run.id }}

.github/workflows/nightly-docgen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
rm -rf "$HOME/.cache/mathlib"
1919
2020
- name: Checkout mathlib
21-
uses: actions/checkout@v6.0.2
21+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2222
with:
2323
repository: leanprover-community/mathlib4-nightly-testing
2424
ref: nightly-testing-green

0 commit comments

Comments
 (0)