Skip to content

Commit 87b0581

Browse files
committed
Merge remote-tracking branch 'upstream/master' into exists_partialSups_eq
2 parents 9ec609d + 18978c4 commit 87b0581

4,892 files changed

Lines changed: 124601 additions & 58279 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.

.devcontainer/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
FROM mcr.microsoft.com/devcontainers/base:jammy
1+
FROM mcr.microsoft.com/devcontainers/base:ubuntu
22

33
USER vscode
44
WORKDIR /home/vscode
55

66
RUN curl https://elan.lean-lang.org/elan-init.sh -sSf | sh -s -- -y --default-toolchain none
7-
8-
ENV PATH="/home/vscode/.elan/bin:${PATH}"

.devcontainer/devcontainer.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
{
22
"name": "Mathlib4 dev container",
33

4-
"image": "ghcr.io/leanprover-community/mathlib4/gitpod",
4+
"build": {
5+
"dockerfile": "Dockerfile"
6+
},
57

68
"onCreateCommand": "lake exe cache get!",
79

810
"hostRequirements": {
9-
"cpus": 4
11+
"cpus": 4,
12+
"memory": "8gb"
1013
},
1114

1215
"customizations": {
13-
"vscode" : {
14-
"extensions" : [ "leanprover.lean4" ]
16+
"vscode": {
17+
"extensions": ["leanprover.lean4"]
1518
}
1619
}
1720
}

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ version: 2 # Specifies the version of the Dependabot configuration file format
33
updates:
44
# Configuration for dependency updates
55
- package-ecosystem: "github-actions" # Specifies the ecosystem to check for updates
6-
directories:
7-
- "/.github/*" # covers `build.in.yml` as well, which is not in `.github/workflows/` because it shouldn't be run in CI.
6+
directories:
7+
- "/.github/workflows"
88
schedule:
99
# Check for updates to GitHub Actions every month
1010
interval: "monthly"
1111
groups:
12-
# group updates into single PRs since we want to update both build.in.yml and its outputs at the same time
12+
# group updates into single PRs
1313
actions-version-updates:
1414
applies-to: version-updates
1515
patterns:

.github/workflows/PR_summary.yml

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,22 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2121
with:
2222
ref: ${{ github.event.pull_request.head.sha }}
2323
fetch-depth: 0
2424
path: pr-branch
2525

26-
# Checkout the master branch into a subdirectory
27-
- name: Checkout master branch
28-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
26+
- name: Checkout mathlib-ci
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2928
with:
30-
# When testing the scripts, comment out the "ref: master"
31-
ref: master
32-
path: master-branch
29+
repository: leanprover-community/mathlib-ci
30+
ref: 7c2dcf950607e48029aec2a614e840f2a14ae7e1
31+
fetch-depth: 1
32+
path: ci-tools
33+
34+
- name: Set up CI scripts paths
35+
uses: ./ci-tools/.github/actions/setup-ci-scripts
3336

3437
- name: Update the merge-conflict label
3538
run: |
@@ -60,7 +63,7 @@ jobs:
6063
fi
6164
6265
- name: Set up Python
63-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
66+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
6467
with:
6568
python-version: 3.12
6669

@@ -79,6 +82,10 @@ jobs:
7982
echo "Saving the changed files to 'changed_files.txt'..."
8083
git diff --name-only origin/${{ github.base_ref }}... | tee changed_files.txt
8184
85+
# Get all newly added files.
86+
echo "Checking for added files..."
87+
git diff --name-only --diff-filter A origin/${{ github.base_ref }}... | tee added_files.txt
88+
8289
# Get all files which were removed or renamed.
8390
echo "Checking for removed files..."
8491
@@ -152,13 +159,13 @@ jobs:
152159
printf 'currentHash=%s\n' "${currentHash}"
153160
154161
echo "Compute the counts for the HEAD of the PR"
155-
python ../master-branch/scripts/count-trans-deps.py "Mathlib/" > head.json
162+
python "${CI_SCRIPTS_DIR}/pr_summary/count-trans-deps.py" "Mathlib/" > head.json
156163
157164
# Checkout the merge base
158165
git checkout "$(git merge-base master ${{ github.event.pull_request.head.sha }})"
159166
160167
echo "Compute the counts for the merge base"
161-
python ../master-branch/scripts/count-trans-deps.py "Mathlib/" > base.json
168+
python "${CI_SCRIPTS_DIR}/pr_summary/count-trans-deps.py" "Mathlib/" > base.json
162169
163170
# switch back to the current branch: the `declarations_diff` script should be here
164171
git checkout "${currentHash}" --
@@ -173,12 +180,12 @@ jobs:
173180
PR="${{ github.event.pull_request.number }}"
174181
title="### PR summary"
175182
176-
graphAndHighPercentReports=$(python ../master-branch/scripts/import-graph-report.py base.json head.json changed_files.txt)
183+
graphAndHighPercentReports=$(python "${CI_SCRIPTS_DIR}/pr_summary/import-graph-report.py" base.json head.json changed_files.txt)
177184
178185
echo "Produce import count comment"
179186
importCount=$(
180187
printf '%s\n' "${graphAndHighPercentReports}" | sed '/^Import changes exceeding/Q'
181-
../master-branch/scripts/import_trans_difference.sh
188+
"${CI_SCRIPTS_DIR}/pr_summary/import_trans_difference.sh"
182189
)
183190
184191
echo "Produce high percentage imports"
@@ -202,7 +209,7 @@ jobs:
202209
fi
203210
204211
echo "Compute Declarations' diff comment"
205-
declDiff=$(../master-branch/scripts/declarations_diff.sh)
212+
declDiff=$("${CI_SCRIPTS_DIR}/pr_summary/declarations_diff.sh")
206213
if [ "$(printf '%s' "${declDiff}" | wc -l)" -gt 15 ]
207214
then
208215
declDiff="$(printf '<details><summary>\n\n%s\n\n</summary>\n\n%s\n\n</details>\n' "#### Declarations diff" "${declDiff}")"
@@ -214,10 +221,40 @@ jobs:
214221
printf 'hashURL: %s' "${hashURL}"
215222
216223
echo "Compute technical debt changes"
217-
techDebtVar="$(../master-branch/scripts/technical-debt-metrics.sh pr_summary)"
224+
techDebtVar="$("${CI_SCRIPTS_DIR}/reporting/technical-debt-metrics.sh" pr_summary)"
225+
226+
echo "Compute documentation reminder"
227+
workflowFilesChanged="$(grep '^\.github/workflows/' changed_files.txt || true)"
228+
if [ -n "${workflowFilesChanged}" ]
229+
then
230+
# Format each changed workflow path as a Markdown bullet: "- `path`"
231+
workflowFilesChangedMarkdown="$(sed "s|^|- \`|; s|\$|\`|" <<< "${workflowFilesChanged}")"
232+
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}")"
233+
else
234+
workflowDocsReminder=""
235+
fi
236+
237+
echo "Compute scripts-location reminder"
238+
scriptsFilesAdded="$(grep '^scripts/' added_files.txt || true)"
239+
if [ -n "${scriptsFilesAdded}" ]
240+
then
241+
# Format each added scripts path as a Markdown bullet: "- `path`"
242+
scriptsFilesAddedMarkdown="$(sed "s|^|- \`|; s|\$|\`|" <<< "${scriptsFilesAdded}")"
243+
scriptsLocationReminder="$(printf "### Scripts folder reminder\nThis PR adds files under \`scripts/\`.\nPlease consider whether each added script belongs in this repository or in \`leanprover-community/mathlib-ci\`.\n\nAdded scripts files:\n%s\n" "${scriptsFilesAddedMarkdown}")"
244+
else
245+
scriptsLocationReminder=""
246+
fi
218247
219248
# store in a file, to avoid "long arguments" error.
220249
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
250+
if [ -n "${workflowDocsReminder}" ]
251+
then
252+
printf '\n\n---\n\n%s\n' "${workflowDocsReminder}" >> please_merge_master.md
253+
fi
254+
if [ -n "${scriptsLocationReminder}" ]
255+
then
256+
printf '\n\n---\n\n%s\n' "${scriptsLocationReminder}" >> please_merge_master.md
257+
fi
221258
222259
echo "Include any errors about removed or renamed files without deprecation,"
223260
echo "as well as errors about extraneous deprecated_module additions."
@@ -233,7 +270,7 @@ jobs:
233270
fi
234271
235272
cat please_merge_master.md
236-
../master-branch/scripts/update_PR_comment.sh please_merge_master.md "${title}" "${PR}"
273+
"${CI_SCRIPTS_DIR}/pr_summary/update_PR_comment.sh" please_merge_master.md "${title}" "${PR}"
237274
238275
- name: Update the file-removed label
239276
run: |

.github/workflows/actionlint.yml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,22 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
13+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1414

1515
- name: suggester / actionlint
16-
uses: reviewdog/action-actionlint@83e4ed25b168066ad8f62f5afbb29ebd8641d982 # v1.69.1
16+
uses: reviewdog/action-actionlint@e58ee9d111489c31395fbe4857b0be6e7635dbda # v1.70.0
1717
with:
1818
tool_name: actionlint
19-
fail_level: error
19+
fail_level: any
2020

21-
check_build_yml:
22-
name: check workflows generated by build.in.yml
21+
ensure-sha-pinned-actions:
2322
runs-on: ubuntu-latest
2423
steps:
25-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
26-
27-
- name: update workflows
28-
run: |
29-
cd .github/workflows/
30-
./mk_build_yml.sh
24+
- name: Checkout
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3126

32-
- name: suggester / build.in.yml
33-
uses: reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff # v1.24.0
34-
with:
35-
tool_name: mk_build_yml.sh
36-
fail_level: error
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/add_label_from_diff.yaml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,42 @@ jobs:
2121
# Don't run on forks, where we wouldn't have permissions to add the label anyway.
2222
if: github.repository == 'leanprover-community/mathlib4'
2323
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
24+
- name: Checkout master branch to build autolabel from
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2626
with:
27-
ref: ${{ github.event.pull_request.head.sha }}
28-
fetch-depth: 0
27+
ref: master
28+
path: tools
2929
- name: Configure Lean
30-
uses: leanprover/lean-action@434f25c2f80ded67bba02502ad3a86f25db50709 # v1.3.0
30+
uses: leanprover/lean-action@c544e89643240c6b398f14a431bcdc6309e36b3e # v1.4.0
3131
with:
3232
auto-config: false
3333
use-github-cache: false
3434
use-mathlib-cache: false
35-
- name: lake exe autolabel
35+
lake-package-directory: tools # Building here
36+
- name: Build autolabel from master
37+
working-directory: tools
38+
run: |
39+
lake build autolabel
40+
- name: Checkout branch to label
41+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
42+
with:
43+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
44+
fetch-depth: 0
45+
path: pr-branch
46+
- name: Run autolabel
47+
working-directory: pr-branch
3648
run: |
37-
# the checkout dance, to avoid a detached head
38-
git checkout master
39-
git checkout -
40-
labels="$(lake exe autolabel)"
49+
labels="$("${GITHUB_WORKSPACE}/tools/.lake/build/bin/autolabel")"
4150
printf '%s\n' "${labels}"
4251
# extract
43-
label="$(printf '%s' "${labels}" | sed -n 's=.*#\[\([^,]*\)\].*=\1=p')"
52+
label="$(printf '%s' "${labels}" | sed -n 's=^::notice::.*#\[\([^,]*\)\].*=\1=p')"
4453
printf 'label: "%s"\n' "${label}"
45-
if [ -n "${label}" ]
54+
if [ -n "${label}" ] && [ -n "${PR_NUMBER}" ]
4655
then
4756
printf 'Applying label %s\n' "${label}"
4857
# we use curl rather than octokit/request-action so that the job won't fail
4958
# (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"
59+
url="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/labels"
5160
printf 'url: %s\n' "${url}"
5261
jsonLabel="$(printf '{"labels":["%s"]}' "${label}")"
5362
printf 'jsonLabel: %s\n' "${jsonLabel}"
@@ -62,3 +71,6 @@ jobs:
6271
fi
6372
env:
6473
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
# the PR number could be undefined in workflows triggered by 'push',
75+
# in which case we only log the applicable label and exit
76+
PR_NUMBER: ${{ github.event.pull_request.number }}

.github/workflows/auto_assign_reviewers.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)