Skip to content

Commit 36c0630

Browse files
author
pfaffelh
committed
Merge branch 'master' into pfaffelh_compactSystem
2 parents f16b9dc + 50e49dc commit 36c0630

582 files changed

Lines changed: 12402 additions & 5130 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: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@ jobs:
136136
shell: bash # We're only building the `master` branch version of the tools, so don't need to run inside landrun.
137137
run: |
138138
cd master-branch
139-
lake build cache mk_all check-yaml graph
139+
lake build cache check-yaml graph
140140
ls .lake/build/bin/cache
141-
ls .lake/build/bin/mk_all
142141
ls .lake/build/bin/check-yaml
143142
ls .lake/packages/importGraph/.lake/build/bin/graph
144143
@@ -219,13 +218,11 @@ jobs:
219218
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
220219
id: mk_all
221220
continue-on-error: true # Allow workflow to continue, outcome checked later
222-
# This only runs `mk_all --check` from the `master-branch`, so doesn't need to be inside landrun
223-
shell: bash
221+
# This runs `mk_all --check` from the `pr-branch` inside landrun
224222
run: |
225223
cd pr-branch
226-
227-
echo "Running mk_all --check (from master-branch)..."
228-
LAKE_HOME="$TOOLCHAIN_DIR" ../master-branch/.lake/build/bin/mk_all --check
224+
echo "Running mk_all --check (from pr-branch)..."
225+
lake exe mk_all --check
229226
230227
- name: begin gh-problem-match-wrap for build step
231228
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
@@ -422,6 +419,7 @@ jobs:
422419
423420
post_steps:
424421
name: Post-Build StepJOB_NAME
422+
if: FORK_CONDITION
425423
needs: [build]
426424
runs-on: ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed.
427425
steps:
@@ -503,20 +501,34 @@ jobs:
503501
504502
style_lint:
505503
name: Lint styleJOB_NAME
504+
if: FORK_CONDITION
506505
runs-on: ubuntu-latest
507506
steps:
508507
- uses: leanprover-community/lint-style-action@f2e7272aad56233a642b08fe974cf09dd664b0c8 # 2025-05-22
509508
with:
510509
mode: check
511510
lint-bib-file: true
512511

512+
build_and_lint:
513+
name: CI Success
514+
if: FORK_CONDITION
515+
needs: [style_lint, post_steps]
516+
runs-on: ubuntu-latest
517+
steps:
518+
- name: succeed
519+
run: |
520+
echo "Success: Required build and lint checks completed!"
521+
513522
final:
514523
name: Post-CI jobJOB_NAME
515524
if: FORK_CONDITION
516525
needs: [style_lint, build, post_steps]
517526
runs-on: ubuntu-latest
518527
steps:
519-
- id: PR
528+
# This action is used to determine the PR metadata in the event of a push.
529+
# If it is called from a PR from a fork, it will find nothing/irrelevant data.
530+
- if: github.event_name != 'pull_request_target'
531+
id: PR_from_push
520532
uses: 8BitJonny/gh-get-current-pr@08e737c57a3a4eb24cec6487664b243b77eb5e36 # 3.0.0
521533
# TODO: this may not work properly if the same commit is pushed to multiple branches:
522534
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
@@ -525,6 +537,13 @@ jobs:
525537
# Only return if PR is still open
526538
filterOutClosed: true
527539

540+
# Combine the output from the previous action with the metadata supplied by GitHub itself.
541+
- id: PR
542+
shell: bash
543+
run: |
544+
echo "number=${{ steps.PR_from_push.outputs.number || github.event.pull_request.number }}" >> $GITHUB_OUTPUT
545+
echo "pr_labels=${{ steps.PR_from_push.outputs.pr_labels || join(github.event.pull_request.labels.*.name, ',') }}" >> $GITHUB_OUTPUT
546+
528547
- if: contains(steps.PR.outputs.pr_labels, 'bench-after-CI')
529548
name: If `bench-after-CI` is present, add a `!bench` comment.
530549
uses: GrantBirki/comment@608e41b19bc973020ec0e189ebfdae935d7fe0cc # v2.1.1

.github/workflows/PR_summary.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: Post PR summary comment
33
on:
44
pull_request_target:
55

6+
# Limit permissions for GITHUB_TOKEN for the entire workflow
7+
permissions:
8+
contents: read
9+
pull-requests: write # Only allow PR comments/labels
10+
# All other permissions are implicitly 'none'
11+
612
jobs:
713
build:
814
name: "post-or-update-summary-comment"
Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,64 @@
11
name: Autolabel PRs
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened]
66
push:
77
paths:
88
- scripts/autolabel.lean
99
- .github/workflows/add_label_from_diff.yaml
1010

11+
# Limit permissions for GITHUB_TOKEN for the entire workflow
12+
permissions:
13+
contents: read
14+
pull-requests: write # Only allow PR comments/labels
15+
# All other permissions are implicitly 'none'
16+
1117
jobs:
1218
add_topic_label:
1319
name: Add topic label
1420
runs-on: ubuntu-latest
1521
# Don't run on forks, where we wouldn't have permissions to add the label anyway.
1622
if: github.repository == 'leanprover-community/mathlib4'
17-
permissions:
18-
issues: write
19-
checks: write
20-
pull-requests: write
21-
contents: read
2223
steps:
23-
- name: Checkout code
24-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25-
with:
26-
fetch-depth: 0
27-
- name: Configure Lean
28-
uses: leanprover/lean-action@f807b338d95de7813c5c50d018f1c23c9b93b4ec # 2025-04-24
29-
with:
30-
auto-config: false
31-
use-github-cache: false
32-
use-mathlib-cache: false
33-
- name: lake exe autolabel
34-
run: |
35-
# the checkout dance, to avoid a detached head
36-
git checkout master
37-
git checkout -
38-
lake exe autolabel "$NUMBER"
39-
env:
40-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
GH_REPO: ${{ github.repository }}
42-
NUMBER: ${{ github.event.number }}
24+
- name: Checkout code
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
with:
27+
ref: ${{ github.event.pull_request.head.sha }}
28+
fetch-depth: 0
29+
- name: Configure Lean
30+
uses: leanprover/lean-action@f807b338d95de7813c5c50d018f1c23c9b93b4ec # 2025-04-24
31+
with:
32+
auto-config: false
33+
use-github-cache: false
34+
use-mathlib-cache: false
35+
- name: lake exe autolabel
36+
run: |
37+
# the checkout dance, to avoid a detached head
38+
git checkout master
39+
git checkout -
40+
labels="$(lake exe autolabel)"
41+
printf '%s\n' "${labels}"
42+
# extract
43+
label="$(printf '%s' "${labels}" | sed -n 's=.*#\[\([^,]*\)\].*=\1=p')"
44+
printf 'label: "%s"\n' "${label}"
45+
if [ -n "${label}" ]
46+
then
47+
printf 'Applying label %s\n' "${label}"
48+
# we use curl rather than octokit/request-action so that the job won't fail
49+
# (and send an annoying email) if the labels don't exist
50+
url="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels"
51+
printf 'url: %s\n' "${url}"
52+
jsonLabel="$(printf '{"labels":["%s"]}' "${label}")"
53+
printf 'jsonLabel: %s\n' "${jsonLabel}"
54+
curl --request POST \
55+
--header 'Accept: application/vnd.github+json' \
56+
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
57+
--header 'X-GitHub-Api-Version: 2022-11-28' \
58+
--url "${url}" \
59+
--data "${jsonLabel}"
60+
else
61+
echo "There is no single label that we could apply, so we are not applying any label."
62+
fi
63+
env:
64+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/bors.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ permissions:
3838

3939
jobs:
4040
build:
41-
if: true
41+
if: github.repository == 'leanprover-community/mathlib4'
4242
name: Build
4343
runs-on: bors
4444
outputs:
@@ -146,9 +146,8 @@ jobs:
146146
shell: bash # We're only building the `master` branch version of the tools, so don't need to run inside landrun.
147147
run: |
148148
cd master-branch
149-
lake build cache mk_all check-yaml graph
149+
lake build cache check-yaml graph
150150
ls .lake/build/bin/cache
151-
ls .lake/build/bin/mk_all
152151
ls .lake/build/bin/check-yaml
153152
ls .lake/packages/importGraph/.lake/build/bin/graph
154153
@@ -229,13 +228,11 @@ jobs:
229228
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
230229
id: mk_all
231230
continue-on-error: true # Allow workflow to continue, outcome checked later
232-
# This only runs `mk_all --check` from the `master-branch`, so doesn't need to be inside landrun
233-
shell: bash
231+
# This runs `mk_all --check` from the `pr-branch` inside landrun
234232
run: |
235233
cd pr-branch
236-
237-
echo "Running mk_all --check (from master-branch)..."
238-
LAKE_HOME="$TOOLCHAIN_DIR" ../master-branch/.lake/build/bin/mk_all --check
234+
echo "Running mk_all --check (from pr-branch)..."
235+
lake exe mk_all --check
239236
240237
- name: begin gh-problem-match-wrap for build step
241238
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
@@ -432,6 +429,7 @@ jobs:
432429
433430
post_steps:
434431
name: Post-Build Step
432+
if: github.repository == 'leanprover-community/mathlib4'
435433
needs: [build]
436434
runs-on: ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed.
437435
steps:
@@ -513,20 +511,34 @@ jobs:
513511
514512
style_lint:
515513
name: Lint style
514+
if: github.repository == 'leanprover-community/mathlib4'
516515
runs-on: ubuntu-latest
517516
steps:
518517
- uses: leanprover-community/lint-style-action@f2e7272aad56233a642b08fe974cf09dd664b0c8 # 2025-05-22
519518
with:
520519
mode: check
521520
lint-bib-file: true
522521

522+
build_and_lint:
523+
name: CI Success
524+
if: github.repository == 'leanprover-community/mathlib4'
525+
needs: [style_lint, post_steps]
526+
runs-on: ubuntu-latest
527+
steps:
528+
- name: succeed
529+
run: |
530+
echo "Success: Required build and lint checks completed!"
531+
523532
final:
524533
name: Post-CI job
525-
if: true
534+
if: github.repository == 'leanprover-community/mathlib4'
526535
needs: [style_lint, build, post_steps]
527536
runs-on: ubuntu-latest
528537
steps:
529-
- id: PR
538+
# This action is used to determine the PR metadata in the event of a push.
539+
# If it is called from a PR from a fork, it will find nothing/irrelevant data.
540+
- if: github.event_name != 'pull_request_target'
541+
id: PR_from_push
530542
uses: 8BitJonny/gh-get-current-pr@08e737c57a3a4eb24cec6487664b243b77eb5e36 # 3.0.0
531543
# TODO: this may not work properly if the same commit is pushed to multiple branches:
532544
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
@@ -535,6 +547,13 @@ jobs:
535547
# Only return if PR is still open
536548
filterOutClosed: true
537549

550+
# Combine the output from the previous action with the metadata supplied by GitHub itself.
551+
- id: PR
552+
shell: bash
553+
run: |
554+
echo "number=${{ steps.PR_from_push.outputs.number || github.event.pull_request.number }}" >> $GITHUB_OUTPUT
555+
echo "pr_labels=${{ steps.PR_from_push.outputs.pr_labels || join(github.event.pull_request.labels.*.name, ',') }}" >> $GITHUB_OUTPUT
556+
538557
- if: contains(steps.PR.outputs.pr_labels, 'bench-after-CI')
539558
name: If `bench-after-CI` is present, add a `!bench` comment.
540559
uses: GrantBirki/comment@608e41b19bc973020ec0e189ebfdae935d7fe0cc # v2.1.1

.github/workflows/bot_fix_style.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ jobs:
3131
with:
3232
mode: fix
3333
lint-bib-file: true
34-
bot-fix-style-token: ${{ secrets.GITHUB_TOKEN }}
34+
BOT_FIX_STYLE_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ permissions:
4545

4646
jobs:
4747
build:
48-
if: true
48+
if: github.repository == 'leanprover-community/mathlib4'
4949
name: Build
5050
runs-on: pr
5151
outputs:
@@ -153,9 +153,8 @@ jobs:
153153
shell: bash # We're only building the `master` branch version of the tools, so don't need to run inside landrun.
154154
run: |
155155
cd master-branch
156-
lake build cache mk_all check-yaml graph
156+
lake build cache check-yaml graph
157157
ls .lake/build/bin/cache
158-
ls .lake/build/bin/mk_all
159158
ls .lake/build/bin/check-yaml
160159
ls .lake/packages/importGraph/.lake/build/bin/graph
161160
@@ -236,13 +235,11 @@ jobs:
236235
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
237236
id: mk_all
238237
continue-on-error: true # Allow workflow to continue, outcome checked later
239-
# This only runs `mk_all --check` from the `master-branch`, so doesn't need to be inside landrun
240-
shell: bash
238+
# This runs `mk_all --check` from the `pr-branch` inside landrun
241239
run: |
242240
cd pr-branch
243-
244-
echo "Running mk_all --check (from master-branch)..."
245-
LAKE_HOME="$TOOLCHAIN_DIR" ../master-branch/.lake/build/bin/mk_all --check
241+
echo "Running mk_all --check (from pr-branch)..."
242+
lake exe mk_all --check
246243
247244
- name: begin gh-problem-match-wrap for build step
248245
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
@@ -439,6 +436,7 @@ jobs:
439436
440437
post_steps:
441438
name: Post-Build Step
439+
if: github.repository == 'leanprover-community/mathlib4'
442440
needs: [build]
443441
runs-on: ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed.
444442
steps:
@@ -520,20 +518,34 @@ jobs:
520518
521519
style_lint:
522520
name: Lint style
521+
if: github.repository == 'leanprover-community/mathlib4'
523522
runs-on: ubuntu-latest
524523
steps:
525524
- uses: leanprover-community/lint-style-action@f2e7272aad56233a642b08fe974cf09dd664b0c8 # 2025-05-22
526525
with:
527526
mode: check
528527
lint-bib-file: true
529528

529+
build_and_lint:
530+
name: CI Success
531+
if: github.repository == 'leanprover-community/mathlib4'
532+
needs: [style_lint, post_steps]
533+
runs-on: ubuntu-latest
534+
steps:
535+
- name: succeed
536+
run: |
537+
echo "Success: Required build and lint checks completed!"
538+
530539
final:
531540
name: Post-CI job
532-
if: true
541+
if: github.repository == 'leanprover-community/mathlib4'
533542
needs: [style_lint, build, post_steps]
534543
runs-on: ubuntu-latest
535544
steps:
536-
- id: PR
545+
# This action is used to determine the PR metadata in the event of a push.
546+
# If it is called from a PR from a fork, it will find nothing/irrelevant data.
547+
- if: github.event_name != 'pull_request_target'
548+
id: PR_from_push
537549
uses: 8BitJonny/gh-get-current-pr@08e737c57a3a4eb24cec6487664b243b77eb5e36 # 3.0.0
538550
# TODO: this may not work properly if the same commit is pushed to multiple branches:
539551
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
@@ -542,6 +554,13 @@ jobs:
542554
# Only return if PR is still open
543555
filterOutClosed: true
544556

557+
# Combine the output from the previous action with the metadata supplied by GitHub itself.
558+
- id: PR
559+
shell: bash
560+
run: |
561+
echo "number=${{ steps.PR_from_push.outputs.number || github.event.pull_request.number }}" >> $GITHUB_OUTPUT
562+
echo "pr_labels=${{ steps.PR_from_push.outputs.pr_labels || join(github.event.pull_request.labels.*.name, ',') }}" >> $GITHUB_OUTPUT
563+
545564
- if: contains(steps.PR.outputs.pr_labels, 'bench-after-CI')
546565
name: If `bench-after-CI` is present, add a `!bench` comment.
547566
uses: GrantBirki/comment@608e41b19bc973020ec0e189ebfdae935d7fe0cc # v2.1.1

0 commit comments

Comments
 (0)