Nightly Tests #418
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |