Skip to content

Commit a21993a

Browse files
committed
Merge branch 'master' into flt-units-topology
2 parents 4846be9 + 8ce7ca7 commit a21993a

3,306 files changed

Lines changed: 92990 additions & 39645 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/build.in.yml

Lines changed: 33 additions & 107 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-
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-
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-
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-
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-
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-
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,8 +552,15 @@ jobs:
622552

623553
- name: build everything
624554
# make sure everything is available for test/import_all.lean
555+
# and that miscellaneous executables still work
556+
run: |
557+
lake build Batteries Qq Aesop ProofWidgets Plausible pole unused
558+
559+
- name: build AesopTest (nightly-testing only)
560+
# Only run on the mathlib4-nightly-testing repository
561+
if: github.repository == 'leanprover-community/mathlib4-nightly-testing'
625562
run: |
626-
lake build Batteries Qq Aesop ProofWidgets Plausible
563+
lake build AesopTest
627564
628565
# We no longer run `lean4checker` in regular CI, as it is quite expensive for little benefit.
629566
# Instead we run it in a cron job on master: see `lean4checker.yml`.
@@ -665,25 +602,13 @@ jobs:
665602
lint-bib-file: true
666603
ref: ${{ PR_BRANCH_REF }}
667604

668-
build_and_lint:
669-
name: CI Success
670-
if: FORK_CONDITION
671-
needs: [style_lint, post_steps]
672-
runs-on: ubuntu-latest
673-
steps:
674-
- name: succeed
675-
run: |
676-
echo "Success: Required build and lint checks completed!"
677-
678605
final:
679606
name: Post-CI jobJOB_NAME
680607
if: FORK_CONDITION
681608
needs: [style_lint, build, post_steps]
682609
runs-on: ubuntu-latest
683610
steps:
684-
# This action is used to determine the PR metadata in the event of a push.
685-
- if: github.event_name != 'pull_request_target'
686-
id: PR_from_push
611+
- id: PR_from_push
687612
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
688613
# TODO: this may not work properly if the same commit is pushed to multiple branches:
689614
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
@@ -692,6 +617,7 @@ jobs:
692617
# Only return if PR is still open
693618
filterOutClosed: true
694619

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

0 commit comments

Comments
 (0)