Skip to content

Commit 6397c09

Browse files
committed
Merge branch 'fae_PR_RankOne' into fae_PR_TrueRankOne
2 parents 866e58c + 88fca8e commit 6397c09

1,017 files changed

Lines changed: 16074 additions & 6543 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: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,33 @@ jobs:
186186
cd pr-branch
187187
lake env
188188
189+
- name: validate lake-manifest.json inputRevs
190+
# Only enforce this on the main mathlib4 repository, not on nightly-testing
191+
if: github.repository == 'leanprover-community/mathlib4'
192+
shell: bash
193+
run: |
194+
cd pr-branch
195+
196+
# Check that all inputRevs in lake-manifest.json match the required pattern
197+
echo "Validating lake-manifest.json inputRevs..."
198+
199+
# Extract all inputRevs from the manifest
200+
invalid_revs=$(jq -r '.packages[].inputRev // empty' lake-manifest.json | \
201+
grep -v -E '^(main|master|v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?)$' || true)
202+
203+
if [ -n "$invalid_revs" ]; then
204+
echo "❌ Error: Found invalid inputRevs in lake-manifest.json:"
205+
echo "$invalid_revs"
206+
echo ""
207+
echo "All inputRevs must be one of:"
208+
echo " - 'main'"
209+
echo " - 'master'"
210+
echo " - 'vX.Y.Z' (semantic version, e.g., v1.2.3 or v1.2.3-pre)"
211+
exit 1
212+
else
213+
echo "✅ All inputRevs in lake-manifest.json are valid"
214+
fi
215+
189216
- name: get cache (1/3 - setup and initial fetch)
190217
id: get_cache_part1_setup
191218
shell: bash # only runs `cache get` from `master-branch`, so doesn't need to be inside landrun
@@ -654,9 +681,7 @@ jobs:
654681
needs: [style_lint, build, post_steps]
655682
runs-on: ubuntu-latest
656683
steps:
657-
# This action is used to determine the PR metadata in the event of a push.
658-
- if: github.event_name != 'pull_request_target'
659-
id: PR_from_push
684+
- id: PR_from_push
660685
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
661686
# TODO: this may not work properly if the same commit is pushed to multiple branches:
662687
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
@@ -665,6 +690,7 @@ jobs:
665690
# Only return if PR is still open
666691
filterOutClosed: true
667692

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

.github/workflows/bors.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,33 @@ jobs:
196196
cd pr-branch
197197
lake env
198198
199+
- name: validate lake-manifest.json inputRevs
200+
# Only enforce this on the main mathlib4 repository, not on nightly-testing
201+
if: github.repository == 'leanprover-community/mathlib4'
202+
shell: bash
203+
run: |
204+
cd pr-branch
205+
206+
# Check that all inputRevs in lake-manifest.json match the required pattern
207+
echo "Validating lake-manifest.json inputRevs..."
208+
209+
# Extract all inputRevs from the manifest
210+
invalid_revs=$(jq -r '.packages[].inputRev // empty' lake-manifest.json | \
211+
grep -v -E '^(main|master|v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?)$' || true)
212+
213+
if [ -n "$invalid_revs" ]; then
214+
echo "❌ Error: Found invalid inputRevs in lake-manifest.json:"
215+
echo "$invalid_revs"
216+
echo ""
217+
echo "All inputRevs must be one of:"
218+
echo " - 'main'"
219+
echo " - 'master'"
220+
echo " - 'vX.Y.Z' (semantic version, e.g., v1.2.3 or v1.2.3-pre)"
221+
exit 1
222+
else
223+
echo "✅ All inputRevs in lake-manifest.json are valid"
224+
fi
225+
199226
- name: get cache (1/3 - setup and initial fetch)
200227
id: get_cache_part1_setup
201228
shell: bash # only runs `cache get` from `master-branch`, so doesn't need to be inside landrun
@@ -664,9 +691,7 @@ jobs:
664691
needs: [style_lint, build, post_steps]
665692
runs-on: ubuntu-latest
666693
steps:
667-
# This action is used to determine the PR metadata in the event of a push.
668-
- if: github.event_name != 'pull_request_target'
669-
id: PR_from_push
694+
- id: PR_from_push
670695
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
671696
# TODO: this may not work properly if the same commit is pushed to multiple branches:
672697
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
@@ -675,6 +700,7 @@ jobs:
675700
# Only return if PR is still open
676701
filterOutClosed: true
677702

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

.github/workflows/build.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,33 @@ jobs:
203203
cd pr-branch
204204
lake env
205205
206+
- name: validate lake-manifest.json inputRevs
207+
# Only enforce this on the main mathlib4 repository, not on nightly-testing
208+
if: github.repository == 'leanprover-community/mathlib4'
209+
shell: bash
210+
run: |
211+
cd pr-branch
212+
213+
# Check that all inputRevs in lake-manifest.json match the required pattern
214+
echo "Validating lake-manifest.json inputRevs..."
215+
216+
# Extract all inputRevs from the manifest
217+
invalid_revs=$(jq -r '.packages[].inputRev // empty' lake-manifest.json | \
218+
grep -v -E '^(main|master|v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?)$' || true)
219+
220+
if [ -n "$invalid_revs" ]; then
221+
echo "❌ Error: Found invalid inputRevs in lake-manifest.json:"
222+
echo "$invalid_revs"
223+
echo ""
224+
echo "All inputRevs must be one of:"
225+
echo " - 'main'"
226+
echo " - 'master'"
227+
echo " - 'vX.Y.Z' (semantic version, e.g., v1.2.3 or v1.2.3-pre)"
228+
exit 1
229+
else
230+
echo "✅ All inputRevs in lake-manifest.json are valid"
231+
fi
232+
206233
- name: get cache (1/3 - setup and initial fetch)
207234
id: get_cache_part1_setup
208235
shell: bash # only runs `cache get` from `master-branch`, so doesn't need to be inside landrun
@@ -671,9 +698,7 @@ jobs:
671698
needs: [style_lint, build, post_steps]
672699
runs-on: ubuntu-latest
673700
steps:
674-
# This action is used to determine the PR metadata in the event of a push.
675-
- if: github.event_name != 'pull_request_target'
676-
id: PR_from_push
701+
- id: PR_from_push
677702
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
678703
# TODO: this may not work properly if the same commit is pushed to multiple branches:
679704
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
@@ -682,6 +707,7 @@ jobs:
682707
# Only return if PR is still open
683708
filterOutClosed: true
684709

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

.github/workflows/build_fork.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,33 @@ jobs:
200200
cd pr-branch
201201
lake env
202202
203+
- name: validate lake-manifest.json inputRevs
204+
# Only enforce this on the main mathlib4 repository, not on nightly-testing
205+
if: github.repository == 'leanprover-community/mathlib4'
206+
shell: bash
207+
run: |
208+
cd pr-branch
209+
210+
# Check that all inputRevs in lake-manifest.json match the required pattern
211+
echo "Validating lake-manifest.json inputRevs..."
212+
213+
# Extract all inputRevs from the manifest
214+
invalid_revs=$(jq -r '.packages[].inputRev // empty' lake-manifest.json | \
215+
grep -v -E '^(main|master|v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?)$' || true)
216+
217+
if [ -n "$invalid_revs" ]; then
218+
echo "❌ Error: Found invalid inputRevs in lake-manifest.json:"
219+
echo "$invalid_revs"
220+
echo ""
221+
echo "All inputRevs must be one of:"
222+
echo " - 'main'"
223+
echo " - 'master'"
224+
echo " - 'vX.Y.Z' (semantic version, e.g., v1.2.3 or v1.2.3-pre)"
225+
exit 1
226+
else
227+
echo "✅ All inputRevs in lake-manifest.json are valid"
228+
fi
229+
203230
- name: get cache (1/3 - setup and initial fetch)
204231
id: get_cache_part1_setup
205232
shell: bash # only runs `cache get` from `master-branch`, so doesn't need to be inside landrun
@@ -668,9 +695,7 @@ jobs:
668695
needs: [style_lint, build, post_steps]
669696
runs-on: ubuntu-latest
670697
steps:
671-
# This action is used to determine the PR metadata in the event of a push.
672-
- if: github.event_name != 'pull_request_target'
673-
id: PR_from_push
698+
- id: PR_from_push
674699
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
675700
# TODO: this may not work properly if the same commit is pushed to multiple branches:
676701
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
@@ -679,6 +704,7 @@ jobs:
679704
# Only return if PR is still open
680705
filterOutClosed: true
681706

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

.github/workflows/maintainer_bors.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
COMMENT_EVENT: ${{ github.event.comment.body }}
2323
COMMENT_REVIEW: ${{ github.event.review.body }}
2424
PR_NUMBER: ${{ github.event.issue.number }}${{ github.event.pull_request.number }}
25+
HAS_DELEGATED_LABEL: ${{ contains(github.event.issue.labels.*.name, 'delegated') }}
2526
name: Add ready-to-merge or delegated label
2627
runs-on: ubuntu-latest
2728
if: github.repository == 'leanprover-community/mathlib4'
@@ -35,8 +36,14 @@ jobs:
3536
# for debugging, we print some information
3637
printf '%s' "${COMMENT}" | hexdump -cC
3738
printf 'Comment:"%s"\n' "${COMMENT}"
38-
m_or_d="$(printf '%s' "${COMMENT}" |
39-
sed -n 's=^bors *\(merge\|r+\) *$=ready-to-merge=p; s=^bors *\(delegate\|d+\|d\=\).*=delegated=p' | head -1)"
39+
if [ "${AUTHOR}" == 'mathlib-bors[bot]' ] && [ "${HAS_DELEGATED_LABEL}" == 'true' ]
40+
then
41+
m_or_d="$(printf '%s' "${COMMENT}" |
42+
sed -n 's=^Build failed:=delegated=p' | head -1)"
43+
else
44+
m_or_d="$(printf '%s' "${COMMENT}" |
45+
sed -n 's=^bors *\(merge\|r+\) *$=ready-to-merge=p; s=^bors *\(delegate\|d+\|d\=\).*=delegated=p' | head -1)"
46+
fi
4047
4148
remove_labels="$(printf '%s' "${COMMENT}" |
4249
sed -n 's=^bors *\(merge\|r\|d\)- *$=remove-labels=p' | head -1)"
@@ -50,7 +57,8 @@ jobs:
5057
printf $'mOrD=%s\n' "${m_or_d}" >> "${GITHUB_OUTPUT}"
5158
printf $'removeLabels=%s\n' "${remove_labels}" >> "${GITHUB_OUTPUT}"
5259
if [ "${AUTHOR}" == 'leanprover-community-mathlib4-bot' ] ||
53-
[ "${AUTHOR}" == 'leanprover-community-bot-assistant' ]
60+
[ "${AUTHOR}" == 'leanprover-community-bot-assistant' ] ||
61+
[ "${AUTHOR}" == 'mathlib-bors[bot]' ]
5462
then
5563
printf $'bot=true\n'
5664
printf $'bot=true\n' >> "${GITHUB_OUTPUT}"
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Docgen test on nightly-testing
2+
3+
on:
4+
schedule:
5+
- cron: '37 1 * * *' # Run at 01:37 UTC every day (generated by fair dice roll)
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
name: build mathlib4-nightly-testing docs
11+
runs-on: doc-gen
12+
if: github.repository == 'leanprover-community/mathlib4-nightly-testing'
13+
steps:
14+
- name: clean up
15+
run: |
16+
rm -rf docbuild
17+
rm -rf "$HOME/.elan"
18+
rm -rf "$HOME/.cache/mathlib"
19+
20+
- name: Checkout mathlib
21+
uses: actions/checkout@v4
22+
with:
23+
repository: leanprover-community/mathlib4-nightly-testing
24+
ref: nightly-testing-green
25+
26+
- name: Add upstream
27+
run: |
28+
# Add the nightly-testing remote if it does not exist already, otherwise `lake exe cache` gets confused.
29+
(git remote | grep -q '^nightly-testing$') || git remote add nightly-testing https://github.com/leanprover-community/mathlib4-nightly-testing.git
30+
31+
- name: Build and lint the project.
32+
id: build-lean
33+
uses: leanprover/lean-action@f807b338d95de7813c5c50d018f1c23c9b93b4ec # v1.2.0
34+
with:
35+
use-mathlib-cache: true
36+
37+
# This is not quite the same as `docgen-action` does, since we do not actually want to upload the result.
38+
- name: create dummy docs project
39+
run: |
40+
# Build HTML documentation for the project
41+
# The output will be located in docbuild/docs
42+
43+
# Create a temporary docbuild folder
44+
mkdir -p docbuild
45+
46+
# Template lakefile.toml
47+
cat << EOF > docbuild/lakefile.toml
48+
name = "docbuild"
49+
reservoir = false
50+
version = "0.1.0"
51+
packagesDir = "../.lake/packages"
52+
53+
[[require]]
54+
name = "mathlib"
55+
path = "../"
56+
57+
[[require]]
58+
scope = "leanprover"
59+
name = "doc-gen4"
60+
rev = "main"
61+
EOF
62+
63+
# Initialise docbuild as a Lean project
64+
cd docbuild
65+
66+
# No need to reinstall packages if we can just copy them from Mathlib.
67+
mkdir -p .lake/packages
68+
cp -r ../.lake/packages/* .lake/packages
69+
cp ../lean-toolchain . # Use Mathlib's (nightly) toolchain.
70+
71+
# Disable an error message due to a non-blocking bug. See Zulip
72+
MATHLIB_NO_CACHE_ON_UPDATE=1 lake update "$NAME"
73+
74+
# Copy references.bib over while doc-gen lacks support for subproject references.bib
75+
mkdir docs/
76+
cp ../docs/references.bib docs/references.bib
77+
78+
- name: build doc-gen4
79+
working-directory: docbuild
80+
run: |
81+
env DISABLE_EQUATIONS=1 lake build doc-gen4
82+
83+
- name: build import graph
84+
working-directory: .
85+
run: |
86+
lake exe graph mathlib.html
87+
88+
- name: generate docs
89+
working-directory: docbuild
90+
run: |
91+
lake build Batteries:docs Qq:docs Aesop:docs ProofWidgets:docs Mathlib:docs Archive:docs Counterexamples:docs docs:docs
92+
lake build Mathlib:docsHeader
93+
94+
- name: clean up
95+
if: always()
96+
run: |
97+
rm -rf docbuild
98+
rm -rf "$HOME/.elan"
99+
rm -rf "$HOME/.cache/mathlib"
100+
101+
- name: Send success message on Zulip
102+
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
103+
if: success()
104+
with:
105+
api-key: ${{ secrets.ZULIP_API_KEY }}
106+
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
107+
organization-url: 'https://leanprover.zulipchat.com'
108+
to: 'nightly-testing'
109+
type: 'stream'
110+
topic: 'Docgen status updates'
111+
content: |
112+
✅ The docgen run for Mathlib's [nightly-testing branch](https://github.com/leanprover-community/mathlib4-nightly-testing/tree/nightly-testing) has [succeeded](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) ([${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})).
113+
114+
- name: Send failure message on Zulip
115+
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
116+
if: failure()
117+
with:
118+
api-key: ${{ secrets.ZULIP_API_KEY }}
119+
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
120+
organization-url: 'https://leanprover.zulipchat.com'
121+
to: 'nightly-testing'
122+
type: 'stream'
123+
topic: 'Docgen status updates'
124+
content: |
125+
❌ The docgen run for Mathlib's [nightly-testing branch](https://github.com/leanprover-community/mathlib4-nightly-testing/tree/nightly-testing) has [failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) ([${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})).
126+
This likely indicates an issue with the nightly Lean build, or a required update in doc-gen4.

0 commit comments

Comments
 (0)