-
Notifications
You must be signed in to change notification settings - Fork 49
52 lines (50 loc) · 2.12 KB
/
nightly-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Nightly Tests
on:
schedule:
- cron: '23 10 * * *' # random time in the middle of the night PT
workflow_dispatch:
inputs:
notify-on-failure:
default: false
type: boolean
force-failure:
default: false
type: boolean
jobs:
call-workflow:
uses: ./.github/workflows/test-plugin.yml
with:
triton-shared-ref: 'main'
triton-ref: 'main'
# The `inputs` variable is not available when the workflow is automatically triggered by a schedule.
# In such case, `inputs.force-failure` is an empty string which breaks the workflow. As a workaround,
# check the user provided input if it contains `true` instead of using the value directly.
force-failure: ${{ contains(inputs.force-failure, 'true') }}
report-failure:
permissions:
issues: write
runs-on: ubuntu-latest
needs: [call-workflow]
# Always report failure if the workflow is triggered by a schedule.
if: ${{ always() && (github.event_name == 'schedule' || inputs.notify-on-failure) && needs.call-workflow.result == 'failure' }}
steps:
- name: Report Failure
run: |
issues=$(gh --repo microsoft/triton-shared issue list --label nightly-build-failure --state open)
build_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
notificiation_list="@microsoft/aifx-compilers"
repo=microsoft/triton-shared #"${{ github.repository }}"
if [ -z "$issues" ]; then
gh --repo $repo issue create \
--title "Nightly Build Failure $(date +'%Y-%m-%d')" \
--label "nightly-build-failure" \
--body "cc $notificiation_list
The nightly build has failed. See: $build_url"
else
issue_number=$(echo "$issues" | head -n 1 | awk '{print $1}')
gh --repo $repo issue comment $issue_number \
--body "cc $notificiation_list
The nightly build has failed again. See: $build_url"
fi
env:
GH_TOKEN: ${{ github.token }}