Skip to content

Commit d6a0207

Browse files
authored
Merge branch 'master' into chebyshev-polynomials-properties
2 parents f1ab97a + 31f931f commit d6a0207

4,363 files changed

Lines changed: 134240 additions & 65799 deletions

File tree

Some content is hidden

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

.github/actionlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ self-hosted-runner:
22
labels:
33
- bors
44
- pr
5+
- doc-gen

.github/build.in.yml

Lines changed: 68 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,23 @@ jobs:
132132
- name: set LEAN_SRC_PATH
133133
shell: bash
134134
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"
135+
cd pr-branch
136+
137+
# Start with the base paths
138+
LEAN_SRC_PATH=".:$TOOLCHAIN_DIR/src/lean/lake"
139+
140+
# Extract package names from lake-manifest.json and validate them
141+
# Only allow A-Z, a-z, 0-9, _, and - characters
142+
# Build the LEAN_SRC_PATH by appending each validated package
143+
PACKAGE_NAMES=$(jq -r '.packages[].name' lake-manifest.json)
144+
for pkg in $PACKAGE_NAMES; do
145+
if [[ "$pkg" =~ ^[A-Za-z0-9_-]+$ ]]; then
146+
LEAN_SRC_PATH="$LEAN_SRC_PATH:.lake/packages/$pkg"
147+
else
148+
echo "Warning: Skipping invalid package name: $pkg"
149+
fi
150+
done
151+
137152
echo "LEAN_SRC_PATH=$LEAN_SRC_PATH"
138153
139154
# Set it as an environment variable for subsequent steps
@@ -186,6 +201,33 @@ jobs:
186201
cd pr-branch
187202
lake env
188203
204+
- name: validate lake-manifest.json inputRevs
205+
# Only enforce this on the main mathlib4 repository, not on nightly-testing
206+
if: github.repository == 'leanprover-community/mathlib4'
207+
shell: bash
208+
run: |
209+
cd pr-branch
210+
211+
# Check that all inputRevs in lake-manifest.json match the required pattern
212+
echo "Validating lake-manifest.json inputRevs..."
213+
214+
# Extract all inputRevs from the manifest
215+
invalid_revs=$(jq -r '.packages[].inputRev // empty' lake-manifest.json | \
216+
grep -v -E '^(main|master|v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?)$' || true)
217+
218+
if [ -n "$invalid_revs" ]; then
219+
echo "❌ Error: Found invalid inputRevs in lake-manifest.json:"
220+
echo "$invalid_revs"
221+
echo ""
222+
echo "All inputRevs must be one of:"
223+
echo " - 'main'"
224+
echo " - 'master'"
225+
echo " - 'vX.Y.Z' (semantic version, e.g., v1.2.3 or v1.2.3-pre)"
226+
exit 1
227+
else
228+
echo "✅ All inputRevs in lake-manifest.json are valid"
229+
fi
230+
189231
- name: get cache (1/3 - setup and initial fetch)
190232
id: get_cache_part1_setup
191233
shell: bash # only runs `cache get` from `master-branch`, so doesn't need to be inside landrun
@@ -277,7 +319,7 @@ jobs:
277319
!pr-branch/.git/
278320
279321
# The cache secrets are available here, so we must not run any untrusted code.
280-
- name: upload cache
322+
- name: Upload cache to Azure
281323
# We only upload the cache if the build started (whether succeeding, failing, or cancelled)
282324
# but not if any earlier step failed or was cancelled.
283325
# See discussion at https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Some.20files.20not.20found.20in.20the.20cache/near/407183836
@@ -288,18 +330,18 @@ jobs:
288330
289331
# Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
290332
export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
291-
export MATHLIB_CACHE_S3_TOKEN="${MATHLIB_CACHE_S3_TOKEN_RAW%"${MATHLIB_CACHE_S3_TOKEN_RAW##*[![:space:]]}"}"
292333
293334
# Use the trusted cache tool from master-branch
294335
# TODO: this is not doing anything currently, and needs to be integrated with put-unpacked
295336
# ../master-branch/.lake/build/bin/cache commit || true
296337
# run this in CI if it gets an incorrect lake hash for existing cache files somehow
297338
# ../master-branch/.lake/build/bin/cache put!
298339
# do not try to upload files just downloaded
299-
../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked
340+
341+
echo "Uploading cache to Azure..."
342+
USE_FRO_CACHE=0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked
300343
env:
301344
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
302-
MATHLIB_CACHE_S3_TOKEN_RAW: ${{ secrets.MATHLIB_CACHE_S3_TOKEN }}
303345

304346
# Note: we should not be including `Archive` and `Counterexamples` in the cache.
305347
# We do this for now for the sake of not rebuilding them in every CI run
@@ -342,20 +384,19 @@ jobs:
342384
exit 1
343385
344386
# The cache secrets are available here, so we must not run any untrusted code.
345-
- name: put archive and counterexamples cache
387+
- name: Upload Archive and Counterexamples cache to Azure
346388
shell: bash
347389
run: |
348390
cd pr-branch
349391
350392
# Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
351393
export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
352-
export MATHLIB_CACHE_S3_TOKEN="${MATHLIB_CACHE_S3_TOKEN_RAW%"${MATHLIB_CACHE_S3_TOKEN_RAW##*[![:space:]]}"}"
353394
354-
../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Archive.lean
355-
../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Counterexamples.lean
395+
echo "Uploading Archive and Counterexamples cache to Azure..."
396+
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
397+
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
356398
env:
357399
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
358-
MATHLIB_CACHE_S3_TOKEN_RAW: ${{ secrets.MATHLIB_CACHE_S3_TOKEN }}
359400

360401
- name: Check {Mathlib, Tactic, Counterexamples, Archive}.lean
361402
if: always()
@@ -460,18 +501,16 @@ jobs:
460501
with:
461502
auto-config: false # Don't run `lake build`, `lake test`, or `lake lint` automatically.
462503
use-github-cache: false
463-
use-mathlib-cache: true
504+
use-mathlib-cache: false # This can be re-enabled once we are confident in the cache again.
464505
reinstall-transient-toolchain: true
465506

466-
# TODO: this step should not be necessary, "Configure Lean" above should already achieve this.
467507
- name: get cache for Mathlib
468508
run: |
469509
# Run once without --repo, so we can diagnose what `lake exe cache get` wants to do by itself.
470510
lake exe cache get
471511
# Run again with --repo, so ensure we actually get the oleans.
472512
lake exe cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} get
473513
474-
475514
- name: get cache for Archive and Counterexamples
476515
run: |
477516
# Run once without --repo, so we can diagnose what `lake exe cache get` wants to do by itself.
@@ -482,13 +521,13 @@ jobs:
482521
- name: verify that everything was available in the cache
483522
run: |
484523
echo "::group::{verify Mathlib cache}"
485-
lake build --no-build -v Mathlib
524+
lake build --no-build --rehash -v Mathlib
486525
echo "::endgroup::"
487526
echo "::group::{verify Archive cache}"
488-
lake build --no-build -v Archive
527+
lake build --no-build --rehash -v Archive
489528
echo "::endgroup::"
490529
echo "::group::{verify Counterexamples cache}"
491-
lake build --no-build -v Counterexamples
530+
lake build --no-build --rehash -v Counterexamples
492531
echo "::endgroup::"
493532
494533
- name: check declarations in db files
@@ -514,8 +553,15 @@ jobs:
514553

515554
- name: build everything
516555
# make sure everything is available for test/import_all.lean
556+
# and that miscellaneous executables still work
557+
run: |
558+
lake build Batteries Qq Aesop ProofWidgets Plausible pole unused
559+
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'
517563
run: |
518-
lake build Batteries Qq Aesop ProofWidgets Plausible
564+
lake build AesopTest
519565
520566
# We no longer run `lean4checker` in regular CI, as it is quite expensive for little benefit.
521567
# Instead we run it in a cron job on master: see `lean4checker.yml`.
@@ -551,40 +597,28 @@ jobs:
551597
if: FORK_CONDITION
552598
runs-on: ubuntu-latest
553599
steps:
554-
- uses: leanprover-community/lint-style-action@d29fb3b12c1c834450680b3c544f63fe0237a2e2 # 2025-06-20
600+
- uses: leanprover-community/lint-style-action@a7e7428fa44f9635d6eb8e01919d16fd498d387a # 2025-08-18
555601
with:
556602
mode: check
557603
lint-bib-file: true
558604
ref: ${{ PR_BRANCH_REF }}
559605

560-
build_and_lint:
561-
name: CI Success
562-
if: FORK_CONDITION
563-
needs: [style_lint, post_steps]
564-
runs-on: ubuntu-latest
565-
steps:
566-
- name: succeed
567-
run: |
568-
echo "Success: Required build and lint checks completed!"
569-
570606
final:
571607
name: Post-CI jobJOB_NAME
572608
if: FORK_CONDITION
573609
needs: [style_lint, build, post_steps]
574610
runs-on: ubuntu-latest
575611
steps:
576-
# This action is used to determine the PR metadata in the event of a push.
577-
# If it is called from a PR from a fork, it will find nothing/irrelevant data.
578-
- if: github.event_name != 'pull_request_target'
579-
id: PR_from_push
580-
uses: 8BitJonny/gh-get-current-pr@08e737c57a3a4eb24cec6487664b243b77eb5e36 # 3.0.0
612+
- id: PR_from_push
613+
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
581614
# TODO: this may not work properly if the same commit is pushed to multiple branches:
582615
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
583616
with:
584617
github-token: ${{ secrets.GITHUB_TOKEN }}
585618
# Only return if PR is still open
586619
filterOutClosed: true
587620

621+
# TODO: delete this step and rename `PR_from_push` to `PR` if the above step seems to work properly
588622
# Combine the output from the previous action with the metadata supplied by GitHub itself.
589623
# Note that if we fall back to github.event.pull_request data, the list of labels is generated when this workflow is triggered
590624
# and not updated afterwards!

0 commit comments

Comments
 (0)