Skip to content

Commit df62cf4

Browse files
authored
i#7281: Move failure notification config to reusable workflow (#7282)
Refactors the Github Action configs to move logic to send notification email on master merge failure into a reusable workflow which is now used by all workflows instead of duplicating the logic 24 times. Also, each workflow file now has a separate job for the new reusable workflow that is invoked after all other jobs (that actually run the test suite) are done. Status of all the test suite jobs are sent as part of the single failure notification email, if there's at least one failure; we skip filtering of status message by test suite status mostly for simplicity of logic that must be duplicated in each workflow file. Note that the reusable workflow cannot be invoked as part of some step of a job; it has to be a separate job on its own. The failure notification job requires a separate worker. Note that since it is invoked only when all other jobs in the same workflow are done, this doesn't make our concurrent job quota usage for a single master merge event any worse. However, as we're still adding a new job, it indeed uses some quota that may have been used by other concurrent triggers (PRs or master merges); but note that since it is gated by the failure condition and is very short anyway, this is not a concern. Test run: Email notification: https://groups.google.com/g/dynamorio-devs/c/EWkaTPBrjww Notification job in failing workflow: https://github.com/DynamoRIO/dynamorio/actions/runs/13351946734/job/37289912108?pr=7282 (other notification jobs in non-failing workflows were skipped) Issue: #7281
1 parent 18a77d5 commit df62cf4

File tree

10 files changed

+241
-560
lines changed

10 files changed

+241
-560
lines changed

.github/workflows/ci-aarchxx-cross.yml

Lines changed: 19 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
# DAMAGE.
3030

3131
# Github Actions workflow for AArchXX Continuous Integration testing.
32+
#
33+
# Each test suite is a separate job. When adding a new test suite job,
34+
# remember to add it to the send-failure-notification job to ensure failure
35+
# notifications are set up properly.
3236

3337
name: ci-aarchxx-cross
3438
on:
@@ -98,30 +102,6 @@ jobs:
98102
CI_TRIGGER: ${{ github.event_name }}
99103
CI_BRANCH: ${{ github.ref }}
100104

101-
- name: Send failure mail to dynamorio-devs
102-
if: failure() && github.ref == 'refs/heads/master'
103-
uses: dawidd6/action-send-mail@v2
104-
with:
105-
server_address: smtp.gmail.com
106-
server_port: 465
107-
username: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_USERNAME}}
108-
password: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_PASSWORD}}
109-
subject: |
110-
[${{github.repository}}] ${{github.workflow}} FAILED
111-
on ${{github.event_name}} at ${{github.ref}}
112-
body: |
113-
Github Actions CI workflow run FAILED!
114-
Workflow: ${{github.workflow}}/aarchxx-cross-compile
115-
Repository: ${{github.repository}}
116-
Branch ref: ${{github.ref}}
117-
SHA: ${{github.sha}}
118-
Triggering actor: ${{github.actor}}
119-
Triggering event: ${{github.event_name}}
120-
Run Id: ${{github.run_id}}
121-
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
122-
123-
from: Github Action CI
124-
125105
# ARM cross-compile with gcc, with some tests run under QEMU.
126106
# We use a more recent Ubuntu for a more recent QEMU.
127107
arm-cross-compile:
@@ -171,30 +151,6 @@ jobs:
171151
CI_TRIGGER: ${{ github.event_name }}
172152
CI_BRANCH: ${{ github.ref }}
173153

174-
- name: Send failure mail to dynamorio-devs
175-
if: failure() && github.ref == 'refs/heads/master'
176-
uses: dawidd6/action-send-mail@v2
177-
with:
178-
server_address: smtp.gmail.com
179-
server_port: 465
180-
username: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_USERNAME}}
181-
password: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_PASSWORD}}
182-
subject: |
183-
[${{github.repository}}] ${{github.workflow}} FAILED
184-
on ${{github.event_name}} at ${{github.ref}}
185-
body: |
186-
Github Actions CI workflow run FAILED!
187-
Workflow: ${{github.workflow}}/aarchxx-cross-compile
188-
Repository: ${{github.repository}}
189-
Branch ref: ${{github.ref}}
190-
SHA: ${{github.sha}}
191-
Triggering actor: ${{github.actor}}
192-
Triggering event: ${{github.event_name}}
193-
Run Id: ${{github.run_id}}
194-
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
195-
196-
from: Github Action CI
197-
198154
# Android ARM cross-compile with gcc, no tests:
199155
android-arm-cross-compile:
200156
runs-on: ubuntu-20.04
@@ -243,30 +199,6 @@ jobs:
243199
CI_BRANCH: ${{ github.ref }}
244200
run: ./suite/runsuite_wrapper.pl automated_ci 32_only
245201

246-
- name: Send failure mail to dynamorio-devs
247-
if: failure() && github.ref == 'refs/heads/master'
248-
uses: dawidd6/action-send-mail@v2
249-
with:
250-
server_address: smtp.gmail.com
251-
server_port: 465
252-
username: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_USERNAME}}
253-
password: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_PASSWORD}}
254-
subject: |
255-
[${{github.repository}}] ${{github.workflow}} FAILED
256-
on ${{github.event_name}} at ${{github.ref}}
257-
body: |
258-
Github Actions CI workflow run FAILED!
259-
Workflow: ${{github.workflow}}/android-arm-cross-compile
260-
Repository: ${{github.repository}}
261-
Branch ref: ${{github.ref}}
262-
SHA: ${{github.sha}}
263-
Triggering actor: ${{github.actor}}
264-
Triggering event: ${{github.event_name}}
265-
Run Id: ${{github.run_id}}
266-
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
267-
268-
from: Github Action CI
269-
270202
# Android AArch64 cross-compile with LLVM, no tests:
271203
android-aarch64-cross-compile:
272204
runs-on: ubuntu-22.04
@@ -309,30 +241,6 @@ jobs:
309241
CI_BRANCH: ${{ github.ref }}
310242
run: ./suite/runsuite_wrapper.pl automated_ci 64_only
311243

312-
- name: Send failure mail to dynamorio-devs
313-
if: failure() && github.ref == 'refs/heads/master'
314-
uses: dawidd6/action-send-mail@v2
315-
with:
316-
server_address: smtp.gmail.com
317-
server_port: 465
318-
username: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_USERNAME}}
319-
password: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_PASSWORD}}
320-
subject: |
321-
[${{github.repository}}] ${{github.workflow}} FAILED
322-
on ${{github.event_name}} at ${{github.ref}}
323-
body: |
324-
Github Actions CI workflow run FAILED!
325-
Workflow: ${{github.workflow}}/android-aarch64-cross-compile
326-
Repository: ${{github.repository}}
327-
Branch ref: ${{github.ref}}
328-
SHA: ${{github.sha}}
329-
Triggering actor: ${{github.actor}}
330-
Triggering event: ${{github.event_name}}
331-
Run Id: ${{github.run_id}}
332-
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
333-
334-
from: Github Action CI
335-
336244
# AArch64 drdecode and drmemtrace on x86:
337245
a64-on-x86:
338246
runs-on: ubuntu-20.04
@@ -369,26 +277,19 @@ jobs:
369277
CI_TRIGGER: ${{ github.event_name }}
370278
CI_BRANCH: ${{ github.ref }}
371279

372-
- name: Send failure mail to dynamorio-devs
373-
if: failure() && github.ref == 'refs/heads/master'
374-
uses: dawidd6/action-send-mail@v2
280+
send-failure-notification:
281+
uses: ./.github/workflows/failure-notification.yml
282+
needs: [aarch64-cross-compile, arm-cross-compile, android-arm-cross-compile, android-aarch64-cross-compile, a64-on-x86]
283+
# By default, a failure in a job skips the jobs that need it. The
284+
# following expression ensures that failure-notification.yml is
285+
# always invoked.
286+
if: ${{ always() }}
375287
with:
376-
server_address: smtp.gmail.com
377-
server_port: 465
378-
username: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_USERNAME}}
379-
password: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_PASSWORD}}
380-
subject: |
381-
[${{github.repository}}] ${{github.workflow}} FAILED
382-
on ${{github.event_name}} at ${{github.ref}}
383-
body: |
384-
Github Actions CI workflow run FAILED!
385-
Workflow: ${{github.workflow}}/a64-on-x86
386-
Repository: ${{github.repository}}
387-
Branch ref: ${{github.ref}}
388-
SHA: ${{github.sha}}
389-
Triggering actor: ${{github.actor}}
390-
Triggering event: ${{github.event_name}}
391-
Run Id: ${{github.run_id}}
392-
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
393-
394-
from: Github Action CI
288+
test_suite_status: ${{ format('{0} {1} | {2} {3} | {4} {5} | {6} {7} | {8} {9}',
289+
'aarch64-cross-compile', needs.aarch64-cross-compile.result,
290+
'arm-cross-compile', needs.arm-cross-compile.result,
291+
'android-arm-cross-compile', needs.android-arm-cross-compile.result,
292+
'android-aarch64-cross-compile', needs.android-aarch64-cross-compile.result,
293+
'a64-on-x86', needs.a64-on-x86.result) }}
294+
test_suite_results_only: ${{ join(needs.*.result, ',') }}
295+
secrets: inherit

.github/workflows/ci-aarchxx.yml

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
# DAMAGE.
3131

3232
# Github Actions workflow for aarch64 Continuous Integration testing.
33+
#
34+
# Each test suite is a separate job. When adding a new test suite job,
35+
# remember to add it to the send-failure-notification job to ensure failure
36+
# notifications are set up properly.
3337

3438
name: ci-aarchxx
3539
on:
@@ -128,26 +132,15 @@ jobs:
128132
CI_BRANCH: ${{ github.ref }}
129133
if: ${{ matrix.sve == true && matrix.sve_length != ''}}
130134

131-
- name: Send failure mail to dynamorio-devs
132-
if: failure() && github.ref == 'refs/heads/master'
133-
uses: dawidd6/action-send-mail@v2
134-
with:
135-
server_address: smtp.gmail.com
136-
server_port: 465
137-
username: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_USERNAME}}
138-
password: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_PASSWORD}}
139-
subject: |
140-
[${{github.repository}}] ${{github.workflow}} FAILED
141-
on ${{github.event_name}} at ${{github.ref}}
142-
body: |
143-
Github Actions CI workflow run FAILED!
144-
Workflow: ${{github.workflow}}/x86-32
145-
Repository: ${{github.repository}}
146-
Branch ref: ${{github.ref}}
147-
SHA: ${{github.sha}}
148-
Triggering actor: ${{github.actor}}
149-
Triggering event: ${{github.event_name}}
150-
Run Id: ${{github.run_id}}
151-
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
152-
153-
from: Github Action CI
135+
send-failure-notification:
136+
uses: ./.github/workflows/failure-notification.yml
137+
needs: [aarch64-precommit]
138+
# By default, a failure in a job skips the jobs that need it. The
139+
# following expression ensures that failure-notification.yml is
140+
# always invoked.
141+
if: ${{ always() }}
142+
with:
143+
test_suite_status: ${{ format('{0} {1}',
144+
'aarch64-precommit', needs.aarch64-precommit.result) }}
145+
test_suite_results_only: ${{ join(needs.*.result, ',') }}
146+
secrets: inherit

.github/workflows/ci-clang-format.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
# DAMAGE.
3030

3131
# Github Actions workflow for clang-format Continuous Integration testing.
32+
#
33+
# When adding a new job, remember to add it to the send-failure-notification
34+
# job to ensure failure notifications are set up properly.
3235

3336
name: ci-clang-format
3437
on:
@@ -87,26 +90,16 @@ jobs:
8790
CI_TRIGGER: ${{ github.event_name }}
8891
CI_BRANCH: ${{ github.ref }}
8992

90-
- name: Send failure mail to dynamorio-devs
91-
if: failure() && github.ref == 'refs/heads/master'
92-
uses: dawidd6/action-send-mail@v2
93+
94+
send-failure-notification:
95+
uses: ./.github/workflows/failure-notification.yml
96+
needs: [clang-format]
97+
# By default, a failure in a job skips the jobs that need it. The
98+
# following expression ensures that failure-notification.yml is
99+
# always invoked.
100+
if: ${{ always() }}
93101
with:
94-
server_address: smtp.gmail.com
95-
server_port: 465
96-
username: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_USERNAME}}
97-
password: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_PASSWORD}}
98-
subject: |
99-
[${{github.repository}}] ${{github.workflow}} FAILED
100-
on ${{github.event_name}} at ${{github.ref}}
101-
body: |
102-
Github Actions CI workflow run FAILED!
103-
Workflow: ${{github.workflow}}/clang-format
104-
Repository: ${{github.repository}}
105-
Branch ref: ${{github.ref}}
106-
SHA: ${{github.sha}}
107-
Triggering actor: ${{github.actor}}
108-
Triggering event: ${{github.event_name}}
109-
Run Id: ${{github.run_id}}
110-
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
111-
112-
from: Github Action CI
102+
test_suite_status: ${{ format('{0} {1}',
103+
'clang-format', needs.clang-format.result) }}
104+
test_suite_results_only: ${{ join(needs.*.result, ',') }}
105+
secrets: inherit

.github/workflows/ci-docs.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
# DAMAGE.
3030

3131
# Github Actions workflow for building doxygen docs for the web site.
32+
#
33+
# When adding a new job, remember to add it to the send-failure-notification
34+
# job to ensure failure notifications are set up properly.
3235

3336
name: ci-docs
3437
on:
@@ -130,26 +133,15 @@ jobs:
130133
# We need a personal access token for write access to another repo.
131134
GITHUB_TOKEN: ${{ secrets.DOCS_TOKEN }}
132135

133-
- name: Send failure mail to dynamorio-devs
134-
if: failure() && github.ref == 'refs/heads/master'
135-
uses: dawidd6/action-send-mail@v2
136+
send-failure-notification:
137+
uses: ./.github/workflows/failure-notification.yml
138+
needs: [docs]
139+
# By default, a failure in a job skips the jobs that need it. The
140+
# following expression ensures that failure-notification.yml is
141+
# always invoked.
142+
if: ${{ always() }}
136143
with:
137-
server_address: smtp.gmail.com
138-
server_port: 465
139-
username: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_USERNAME}}
140-
password: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_PASSWORD}}
141-
subject: |
142-
[${{github.repository}}] ${{github.workflow}} FAILED
143-
on ${{github.event_name}} at ${{github.ref}}
144-
body: |
145-
Github Actions CI workflow run FAILED!
146-
Workflow: ${{github.workflow}}/docs
147-
Repository: ${{github.repository}}
148-
Branch ref: ${{github.ref}}
149-
SHA: ${{github.sha}}
150-
Triggering actor: ${{github.actor}}
151-
Triggering event: ${{github.event_name}}
152-
Run Id: ${{github.run_id}}
153-
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
154-
155-
from: Github Action package jobs
144+
test_suite_status: ${{ format('{0} {1}',
145+
'docs', needs.docs.result) }}
146+
test_suite_results_only: ${{ join(needs.*.result, ',') }}
147+
secrets: inherit

.github/workflows/ci-osx.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
# DAMAGE.
3030

3131
# Github Actions workflow for Mac OSX Continuous Integration testing.
32+
#
33+
# Each test suite is a separate job. When adding a new test suite job,
34+
# remember to add it to the send-failure-notification job to ensure failure
35+
# notifications are set up properly.
3236

3337
name: ci-osx
3438
on:
@@ -86,26 +90,15 @@ jobs:
8690
CI_TRIGGER: ${{ github.event_name }}
8791
CI_BRANCH: ${{ github.ref }}
8892

89-
- name: Send failure mail to dynamorio-devs
90-
if: failure() && github.ref == 'refs/heads/master'
91-
uses: dawidd6/action-send-mail@v2
93+
send-failure-notification:
94+
uses: ./.github/workflows/failure-notification.yml
95+
needs: [osx-x86-64]
96+
# By default, a failure in a job skips the jobs that need it. The
97+
# following expression ensures that failure-notification.yml is
98+
# always invoked.
99+
if: ${{ always() }}
92100
with:
93-
server_address: smtp.gmail.com
94-
server_port: 465
95-
username: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_USERNAME}}
96-
password: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_PASSWORD}}
97-
subject: |
98-
[${{github.repository}}] ${{github.workflow}} FAILED
99-
on ${{github.event_name}} at ${{github.ref}}
100-
body: |
101-
Github Actions CI workflow run FAILED!
102-
Workflow: ${{github.workflow}}/osx-x86-64
103-
Repository: ${{github.repository}}
104-
Branch ref: ${{github.ref}}
105-
SHA: ${{github.sha}}
106-
Triggering actor: ${{github.actor}}
107-
Triggering event: ${{github.event_name}}
108-
Run Id: ${{github.run_id}}
109-
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
110-
111-
from: Github Action CI
101+
test_suite_status: ${{ format('{0} {1}',
102+
'osx-x86-64', needs.osx-x86-64.result) }}
103+
test_suite_results_only: ${{ join(needs.*.result, ',') }}
104+
secrets: inherit

0 commit comments

Comments
 (0)