Skip to content

Commit

Permalink
Merge branch 'master' into yoh
Browse files Browse the repository at this point in the history
  • Loading branch information
yoh-tanimoto committed Sep 3, 2024
2 parents 3d43166 + c7efd22 commit 1862b32
Show file tree
Hide file tree
Showing 4,785 changed files with 123,228 additions and 208,689 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

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

"hostRequirements": {
"cpus": 4
},

"customizations": {
"vscode" : {
"extensions" : [ "leanprover.lean4" ]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/PR_summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
# Compute the counts for the merge base
python ./scripts/count-trans-deps.py "Mathlib/" > base.json
# switch back to the current branch: the `no_lost_declarations` script should be here
# switch back to the current branch: the `declarations_diff` script should be here
git checkout "${currentHash}"
- name: Post or update the summary comment
env:
Expand All @@ -69,7 +69,7 @@ jobs:
fi
## Declarations' diff comment
declDiff=$(./scripts/no_lost_declarations.sh short)
declDiff=$(./scripts/declarations_diff.sh)
if [ "$(printf '%s' "${declDiff}" | wc -l)" -gt 15 ]
then
declDiff="$(printf '<details><summary>\n\n%s\n\n</summary>\n\n%s\n\n</details>\n' "#### Declarations diff" "${declDiff}")"
Expand Down
15 changes: 1 addition & 14 deletions .github/workflows/add_label_from_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,10 @@ jobs:

- if: (steps.parse_pr_head.outputs.head_user == 'leanprover-community') && (steps.parse_user.outputs.permission == 'admin')
id: remove_labels
name: Remove "awaiting-review" and "awaiting-author"
name: Remove "awaiting-author"
# we use curl rather than octokit/request-action so that the job won't fail
# (and send an annoying email) if the labels don't exist
run: |
curl --request DELETE \
--url https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels/awaiting-review \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}'
curl --request DELETE \
--url https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels/awaiting-author \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}'
Expand Down Expand Up @@ -131,13 +128,3 @@ jobs:
labels: '["delegated"]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- if: (steps.parse_pr_head.outputs.head_user == 'leanprover-community') && (steps.parse_user.outputs.permission == 'admin')
id: remove_labels
name: Remove "awaiting-review"
# we use curl rather than octokit/request-action so that the job won't fail
# (and send an annoying email) if the labels don't exist
run: |
curl --request DELETE \
--url https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels/awaiting-review \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}'
15 changes: 1 addition & 14 deletions .github/workflows/add_label_from_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,10 @@ jobs:

- if: (steps.parse_pr_head.outputs.head_user == 'leanprover-community') && (steps.parse_user.outputs.permission == 'admin')
id: remove_labels
name: Remove "awaiting-review" and "awaiting-author"
name: Remove "awaiting-author"
# we use curl rather than octokit/request-action so that the job won't fail
# (and send an annoying email) if the labels don't exist
run: |
curl --request DELETE \
--url https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/awaiting-review \
--header 'authorization: Bearer ${{ secrets.TRIAGE_TOKEN }}'
curl --request DELETE \
--url https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/awaiting-author \
--header 'authorization: Bearer ${{ secrets.TRIAGE_TOKEN }}'
Expand Down Expand Up @@ -131,13 +128,3 @@ jobs:
labels: '["delegated"]'
env:
GITHUB_TOKEN: ${{ secrets.TRIAGE_TOKEN }}

- if: (steps.parse_pr_head.outputs.head_user == 'leanprover-community') && (steps.parse_user.outputs.permission == 'admin')
id: remove_labels
name: Remove "awaiting-review"
# we use curl rather than octokit/request-action so that the job won't fail
# (and send an annoying email) if the labels don't exist
run: |
curl --request DELETE \
--url https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/awaiting-review \
--header 'authorization: Bearer ${{ secrets.TRIAGE_TOKEN }}'
33 changes: 26 additions & 7 deletions .github/workflows/bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ jobs:
- name: Look for ignored files
uses: credfeto/action-no-ignored-files@v1.1.0

- name: "Check for Lean files with the executable bit set"
shell: bash
run: |
executable_files="$(find . -name '*.lean' -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \))"
if [[ -n "$executable_files" ]]
then
echo "ERROR: The following Lean files have the executable bit set."
echo "$executable_files"
exit 1
fi
- name: install Python
if: ${{ 'bors' == 'ubuntu-latest' }}
uses: actions/setup-python@v5
Expand All @@ -57,9 +68,9 @@ jobs:
./elan-init -y --default-toolchain none
echo "$HOME/.elan/bin" >> "${GITHUB_PATH}"
- name: "run style linters: Python ones and their Lean rewrite"
- name: "run style linters"
run: |
./scripts/lint-style.sh
lake exe lint-style
- name: Install bibtool
if: ${{ 'bors' == 'ubuntu-latest' }}
Expand Down Expand Up @@ -151,8 +162,10 @@ jobs:
- name: get cache
id: get
run: |
lake exe cache clean
lake exe cache get
rm -rf .lake/build/lib/Mathlib/
# Fail quickly if the cache is completely cold, by checking for Mathlib.Init
lake exe cache get Mathlib.Init
lake build --no-build Mathlib.Init && lake exe cache get || echo "No cache for 'Mathlib.Init' available"
- name: build mathlib
id: build
Expand Down Expand Up @@ -236,19 +249,25 @@ jobs:
- name: check declarations in db files
run: |
python3 scripts/yaml_check.py docs/100.yaml docs/overview.yaml docs/undergrad.yaml
lake exe checkYaml
lake exe check-yaml
- name: verify `lake exe graph` works
run: |
lake exe graph
rm import_graph.dot
- name: build everything
# make sure everything is available for test/import_all.lean
run: |
lake build Batteries Qq Aesop ProofWidgets
- name: test mathlib
id: test
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: gcc
run: lake test
run:
lake test

- name: check for unused imports
id: shake
Expand Down Expand Up @@ -313,7 +332,7 @@ jobs:
- if: contains(steps.PR.outputs.pr_labels, 'auto-merge-after-CI')
name: If `auto-merge-after-CI` is present, add a `bors merge` comment.
uses: GrantBirki/comment@v2.0.1
uses: GrantBirki/comment@v2
with:
token: ${{ secrets.AUTO_MERGE_TOKEN }}
issue-number: ${{ steps.PR.outputs.number }}
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/bot_fix_style_comment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: bot fix style (comment)

on:
issue_comment:
types: [created, edited]

jobs:
fix_style:
name: Fix style issues from lint
if: (github.event.issue.pull_request) && (startsWith(github.event.comment.body, 'bot fix style') || contains(toJSON(github.event.comment.body), '\nbot fix style'))
runs-on: ubuntu-latest
steps:
- id: user_permission
uses: actions-cool/check-user-permission@v2
with:
require: 'write'

- name: Add reaction
if: steps.user_permission.outputs.require-result == 'true'
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
reactions: rocket

- name: cleanup
if: steps.user_permission.outputs.require-result == 'true'
run: |
find . -name . -o -prune -exec rm -rf -- {} +
- uses: actions/checkout@v4
if: steps.user_permission.outputs.require-result == 'true'
with:
token: ${{ secrets.BOT_FIX_STYLE_TOKEN }}

- name: Checkout PR branch
if: steps.user_permission.outputs.require-result == 'true'
run: |
gh pr checkout ${{ github.event.issue.number }}
env:
GH_TOKEN: ${{ secrets.BOT_FIX_STYLE_TOKEN }}

- name: install Python
if: steps.user_permission.outputs.require-result == 'true'
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: install elan
if: steps.user_permission.outputs.require-result == 'true'
run: |
set -o pipefail
curl -sSfL https://github.com/leanprover/elan/releases/download/v3.1.1/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
./elan-init -y --default-toolchain none
echo "$HOME/.elan/bin" >> "${GITHUB_PATH}"
# run the same linting steps as in lint_and_suggest_pr.yaml

- name: lint
if: steps.user_permission.outputs.require-result == 'true'
run: |
lake exe lint-style --fix
- name: Install bibtool
if: steps.user_permission.outputs.require-result == 'true'
run: |
sudo apt-get update
sudo apt-get install -y bibtool
- name: lint references.bib
if: steps.user_permission.outputs.require-result == 'true'
run: |
# ignoring the return code allows the following `reviewdog` step to add GitHub suggestions
./scripts/lint-bib.sh || true
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
if: steps.user_permission.outputs.require-result == 'true'
run: |
# ignoring the return code allows the following `reviewdog` step to add GitHub suggestions
lake exe mk_all || true
- name: Commit and push changes
if: steps.user_permission.outputs.require-result == 'true'
run: |
# cleanup junk from build
rm elan-init
rm docs/references.bib.old
# setup commit and push
git config user.name "leanprover-community-mathlib4-bot"
git config user.email "leanprover-community-mathlib4-bot@users.noreply.github.com"
git add .
# Don't fail if there's nothing to commit
git commit -m "commit changes from style linters" || true
git push origin HEAD
99 changes: 99 additions & 0 deletions .github/workflows/bot_fix_style_review.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: bot fix style (review)

on:
pull_request_review:
# triggers on a review, whether or not it is accompanied by a comment
types: [submitted]

jobs:
fix_style:
name: Fix style issues from lint
if: (startsWith(github.event.review.body, 'bot fix style') || contains(toJSON(github.event.review.body), '\nbot fix style'))
runs-on: ubuntu-latest
steps:
- id: user_permission
uses: actions-cool/check-user-permission@v2
with:
require: 'write'

# Maybe no API exists for this yet?
# - name: Add reaction
# if: steps.user_permission.outputs.require-result == 'true'
# run: |
# gh api --method POST \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ github.event.pull_request.number }}/reviews/${{ github.event.review.id }}/reactions \
# -f "content=rocket"
# env:
# GH_TOKEN: ${{ secrets.BOT_FIX_STYLE_TOKEN }}

- name: cleanup
if: steps.user_permission.outputs.require-result == 'true'
run: |
find . -name . -o -prune -exec rm -rf -- {} +
- uses: actions/checkout@v4
if: steps.user_permission.outputs.require-result == 'true'
with:
token: ${{ secrets.BOT_FIX_STYLE_TOKEN }}

- name: Checkout PR branch
if: steps.user_permission.outputs.require-result == 'true'
run: |
gh pr checkout ${{ github.event.pull_request.number }}
env:
GH_TOKEN: ${{ secrets.BOT_FIX_STYLE_TOKEN }}

- name: install Python
if: steps.user_permission.outputs.require-result == 'true'
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: install elan
if: steps.user_permission.outputs.require-result == 'true'
run: |
set -o pipefail
curl -sSfL https://github.com/leanprover/elan/releases/download/v3.1.1/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
./elan-init -y --default-toolchain none
echo "$HOME/.elan/bin" >> "${GITHUB_PATH}"
# run the same linting steps as in lint_and_suggest_pr.yaml

- name: lint
if: steps.user_permission.outputs.require-result == 'true'
run: |
lake exe lint-style --fix
- name: Install bibtool
if: steps.user_permission.outputs.require-result == 'true'
run: |
sudo apt-get update
sudo apt-get install -y bibtool
- name: lint references.bib
if: steps.user_permission.outputs.require-result == 'true'
run: |
# ignoring the return code allows the following `reviewdog` step to add GitHub suggestions
./scripts/lint-bib.sh || true
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
if: steps.user_permission.outputs.require-result == 'true'
run: |
# ignoring the return code allows the following `reviewdog` step to add GitHub suggestions
lake exe mk_all || true
- name: Commit and push changes
if: steps.user_permission.outputs.require-result == 'true'
run: |
# cleanup junk from build
rm elan-init
rm docs/references.bib.old
# setup commit and push
git config user.name "leanprover-community-mathlib4-bot"
git config user.email "leanprover-community-mathlib4-bot@users.noreply.github.com"
git add .
# Don't fail if there's nothing to commit
git commit -m "commit changes from style linters" || true
git push origin HEAD
Loading

0 comments on commit 1862b32

Please sign in to comment.