1616 DEFAULT_BRANCH : master
1717 TAG_PATTERN : ' ^nightly-testing-[0-9]{4}-[0-9]{2}-[0-9]{2}$'
1818
19+ permissions :
20+ contents : read
21+ actions : read
22+
1923jobs :
2024 check-lean4checker :
2125 runs-on : ubuntu-latest
22- if : github.repository == 'leanprover-community/mathlib4' || github.repository == 'leanprover-community/mathlib4-nightly-testing'
26+ if : github.repository == 'leanprover-community/mathlib4'
2327 strategy :
2428 matrix :
2529 branch_type : [master, nightly]
2630 steps :
27- - name : Cleanup
28- run : |
29- # Delete all but the 5 most recent toolchains.
30- # Make sure to delete both the `~/.elan/toolchains/X` directory and the `~/.elan/update-hashes/X` file.
31- # Skip symbolic links (`-type d`), the current directory (`! -name .`), and `nightly` and `stable`.
32- if cd ~/.elan/toolchains && find . -maxdepth 1 -type d ! -name . -print0 | xargs -0 ls -1td | grep -v 'nightly$' | grep -v 'stable$' | tail -n +6 | xargs -I {} sh -c 'echo {} && rm -rf "{}" && rm "../update-hashes/{}"'; then
33- : # Do nothing on success
34- else
35- : # Do nothing on failure, but suppress errors
36- fi
37-
3831 # Checkout repository, so that we can fetch tags to decide which branch we want.
3932 - name : Checkout branch or tag
4033 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4134
35+ # this step needs to be run here while we have `mathlib4` checked out,
36+ # or else `gh run view` will try to look for runs in `mathlib4-nightly-testing`
37+ - name : Get URLs
38+ id : urls
39+ env :
40+ GH_TOKEN : ${{ github.token }}
41+ run : |
42+ # adapted from https://cmbuckley.co.uk/blog/2024/04/09/deep-links-to-github-actions-job-logs/
43+ lean4checker_url=$(gh run view ${{ github.run_id }} --json jobs --jq '
44+ .jobs[] | select(.name == "check-lean4checker (${{ matrix.branch_type }})")
45+ | (.url + (.steps[] | select(.name == "Check environments using lean4checker")
46+ | "#step:\(.number):1"))')
47+ echo "lean4checker_url=$lean4checker_url" | tee -a "$GITHUB_OUTPUT"
48+
49+ mathlib_test_executable_url=$(gh run view ${{ github.run_id }} --json jobs --jq '
50+ .jobs[] | select(.name == "check-lean4checker (${{ matrix.branch_type }})")
51+ | (.url + (.steps[] | select(.name == "Run mathlib_test_executable")
52+ | "#step:\(.number):1"))')
53+ echo "mathlib_test_executable_url=$mathlib_test_executable_url" | tee -a "$GITHUB_OUTPUT"
54+
4255 - name : Fetch latest tags (if nightly)
4356 if : matrix.branch_type == 'nightly'
4457 run : |
@@ -68,14 +81,10 @@ jobs:
6881 with :
6982 auto-config : false
7083 use-github-cache : false
71- use-mathlib-cache : false
84+ use-mathlib-cache : true
7285 reinstall-transient-toolchain : true
7386
74- - name : Run lake exe cache get
75- run : |
76- lake exe cache get
77-
78- - name : Check environments using lean4checker
87+ - name : Check environments using lean4checker # make sure this name is consistent with "Get URLs"
7988 id : lean4checker
8089 continue-on-error : true
8190 run : |
@@ -106,7 +115,7 @@ jobs:
106115 # so we explicitly check Batteries as well here.
107116 lake env lean4checker/.lake/build/bin/lean4checker Batteries Mathlib
108117
109- - name : Run mathlib_test_executable
118+ - name : Run mathlib_test_executable # make sure this name is consistent with "Get URLs"
110119 id : mathlib-test
111120 continue-on-error : true
112121 run : |
@@ -123,7 +132,7 @@ jobs:
123132 type : ' stream'
124133 topic : ' lean4checker'
125134 content : |
126- ✅ lean4checker [succeeded](https://github.com/ ${{ github.repository }}/actions/runs/${{ github.run_id }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
135+ ✅ lean4checker [succeeded](${{ steps.urls.outputs.lean4checker_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
127136
128137 - name : Post success message for mathlib_test_executable on Zulip
129138 if : steps.mathlib-test.outcome == 'success'
@@ -136,7 +145,7 @@ jobs:
136145 type : ' stream'
137146 topic : ' mathlib test executable'
138147 content : |
139- ✅ mathlib_test_executable [succeeded](https://github.com/ ${{ github.repository }}/actions/runs/${{ github.run_id }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
148+ ✅ mathlib_test_executable [succeeded](${{ steps.urls.outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
140149
141150 - name : Post failure message for lean4checker on Zulip
142151 if : steps.lean4checker.outcome == 'failure'
@@ -149,7 +158,7 @@ jobs:
149158 type : ' stream'
150159 topic : ' lean4checker failure'
151160 content : |
152- ❌ lean4checker [failed](https://github.com/ ${{ github.repository }}/actions/runs/${{ github.run_id }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
161+ ❌ lean4checker [failed](${{ steps.urls.outputs.lean4checker_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
153162 continue-on-error : true
154163
155164 - name : Post failure message for mathlib_test_executable on Zulip
@@ -163,5 +172,5 @@ jobs:
163172 type : ' stream'
164173 topic : ' mathlib test executable failure'
165174 content : |
166- ❌ mathlib_test_executable [failed](https://github.com/ ${{ github.repository }}/actions/runs/${{ github.run_id }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
175+ ❌ mathlib_test_executable [failed](${{ steps.urls.outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
167176 continue-on-error : true
0 commit comments