3333 - name : Checkout branch or tag
3434 uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
3535
36- # this step needs to be run here while we have `mathlib4` checked out,
37- # or else `gh run view` will try to look for runs in `mathlib4-nightly-testing`
38- - name : Get URLs
39- id : urls
40- env :
41- GH_TOKEN : ${{ github.token }}
42- run : |
43- # adapted from https://cmbuckley.co.uk/blog/2024/04/09/deep-links-to-github-actions-job-logs/
44- lean4checker_url=$(gh run view ${{ github.run_id }} --json jobs --jq '
45- .jobs[] | select(.name == "check-lean4checker (${{ matrix.branch_type }})")
46- | (.url + (.steps[] | select(.name == "Check environments using lean4checker")
47- | "#step:\(.number):1"))')
48- echo "lean4checker_url=$lean4checker_url" | tee -a "$GITHUB_OUTPUT"
49-
5036 - name : Fetch latest tags (if nightly)
5137 if : matrix.branch_type == 'nightly'
5238 run : |
7965 use-mathlib-cache : true
8066 reinstall-transient-toolchain : true
8167
82- - name : Check environments using lean4checker # make sure this name is consistent with "Get URLs"
68+ - name : Check environments using lean4checker # make sure this name is consistent with "Get job status and URLs" in the notify job
8369 id : lean4checker
8470 continue-on-error : true
8571 run : |
@@ -110,8 +96,51 @@ jobs:
11096 # so we explicitly check Batteries as well here.
11197 lake env lean4checker/.lake/build/bin/lean4checker Batteries Mathlib
11298
99+ notify-lean4checker :
100+ runs-on : ubuntu-latest
101+ needs : check-lean4checker
102+ if : github.repository == 'leanprover-community/mathlib4' && always()
103+ strategy :
104+ fail-fast : false
105+ matrix :
106+ branch_type : [master, nightly]
107+ steps :
108+ - name : Checkout repository
109+ uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
110+
111+ - name : Get job status and URLs
112+ id : get-status
113+ env :
114+ GH_TOKEN : ${{ github.token }}
115+ run : |
116+ JOB_NAME="check-lean4checker (${{ matrix.branch_type }})"
117+
118+ # Get URL to the specific step
119+ LEAN4CHECKER_URL=$(gh run view ${{ github.run_id }} --json jobs --jq \
120+ ".jobs[] | select(.name == \"$JOB_NAME\") \
121+ | (.url + (.steps[] | select(.name == \"Check environments using lean4checker\") \
122+ | \"#step:\(.number):1\"))")
123+
124+ echo "lean4checker_url=${LEAN4CHECKER_URL}" | tee -a "$GITHUB_OUTPUT"
125+
126+ - name : Fetch latest tags (if nightly)
127+ if : matrix.branch_type == 'nightly'
128+ run : |
129+ git remote add nightly-testing https://github.com/leanprover-community/mathlib4-nightly-testing.git
130+ git fetch nightly-testing --tags
131+ LATEST_TAG=$(git tag | grep -E "${{ env.TAG_PATTERN }}" | sort -r | head -n 1)
132+ echo "LATEST_TAG=${LATEST_TAG}" | tee -a "$GITHUB_ENV"
133+
134+ - name : Set branch ref
135+ run : |
136+ if [ "${{ matrix.branch_type }}" == "master" ]; then
137+ echo "BRANCH_REF=${{ env.DEFAULT_BRANCH }}" >> "$GITHUB_ENV"
138+ else
139+ echo "BRANCH_REF=${{ env.LATEST_TAG }}" >> "$GITHUB_ENV"
140+ fi
141+
113142 - name : Post success message for lean4checker on Zulip
114- if : steps. lean4checker.outcome == 'success'
143+ if : needs.check- lean4checker.result == 'success'
115144 uses : zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
116145 with :
117146 api-key : ${{ secrets.ZULIP_API_KEY }}
@@ -121,10 +150,10 @@ jobs:
121150 type : ' stream'
122151 topic : ' lean4checker'
123152 content : |
124- ✅ lean4checker [succeeded](${{ steps.urls .outputs.lean4checker_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
153+ ✅ lean4checker [succeeded](${{ steps.get-status .outputs.lean4checker_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
125154
126155 - name : Post failure / cancelled message for lean4checker on Zulip
127- if : steps. lean4checker.outcome == 'failure' || steps.lean4checker.outcome == 'cancelled '
156+ if : needs.check- lean4checker.result != 'success '
128157 uses : zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
129158 with :
130159 api-key : ${{ secrets.ZULIP_API_KEY }}
@@ -134,7 +163,7 @@ jobs:
134163 type : ' stream'
135164 topic : ' lean4checker failure'
136165 content : |
137- ❌ lean4checker [$$ {{ steps. lean4checker.outcome }}](${{ steps.urls .outputs.lean4checker_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
166+ ❌ lean4checker [${{ needs.check- lean4checker.result }}](${{ steps.get-status .outputs.lean4checker_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
138167
139168 check-mathlib_test_executable :
140169 runs-on : ubuntu-latest
@@ -148,20 +177,6 @@ jobs:
148177 - name : Checkout branch or tag
149178 uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
150179
151- # this step needs to be run here while we have `mathlib4` checked out,
152- # or else `gh run view` will try to look for runs in `mathlib4-nightly-testing`
153- - name : Get URLs
154- id : urls
155- env :
156- GH_TOKEN : ${{ github.token }}
157- run : |
158- # adapted from https://cmbuckley.co.uk/blog/2024/04/09/deep-links-to-github-actions-job-logs/
159- mathlib_test_executable_url=$(gh run view ${{ github.run_id }} --json jobs --jq '
160- .jobs[] | select(.name == "check-lean4checker (${{ matrix.branch_type }})")
161- | (.url + (.steps[] | select(.name == "Run mathlib_test_executable")
162- | "#step:\(.number):1"))')
163- echo "mathlib_test_executable_url=$mathlib_test_executable_url" | tee -a "$GITHUB_OUTPUT"
164-
165180 - name : Fetch latest tags (if nightly)
166181 if : matrix.branch_type == 'nightly'
167182 run : |
@@ -194,14 +209,57 @@ jobs:
194209 use-mathlib-cache : true
195210 reinstall-transient-toolchain : true
196211
197- - name : Run mathlib_test_executable # make sure this name is consistent with "Get URLs"
212+ - name : Run mathlib_test_executable # make sure this name is consistent with "Get job status and URLs" in the notify job
198213 id : mathlib-test
199214 continue-on-error : true
200215 run : |
201216 lake exe mathlib_test_executable
202217
218+ notify-mathlib_test_executable :
219+ runs-on : ubuntu-latest
220+ needs : check-mathlib_test_executable
221+ if : github.repository == 'leanprover-community/mathlib4' && always()
222+ strategy :
223+ fail-fast : false
224+ matrix :
225+ branch_type : [master, nightly]
226+ steps :
227+ - name : Checkout repository
228+ uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
229+
230+ - name : Get job status and URLs
231+ id : get-status
232+ env :
233+ GH_TOKEN : ${{ github.token }}
234+ run : |
235+ JOB_NAME="check-mathlib_test_executable (${{ matrix.branch_type }})"
236+
237+ # Get URL to the specific step
238+ MATHLIB_TEST_EXECUTABLE_URL=$(gh run view ${{ github.run_id }} --json jobs --jq \
239+ ".jobs[] | select(.name == \"$JOB_NAME\") \
240+ | (.url + (.steps[] | select(.name == \"Run mathlib_test_executable\") \
241+ | \"#step:\(.number):1\"))")
242+
243+ echo "mathlib_test_executable_url=${MATHLIB_TEST_EXECUTABLE_URL}" | tee -a "$GITHUB_OUTPUT"
244+
245+ - name : Fetch latest tags (if nightly)
246+ if : matrix.branch_type == 'nightly'
247+ run : |
248+ git remote add nightly-testing https://github.com/leanprover-community/mathlib4-nightly-testing.git
249+ git fetch nightly-testing --tags
250+ LATEST_TAG=$(git tag | grep -E "${{ env.TAG_PATTERN }}" | sort -r | head -n 1)
251+ echo "LATEST_TAG=${LATEST_TAG}" | tee -a "$GITHUB_ENV"
252+
253+ - name : Set branch ref
254+ run : |
255+ if [ "${{ matrix.branch_type }}" == "master" ]; then
256+ echo "BRANCH_REF=${{ env.DEFAULT_BRANCH }}" >> "$GITHUB_ENV"
257+ else
258+ echo "BRANCH_REF=${{ env.LATEST_TAG }}" >> "$GITHUB_ENV"
259+ fi
260+
203261 - name : Post success message for mathlib_test_executable on Zulip
204- if : steps.mathlib-test.outcome == 'success'
262+ if : needs.check-mathlib_test_executable.result == 'success'
205263 uses : zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
206264 with :
207265 api-key : ${{ secrets.ZULIP_API_KEY }}
@@ -211,10 +269,10 @@ jobs:
211269 type : ' stream'
212270 topic : ' mathlib test executable'
213271 content : |
214- ✅ mathlib_test_executable [succeeded](${{ steps.urls .outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
272+ ✅ mathlib_test_executable [succeeded](${{ steps.get-status .outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
215273
216274 - name : Post failure / cancelled message for mathlib_test_executable on Zulip
217- if : steps.mathlib-test.outcome == 'failure' || steps.mathlib-test.outcome == 'cancelled '
275+ if : needs.check-mathlib_test_executable.result != 'success '
218276 uses : zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
219277 with :
220278 api-key : ${{ secrets.ZULIP_API_KEY }}
@@ -224,4 +282,4 @@ jobs:
224282 type : ' stream'
225283 topic : ' mathlib test executable failure'
226284 content : |
227- ❌ mathlib_test_executable [${{ steps.mathlib-test.outcome }}](${{ steps.urls .outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
285+ ❌ mathlib_test_executable [${{ needs.check-mathlib_test_executable.result }}](${{ steps.get-status .outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
0 commit comments