Skip to content

Commit 545d03c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into infinite-prod-with-zero
2 parents bfab4fb + d87f455 commit 545d03c

1,104 files changed

Lines changed: 21896 additions & 9736 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.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# get-mathlib-ci
2+
3+
This action is the source of truth for how workflows in this repository check out
4+
`leanprover-community/mathlib-ci`.
5+
6+
## Policy
7+
8+
Any workflow that needs `mathlib-ci` should use this action instead of writing its
9+
own `actions/checkout` block for `leanprover-community/mathlib-ci`.
10+
11+
The default `ref` in [`action.yml`](./action.yml) is the single canonical pinned
12+
`mathlib-ci` commit for this repository.
13+
14+
## Why
15+
16+
- Keep the pinned `mathlib-ci` ref in one place.
17+
- Avoid drift and copy/paste mistakes across many workflows.
18+
- Make ref bumps a one-file update.
19+
20+
## Usage
21+
22+
In workflows, check out this repository's actions from the running workflow commit,
23+
then use the local action:
24+
25+
```yaml
26+
- name: Checkout local actions
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28+
with:
29+
ref: ${{ github.workflow_sha }}
30+
fetch-depth: 1
31+
sparse-checkout: .github/actions
32+
path: workflow-actions
33+
34+
- name: Get mathlib-ci
35+
uses: ./workflow-actions/.github/actions/get-mathlib-ci
36+
```
37+
38+
Override the ref only when needed:
39+
40+
```yaml
41+
- name: Get mathlib-ci
42+
uses: ./workflow-actions/.github/actions/get-mathlib-ci
43+
with:
44+
ref: master
45+
```
46+
47+
## Outputs
48+
49+
This action also exposes values that later workflow steps can reuse:
50+
51+
- `ref`: the effective `mathlib-ci` ref that was checked out. If the workflow did
52+
not pass `with.ref`, this is the action's default pinned commit.
53+
- `path`: the checkout path used for `mathlib-ci`.
54+
- `scripts_dir`: the absolute path to the checked out `scripts` directory.
55+
56+
The action also exports these environment variables for subsequent steps:
57+
58+
- `CI_CHECKOUT_PATH`: the absolute path to the checked out `mathlib-ci` repository.
59+
- `CI_SCRIPTS_DIR`: the absolute path to the checked out `mathlib-ci/scripts` directory.
60+
61+
If a workflow needs to refer to the exact resolved `mathlib-ci` ref later, use the
62+
action output instead of duplicating the pinned SHA in the workflow:
63+
64+
```yaml
65+
- name: Get mathlib-ci
66+
id: get_mathlib_ci
67+
uses: ./workflow-actions/.github/actions/get-mathlib-ci
68+
69+
- name: Use resolved ref
70+
run: |
71+
echo "Resolved ref: ${{ steps.get_mathlib_ci.outputs.ref }}"
72+
echo "Scripts dir: ${{ steps.get_mathlib_ci.outputs.scripts_dir }}"
73+
echo "Raw URL: https://raw.githubusercontent.com/leanprover-community/mathlib-ci/${{ steps.get_mathlib_ci.outputs.ref }}/scripts/nightly/create-adaptation-pr.sh"
74+
```
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Source of truth for `mathlib-ci` checkout settings in this repository.
2+
# Workflows should use this action instead of duplicating the checkout block
3+
# and hardcoded ref in multiple places.
4+
name: Get mathlib-ci
5+
description: Checkout leanprover-community/mathlib-ci at a shared ref.
6+
inputs:
7+
ref:
8+
description: Git ref (branch, tag, or SHA) for mathlib-ci.
9+
required: false
10+
# Default pinned commit used by workflows unless they explicitly override.
11+
# Update this ref as needed to pick up changes to mathlib-ci scripts
12+
default: 261ca4c0c6bd3267e4846ef9fdd676afab9fef4e
13+
path:
14+
description: Checkout destination path.
15+
required: false
16+
default: ci-tools
17+
fetch-depth:
18+
description: Number of commits to fetch.
19+
required: false
20+
default: '1'
21+
outputs:
22+
ref:
23+
description: Effective ref used for the checkout.
24+
value: ${{ inputs.ref }}
25+
path:
26+
description: Checkout path used.
27+
value: ${{ inputs.path }}
28+
scripts_dir:
29+
description: Absolute path to the scripts directory.
30+
value: ${{ steps.paths.outputs.scripts_dir }}
31+
runs:
32+
using: composite
33+
steps:
34+
- name: Get mathlib-ci
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36+
with:
37+
repository: leanprover-community/mathlib-ci
38+
ref: ${{ inputs.ref }}
39+
fetch-depth: ${{ inputs.fetch-depth }}
40+
path: ${{ inputs.path }}
41+
42+
- name: Setup CI Scripts Paths
43+
id: paths
44+
shell: bash
45+
run: |
46+
checkout_path="${GITHUB_WORKSPACE}/${{ inputs.path }}"
47+
scripts_dir="${checkout_path}/scripts"
48+
echo "checkout_path=${checkout_path}" >> "$GITHUB_OUTPUT"
49+
echo "scripts_dir=${scripts_dir}" >> "$GITHUB_OUTPUT"
50+
echo "CI_CHECKOUT_PATH=${checkout_path}" >> "$GITHUB_ENV"
51+
echo "CI_SCRIPTS_DIR=${scripts_dir}" >> "$GITHUB_ENV"

.github/workflows/PR_summary.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@ jobs:
2323
fetch-depth: 0
2424
path: pr-branch
2525

26-
- name: Checkout mathlib-ci
26+
- name: Checkout local actions
2727
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2828
with:
29-
repository: leanprover-community/mathlib-ci
30-
ref: 4af75ac0b0d1aaf38d4546a779bc5c68b4d75069
29+
ref: ${{ github.workflow_sha }}
3130
fetch-depth: 1
32-
path: ci-tools
33-
34-
- name: Set up CI scripts paths
35-
uses: ./ci-tools/.github/actions/setup-ci-scripts
31+
sparse-checkout: .github/actions
32+
path: workflow-actions
33+
- name: Get mathlib-ci
34+
uses: ./workflow-actions/.github/actions/get-mathlib-ci
3635

3736
- name: Update the merge-conflict label
3837
run: |

.github/workflows/actionlint.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ on:
33
pull_request:
44
paths:
55
- '.github/**'
6-
merge_group:
76

87
jobs:
98
actionlint:
@@ -13,7 +12,7 @@ jobs:
1312
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1413

1514
- name: suggester / actionlint
16-
uses: reviewdog/action-actionlint@e58ee9d111489c31395fbe4857b0be6e7635dbda # v1.70.0
15+
uses: reviewdog/action-actionlint@0d952c597ef8459f634d7145b0b044a9699e5e43 # v1.71.0
1716
with:
1817
tool_name: actionlint
1918
fail_level: any

.github/workflows/bors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ concurrency:
1515
# Limit permissions for GITHUB_TOKEN for the entire workflow
1616
permissions:
1717
contents: read
18+
id-token: write
1819
pull-requests: write # Only allow PR comments/labels
1920
# All other permissions are implicitly 'none'
2021

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
- 'trying'
1313
# ignore branches meant for experiments
1414
- 'ci-dev/**'
15-
merge_group:
1615

1716
concurrency:
1817
# label each workflow run; only the latest with each label will run
@@ -24,6 +23,7 @@ concurrency:
2423
# Limit permissions for GITHUB_TOKEN for the entire workflow
2524
permissions:
2625
contents: read
26+
id-token: write
2727
pull-requests: write # Only allow PR comments/labels
2828
# All other permissions are implicitly 'none'
2929

.github/workflows/build_fork.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ concurrency:
2424
# Limit permissions for GITHUB_TOKEN for the entire workflow
2525
permissions:
2626
contents: read
27+
id-token: write
2728
pull-requests: write # Only allow PR comments/labels
2829
# All other permissions are implicitly 'none'
2930

.github/workflows/build_template.yml

Lines changed: 28 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
mathlib_ci_ref:
2424
type: string
2525
required: false
26-
default: 4af75ac0b0d1aaf38d4546a779bc5c68b4d75069
26+
default: ''
2727

2828
env:
2929
# Disable Lake's automatic fetching of cloud builds.
@@ -95,16 +95,27 @@ jobs:
9595
ref: ${{ inputs.tools_branch_ref != '' && inputs.tools_branch_ref || (github.repository == 'leanprover-community/mathlib4-nightly-testing' && 'nightly-testing-green' || 'master') }}
9696
path: tools-branch
9797

98-
- name: Checkout mathlib-ci
98+
- name: Checkout local actions
9999
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
100100
with:
101-
repository: leanprover-community/mathlib-ci
102-
ref: ${{ inputs.mathlib_ci_ref }}
101+
ref: ${{ github.workflow_sha }}
103102
fetch-depth: 1
104-
path: ci-tools
105-
106-
- name: Set up CI scripts paths
107-
uses: ./ci-tools/.github/actions/setup-ci-scripts
103+
sparse-checkout: .github/actions
104+
path: workflow-actions
105+
106+
# We need to 'duplicate' this step below because GitHub Actions does not let a `uses:` step
107+
# conditionally omit a single `with:` key, and passing `ref: ''` would override
108+
# the composite action's default to the empty string instead of falling back to it
109+
# Note only one of the two below will actually run in any given run
110+
- name: Get mathlib-ci
111+
if: ${{ inputs.mathlib_ci_ref == '' }}
112+
uses: ./workflow-actions/.github/actions/get-mathlib-ci
113+
114+
- name: Get mathlib-ci
115+
if: ${{ inputs.mathlib_ci_ref != '' }}
116+
uses: ./workflow-actions/.github/actions/get-mathlib-ci
117+
with:
118+
ref: ${{ inputs.mathlib_ci_ref }}
108119

109120
# Checkout the PR branch into a subdirectory
110121
- name: Checkout PR branch
@@ -193,32 +204,6 @@ jobs:
193204
ls .lake/build/bin/check-yaml
194205
ls .lake/packages/importGraph/.lake/build/bin/graph
195206
196-
- name: cleanup .cache/mathlib
197-
# This needs write access to .cache/mathlib, so can't be run inside landrun.
198-
# However it is only using the `tools` version of `cache`, so is safe to run outside landrun.
199-
shell: bash
200-
run: |
201-
# Define the cache directory path
202-
CACHE_DIR="$HOME/.cache/mathlib"
203-
204-
# Check if directory exists
205-
if [ ! -d "$CACHE_DIR" ]; then
206-
echo "::warning::Cache directory does not exist: $CACHE_DIR"
207-
exit 0
208-
fi
209-
210-
# Calculate directory size in bytes
211-
DIR_SIZE=$(du -sb "$CACHE_DIR" | cut -f1)
212-
printf 'Cache size (in bytes): %s\n' "$DIR_SIZE"
213-
214-
# Check if size exceeds 10GB
215-
if [ "$DIR_SIZE" -gt "10737418240" ]; then
216-
echo "Cache size exceeds threshold, running lake exe cache clean"
217-
# We use the tools-branch version of `cache`.
218-
cd tools-branch
219-
lake exe cache clean
220-
fi
221-
222207
- name: download dependencies
223208
# We need network access to download dependencies
224209
# We run this inside landrun, but restrict disk access.
@@ -489,7 +474,7 @@ jobs:
489474
490475
- name: upload cache staging artifact
491476
if: ${{ always() && steps.cache_staging_check.outputs.has_files == 'true' }}
492-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
477+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
493478
with:
494479
name: cache-staging
495480
path: cache-staging/
@@ -583,20 +568,6 @@ jobs:
583568
exit $status
584569
done
585570
586-
# We need to separate this step from the previous script because it needs to run outside of landrun
587-
- name: kill stray runLinter processes
588-
if: ${{ steps.lint.outcome == 'failure' }}
589-
continue-on-error: true
590-
shell: bash
591-
run: |
592-
echo "Checking for runLinter processes..."
593-
if pgrep -af runLinter; then
594-
echo "Killing runLinter processes..."
595-
pkill -f runLinter || true
596-
else
597-
echo "No stray runLinter processes found."
598-
fi
599-
600571
- name: end gh-problem-match-wrap for shake and lint steps
601572
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
602573
with:
@@ -685,7 +656,7 @@ jobs:
685656
echo "CACHE_BIN=$CACHE_BIN" >> "$GITHUB_ENV"
686657
687658
- name: Download cache staging artifact
688-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
659+
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
689660
with:
690661
name: cache-staging
691662
path: cache-staging
@@ -756,7 +727,7 @@ jobs:
756727
lake exe graph
757728
758729
- name: upload the import graph
759-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
730+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
760731
with:
761732
name: import-graph
762733
path: import_graph.dot
@@ -801,10 +772,13 @@ jobs:
801772
steps:
802773
- name: Generate auto merge app token
803774
id: auto-merge-app-token
804-
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
775+
uses: leanprover-community/mathlib-ci/.github/actions/azure-create-github-app-token@3bb576208589a435eeaeac9b144a1b7c3e948760
805776
with:
806777
app-id: ${{ secrets.MATHLIB_AUTO_MERGE_APP_ID }}
807-
private-key: ${{ secrets.MATHLIB_AUTO_MERGE_PRIVATE_KEY }}
778+
key-vault-name: ${{ vars.MATHLIB_AZ_KEY_VAULT_NAME }}
779+
key-name: mathlib-auto-merge-app-pk
780+
azure-client-id: ${{ vars.GH_APP_AZURE_CLIENT_ID_CI_AUTO_MERGE }}
781+
azure-tenant-id: ${{ secrets.LPC_AZ_TENANT_ID }}
808782

809783
- id: PR_from_push
810784
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
@@ -916,7 +890,7 @@ jobs:
916890
name: If `auto-merge-after-CI` is present, add a `bors merge` comment.
917891
uses: GrantBirki/comment@608e41b19bc973020ec0e189ebfdae935d7fe0cc # v2.1.1
918892
with:
919-
# The create-github-app-token README states that this token is masked and will not be logged accidentally.
893+
# This token is masked by the token minting action and will not be logged accidentally.
920894
token: ${{ steps.auto-merge-app-token.outputs.token }}
921895
issue-number: ${{ steps.PR.outputs.number }}
922896
body: |

.github/workflows/ci_dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ on:
2727
# Limit permissions for GITHUB_TOKEN for the entire workflow
2828
permissions:
2929
contents: read
30+
id-token: write
3031
# By default let's remove this permission (which is present in the other build pipelines)
3132
# from the CI experimentation runs to avoid unwitting side effects
3233
# pull-requests: write

.github/workflows/commit_verification.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@ jobs:
4040
ref: ${{ github.event.pull_request.head.sha }}
4141
# Fetch full history to access all PR commits
4242
fetch-depth: 0
43-
- name: Checkout mathlib-ci
43+
- name: Checkout local actions
4444
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4545
with:
46-
repository: leanprover-community/mathlib-ci
47-
ref: 4af75ac0b0d1aaf38d4546a779bc5c68b4d75069
46+
ref: ${{ github.workflow_sha }}
4847
fetch-depth: 1
49-
path: ci-tools
50-
51-
- name: Set up CI scripts paths
52-
uses: ./ci-tools/.github/actions/setup-ci-scripts
48+
sparse-checkout: .github/actions
49+
path: workflow-actions
50+
- name: Get mathlib-ci
51+
uses: ./workflow-actions/.github/actions/get-mathlib-ci
5352
- name: Check for special commits
5453
id: check
5554
run: |

0 commit comments

Comments
 (0)