Skip to content

Commit 6dd888e

Browse files
Merge branch 'master' into mitchell-horner/between
2 parents b857f8e + df632a9 commit 6dd888e

4,474 files changed

Lines changed: 103067 additions & 55971 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/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ 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 lines at the bottom of the commit message
15-
(that is, before the `---`) using the following format:
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:
17+
18+
git commit --author="Author Name <author@email.com>" --allow-empty -m "add Author Name as coauthor"
1619
17-
Co-authored-by: Author Name <author@email.com>
20+
When merging, all the commits will be squashed into a single commit listing all co-authors.
1821
1922
If you are moving or deleting declarations, please include these lines at the bottom of the commit message
2023
(that is, before the `---`) using the following format:

.github/build.in.yml

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
test-outcome: ${{ steps.test.outcome }}
4444
defaults: # On Hoskinson runners, landrun is already installed.
4545
run:
46-
shell: landrun --rox /usr --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 -- bash -euxo pipefail {0}
46+
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}
4747
steps:
4848
- name: cleanup
4949
shell: bash # This *just* deletes old files, so is safe to run outside landrun.
@@ -181,7 +181,7 @@ jobs:
181181
# - we give --rox access to `~/.elan` and `~/actions-runner/_work` (GitHub CI needs this)
182182
# - we give --unrestricted-network as we need this to download dependencies
183183
# - git needs read only access to `/etc`.
184-
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 -- bash -euxo pipefail {0}
184+
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}
185185
run: |
186186
cd pr-branch
187187
lake env
@@ -205,8 +205,8 @@ jobs:
205205
run: |
206206
cd pr-branch
207207
208-
echo "Attempting: lake build --no-build Mathlib.Init (this runs under landrun)"
209-
lake build --no-build Mathlib.Init
208+
echo "Attempting: lake build --no-build -v Mathlib.Init (this runs under landrun)"
209+
lake build --no-build -v Mathlib.Init
210210
211211
- name: get cache (3/3 - finalize cache operation)
212212
id: get
@@ -217,8 +217,11 @@ jobs:
217217
echo "Fetching all remaining cache..."
218218
219219
../master-branch/.lake/build/bin/cache get
220+
221+
# Run again with --repo, to ensure we actually get the oleans.
222+
../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} get
220223
else
221-
echo "WARNING: 'lake build --no-build Mathlib.Init' failed."
224+
echo "WARNING: 'lake build --no-build -v Mathlib.Init' failed."
222225
echo "No cache for 'Mathlib.Init' available or it could not be prepared."
223226
fi
224227
@@ -240,14 +243,17 @@ jobs:
240243
id: build
241244
run: |
242245
cd pr-branch
246+
echo "::group::{test curl}"
243247
# Test curl - should fail when landrun network isolation is working
244248
if curl --silent --head --fail https://www.example.com/ >/dev/null 2>&1; then
245249
echo "ERROR: curl to example.com succeeded, but it should fail when landrun is working correctly!"
246250
exit 1
247251
else
248252
echo "curl to example.com failed as expected - landrun network isolation is working"
249253
fi
250-
bash -o pipefail -c "env LEAN_ABORT_ON_PANIC=1 lake build --wfail -KCI"
254+
echo "::endgroup::"
255+
256+
../master-branch/scripts/lake-build-with-retry.sh Mathlib
251257
- name: end gh-problem-match-wrap for build step
252258
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
253259
with:
@@ -259,6 +265,17 @@ jobs:
259265
cd pr-branch
260266
du .lake/build/lib/lean/Mathlib || echo "This code should be unreachable"
261267
268+
- name: upload artifact containing contents of pr-branch
269+
# temporary measure for debugging no-build failures
270+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
271+
with:
272+
name: mathlib4_artifact
273+
include-hidden-files: true
274+
# we exclude .git since there may be secrets in there
275+
path: |
276+
pr-branch/
277+
!pr-branch/.git/
278+
262279
# The cache secrets are available here, so we must not run any untrusted code.
263280
- name: upload cache
264281
# We only upload the cache if the build started (whether succeeding, failing, or cancelled)
@@ -269,6 +286,10 @@ jobs:
269286
run: |
270287
cd pr-branch
271288
289+
# Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
290+
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:]]}"}"
292+
272293
# Use the trusted cache tool from master-branch
273294
# TODO: this is not doing anything currently, and needs to be integrated with put-unpacked
274295
# ../master-branch/.lake/build/bin/cache commit || true
@@ -277,8 +298,8 @@ jobs:
277298
# do not try to upload files just downloaded
278299
../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked
279300
env:
280-
MATHLIB_CACHE_SAS: ${{ secrets.MATHLIB_CACHE_SAS }}
281-
MATHLIB_CACHE_S3_TOKEN: ${{ secrets.MATHLIB_CACHE_S3_TOKEN }}
301+
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
302+
MATHLIB_CACHE_S3_TOKEN_RAW: ${{ secrets.MATHLIB_CACHE_S3_TOKEN }}
282303

283304
# Note: we should not be including `Archive` and `Counterexamples` in the cache.
284305
# We do this for now for the sake of not rebuilding them in every CI run
@@ -297,26 +318,44 @@ jobs:
297318
298319
- name: build archive
299320
id: archive
321+
continue-on-error: true
300322
run: |
301323
cd pr-branch
302-
bash -o pipefail -c "env LEAN_ABORT_ON_PANIC=1 lake build Archive"
324+
../master-branch/scripts/lake-build-with-retry.sh Archive
303325
304326
- name: build counterexamples
305327
id: counterexamples
328+
continue-on-error: true
306329
run: |
307330
cd pr-branch
308-
bash -o pipefail -c "env LEAN_ABORT_ON_PANIC=1 lake build Counterexamples"
331+
../master-branch/scripts/lake-build-with-retry.sh Counterexamples
332+
333+
- name: Check if building Archive or Counterexamples failed
334+
if: steps.archive.outcome == 'failure' || steps.counterexamples.outcome == 'failure'
335+
run: |
336+
if [ "${{ steps.archive.outcome }}" == "failure" ]; then
337+
echo "❌ The \"build archive\" step above failed; please check its logs."
338+
fi
339+
if [ "${{ steps.counterexamples.outcome }}" == "failure" ]; then
340+
echo "❌ The \"build counterexamples\" step above failed; please check its logs."
341+
fi
342+
exit 1
309343
310344
# The cache secrets are available here, so we must not run any untrusted code.
311345
- name: put archive and counterexamples cache
312346
shell: bash
313347
run: |
314348
cd pr-branch
349+
350+
# Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
351+
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:]]}"}"
353+
315354
../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Archive.lean
316355
../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put Counterexamples.lean
317356
env:
318-
MATHLIB_CACHE_SAS: ${{ secrets.MATHLIB_CACHE_SAS }}
319-
MATHLIB_CACHE_S3_TOKEN: ${{ secrets.MATHLIB_CACHE_S3_TOKEN }}
357+
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
358+
MATHLIB_CACHE_S3_TOKEN_RAW: ${{ secrets.MATHLIB_CACHE_S3_TOKEN }}
320359

321360
- name: Check {Mathlib, Tactic, Counterexamples, Archive}.lean
322361
if: always()
@@ -380,7 +419,7 @@ jobs:
380419
## we filter out the output lines that begin with `✔ [xx/yy]`, where xx, yy
381420
## are either numbers or ?, and the "Build completed successfully." message.
382421
## We keep the rest, which are actual outputs of the files
383-
awk '!($0 ~ "^\\s*✔ \\[[?0-9]*/[?0-9]*\\]" || $0 == "Build completed successfully."){ print $0 }')"
422+
awk '!($0 ~ "^\\s*✔ \\[[?0-9]*/[?0-9]*\\]" || $0 ~ "^Build completed successfully( \\([0-9]+ jobs\\))?\\.?$"){ print $0 }')"
384423
if [ -n "${buildMsgs}" ]
385424
then
386425
printf $'%s\n' "${buildMsgs}"
@@ -442,9 +481,15 @@ jobs:
442481
443482
- name: verify that everything was available in the cache
444483
run: |
445-
lake build --no-build Mathlib
446-
lake build --no-build Archive
447-
lake build --no-build Counterexamples
484+
echo "::group::{verify Mathlib cache}"
485+
lake build --no-build -v Mathlib
486+
echo "::endgroup::"
487+
echo "::group::{verify Archive cache}"
488+
lake build --no-build -v Archive
489+
echo "::endgroup::"
490+
echo "::group::{verify Counterexamples cache}"
491+
lake build --no-build -v Counterexamples
492+
echo "::endgroup::"
448493
449494
- name: check declarations in db files
450495
run: |

.github/workflows/PR_summary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
git diff --name-only --diff-filter D origin/${{ github.base_ref }}... | tee removed_files.txt
8787
echo "Checking for renamed files..."
8888
89-
# Shows the `R`enamed files, in human readable format
89+
# Shows the `R`enamed files, in human-readable format
9090
# The `awk` pipe
9191
# * extracts into an array the old name as the key and the new name as the value
9292
# * eventually prints "`oldName` was renamed to `newName`" for each key-value pair.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: automatically assign reviewers
2+
3+
on:
4+
schedule:
5+
- cron: "37 0 * * *" # At 00:37 UTC every day
6+
workflow_dispatch:
7+
8+
jobs:
9+
autoassign-reviewers:
10+
if: github.repository == 'leanprover-community/mathlib4'
11+
name: assign automatically proposed reviewers
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15+
with:
16+
ref: master
17+
sparse-checkout: |
18+
scripts/assign_reviewers.py
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
22+
with:
23+
python-version: '3.x'
24+
25+
- name: assign reviewers
26+
env:
27+
ASSIGN_REVIEWERS_TOKEN: ${{ secrets.ASSIGN_REVIEWERS }}
28+
run: |
29+
python3 scripts/assign_reviewers.py

0 commit comments

Comments
 (0)