Skip to content

Commit 92ad56d

Browse files
author
Joris van Winden
committed
merge master
1 parent 61def9c commit 92ad56d

3,907 files changed

Lines changed: 43071 additions & 17887 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/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: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,31 @@ jobs:
243243
echo "✅ All inputRevs in lake-manifest.json are valid"
244244
fi
245245
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+
246271
- name: verify ProofWidgets lean-toolchain matches on versioned releases
247272
# Only enforce this on the main mathlib4 repository, not on nightly-testing
248273
if: github.repository == 'leanprover-community/mathlib4'
@@ -298,7 +323,7 @@ jobs:
298323
299324
# Fail quickly if the cache is completely cold, by checking for Mathlib.Init
300325
echo "Attempting to fetch olean for Mathlib/Init.lean from cache..."
301-
../tools-branch/.lake/build/bin/cache get Mathlib/Init.lean
326+
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get Mathlib/Init.lean
302327
303328
- name: get cache (2/3 - test Mathlib.Init cache)
304329
id: get_cache_part2_test
@@ -318,15 +343,23 @@ jobs:
318343
if [[ "${{ steps.get_cache_part2_test.outcome }}" == "success" ]]; then
319344
echo "Fetching all remaining cache..."
320345
321-
../tools-branch/.lake/build/bin/cache get
346+
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get
322347
323348
# Run again with --repo, to ensure we actually get the oleans.
324-
../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
325350
else
326351
echo "WARNING: 'lake build --no-build -v Mathlib.Init' failed."
327352
echo "No cache for 'Mathlib.Init' available or it could not be prepared."
328353
fi
329354
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+
330363
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
331364
id: mk_all
332365
continue-on-error: true # Allow workflow to continue, outcome checked later
@@ -380,8 +413,8 @@ jobs:
380413
shell: bash
381414
run: |
382415
cd pr-branch
383-
../tools-branch/.lake/build/bin/cache get Archive.lean
384-
../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
385418
386419
- name: build archive
387420
id: archive
@@ -399,37 +432,38 @@ jobs:
399432
../tools-branch/scripts/lake-build-with-retry.sh Counterexamples
400433
# results of build at pr-branch/.lake/build_summary_Counterexamples.json
401434
402-
- name: prepare cache staging directory
403-
if: ${{ steps.build.outcome == 'success' }}
435+
- name: prepare staging directory
436+
if: ${{ always() && (steps.build.outcome == 'success' || steps.build.outcome == 'failure' || steps.build.outcome == 'cancelled') }}
404437
shell: bash
405438
run: |
439+
# Clean the staging directory first, though it should be empty at this point, to be safe
406440
rm -rf cache-staging
407441
mkdir -p cache-staging
408442
409443
- name: stage Mathlib cache files
410-
if: ${{ steps.build.outcome == 'success' }}
411-
shell: bash
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}
412446
run: |
413447
cd pr-branch
414448
lake env ../tools-branch/.lake/build/bin/cache --staging-dir="../cache-staging" stage
415449
416450
- name: stage Archive cache files
417451
if: ${{ steps.archive.outcome == 'success' }}
418-
shell: bash
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}
419453
run: |
420454
cd pr-branch
421455
lake env ../tools-branch/.lake/build/bin/cache --staging-dir="../cache-staging" stage Archive.lean
422456
423457
- name: stage Counterexamples cache files
424458
if: ${{ steps.counterexamples.outcome == 'success' }}
425-
shell: bash
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}
426460
run: |
427461
cd pr-branch
428462
lake env ../tools-branch/.lake/build/bin/cache --staging-dir="../cache-staging" stage Counterexamples.lean
429463
430464
- name: check cache staging contents
431465
id: cache_staging_check
432-
if: ${{ steps.build.outcome == 'success' }}
466+
if: ${{ always() && (steps.build.outcome == 'success' || steps.build.outcome == 'failure' || steps.build.outcome == 'cancelled') }}
433467
shell: bash
434468
run: |
435469
if find cache-staging -type f -name '*.ltar' -print -quit | grep -q .; then
@@ -439,7 +473,7 @@ jobs:
439473
fi
440474
441475
- name: upload cache staging artifact
442-
if: ${{ steps.cache_staging_check.outputs.has_files == 'true' }}
476+
if: ${{ always() && steps.cache_staging_check.outputs.has_files == 'true' }}
443477
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
444478
with:
445479
name: cache-staging
@@ -609,7 +643,7 @@ jobs:
609643
# We only upload the cache if the build started (whether succeeding, failing, or cancelled)
610644
# but not if any earlier step failed or was cancelled.
611645
# See discussion at https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Some.20files.20not.20found.20in.20the.20cache/near/407183836
612-
if: ${{ always() && needs.build.outputs.build-outcome == 'success' && needs.build.outputs.get-cache-outcome == 'success' && needs.build.outputs.cache-staging-has-files == 'true' }}
646+
if: ${{ always() && needs.build.outputs.cache-staging-has-files == 'true' }}
613647
steps:
614648
- name: Checkout tools branch
615649
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -655,6 +689,7 @@ jobs:
655689
post_steps:
656690
name: Post-Build Step
657691
needs: [build, upload_cache]
692+
if: ${{ always() && needs.build.result == 'success' && (needs.upload_cache.result == 'success' || needs.upload_cache.result == 'skipped') }}
658693
runs-on: ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed.
659694
steps:
660695

@@ -744,7 +779,8 @@ jobs:
744779

745780
final:
746781
name: Post-CI job
747-
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' }}
748784
needs: [style_lint, build, post_steps]
749785
runs-on: ubuntu-latest
750786
steps:

.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

.github/workflows/nightly_bump_and_merge.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,15 @@ jobs:
5959
6060
- name: Get latest release tag from leanprover/lean4-nightly
6161
id: get-latest-release
62+
env:
63+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
6264
run: |
63-
RELEASE_TAG="$(curl -s "https://api.github.com/repos/leanprover/lean4-nightly/releases" | jq -r '.[0].tag_name')"
65+
RELEASE_TAG=$(gh api -X GET repos/leanprover/lean4-nightly/releases \
66+
-f per_page=1 --jq '.[0].tag_name')
67+
if [ -z "$RELEASE_TAG" ] || [ "$RELEASE_TAG" = "null" ]; then
68+
echo "::error::Could not determine latest lean4-nightly release"
69+
exit 1
70+
fi
6471
echo "RELEASE_TAG=$RELEASE_TAG"
6572
echo "RELEASE_TAG=$RELEASE_TAG" >> "${GITHUB_ENV}"
6673
echo "new=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
@@ -88,6 +95,8 @@ jobs:
8895
- name: Clone lean4-nightly and get PRs
8996
id: get-prs
9097
if: steps.commit-bump.outputs.bumped == 'true'
98+
env:
99+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
91100
run: |
92101
OLD="${{ steps.old-toolchain.outputs.old }}"
93102
NEW="${{ steps.get-latest-release.outputs.new }}"
@@ -121,9 +130,11 @@ jobs:
121130
echo "Checking commit $commit_sha for associated PRs..."
122131
123132
# Query GitHub API for PRs associated with this commit
124-
pr_numbers=$(curl -s -H "Accept: application/vnd.github.v3+json" \
125-
"https://api.github.com/repos/leanprover/lean4/commits/$commit_sha/pulls" | \
126-
jq -r '.[] | select(.merged_at != null) | .number | tostring' 2>/dev/null || echo "")
133+
pr_numbers=$(gh api "repos/leanprover/lean4/commits/$commit_sha/pulls" \
134+
--jq '[.[] | select(.merged_at != null) | .number] | .[] | tostring' 2>/dev/null) || {
135+
echo "::warning::Failed to fetch PRs for commit $commit_sha, skipping"
136+
continue
137+
}
127138
128139
# Add each PR number to our list (duplicates will be handled later)
129140
for pr_num in $pr_numbers; do
@@ -295,7 +306,7 @@ jobs:
295306
MESSAGE+=$'### Successfully merged branches into \'nightly-testing\':\n\n'
296307
for MERGE_INFO in $SUCCESSFUL_MERGES; do
297308
IFS='|' read -r PR_NUMBER GITHUB_DIFF _ <<< "$MERGE_INFO"
298-
MESSAGE+=$(printf -- '- [lean-pr-testing-%s](%s) (adaptations for lean#%s)' "$PR_NUMBER" "$GITHUB_DIFF" "$PR_NUMBER")$'\n\n'
309+
MESSAGE+="- [lean-pr-testing-${PR_NUMBER}](${GITHUB_DIFF}) (adaptations for lean#${PR_NUMBER})"$'\n\n'
299310
done
300311
MESSAGE+=$'\n'
301312
else
@@ -307,9 +318,9 @@ jobs:
307318
MESSAGE+=$'### Failed merges:\n\nThe following branches need to be merged manually into \'nightly-testing\':\n\n'
308319
for MERGE_INFO in $FAILED_MERGES; do
309320
IFS='|' read -r PR_NUMBER GITHUB_DIFF _ <<< "$MERGE_INFO"
310-
MESSAGE+=$(printf '- [lean-pr-testing-%s](%s) (adaptations for lean#%s)' "$PR_NUMBER" "$GITHUB_DIFF" "$PR_NUMBER")$'\n\n'
321+
MESSAGE+="- [lean-pr-testing-${PR_NUMBER}](${GITHUB_DIFF}) (adaptations for lean#${PR_NUMBER})"$'\n\n'
311322
MESSAGE+=$'```bash\n'
312-
MESSAGE+=$(printf 'scripts/merge-lean-testing-pr.sh %s' "$PR_NUMBER")$'\n'
323+
MESSAGE+="scripts/merge-lean-testing-pr.sh ${PR_NUMBER}"$'\n'
313324
MESSAGE+=$'```\n\n'
314325
done
315326
else

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
if: github.repository == 'leanprover-community/mathlib4'
16+
steps:
17+
- name: Create GitHub Release
18+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
19+
with:
20+
prerelease: ${{ contains(github.ref, 'rc') }}
21+
make_latest: ${{ !contains(github.ref, 'rc') }}

.github/workflows/splice_bot.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: splice-bot
2+
3+
on:
4+
pull_request_review_comment:
5+
types: [created]
6+
7+
permissions: {}
8+
9+
jobs:
10+
call-splice-bot:
11+
if: ${{ contains(github.event.comment.body, 'splice-bot') }}
12+
uses: leanprover-community/SpliceBot/.github/workflows/splice.yaml@fdb442693d6f613b25d2599ad64fd87cf019b9ce # master
13+
with:
14+
# Optional override; omit to use the reusable workflow's default "master"
15+
base_ref: master
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: splice-bot (workflow_run)
2+
3+
on:
4+
workflow_run:
5+
workflows: ["splice-bot"]
6+
types: [completed]
7+
8+
permissions: {}
9+
10+
jobs:
11+
run-reusable:
12+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
13+
uses: leanprover-community/SpliceBot/.github/workflows/splice_wf_run.yaml@fdb442693d6f613b25d2599ad64fd87cf019b9ce # master
14+
with:
15+
source_workflow: ${{ github.event.workflow_run.name }}
16+
push_to_fork: leanprover-community/mathlib4_copy
17+
allow_pr_author: true
18+
allowed_teams: |
19+
leanprover-community/mathlib-reviewers
20+
leanprover-community/mathlib-maintainers
21+
# Installation owner used when minting token from app secrets below.
22+
token_app_owner: leanprover-community
23+
secrets:
24+
token_app_id: ${{ secrets.MATHLIB_SPLICEBOT_APP_ID }}
25+
token_app_private_key: ${{ secrets.MATHLIB_SPLICEBOT_PRIVATE_KEY }}
26+
authz_token_app_id: ${{ secrets.LPC_TEAM_CHECK_APP_ID }}
27+
authz_token_app_private_key: ${{ secrets.LPC_TEAM_CHECK_PRIVATE_KEY }}
28+
branch_token_app_id: ${{ secrets.MATHLIB_COPY_SPLICEBOT_APP_ID }}
29+
branch_token_app_private_key: ${{ secrets.MATHLIB_COPY_SPLICEBOT_PRIVATE_KEY }}

0 commit comments

Comments
 (0)