|
1 | 1 | name: CI Tests |
2 | 2 | on: |
| 3 | + # Allows you to run this workflow manually from the Actions tab |
3 | 4 | workflow_dispatch: |
4 | 5 | push: |
5 | | - branches: [main] |
6 | 6 | pull_request: |
7 | | - branches: [main] |
| 7 | + schedule: |
| 8 | + # minute hour day month day-of-week |
| 9 | + # Run at 12:25 UTC every day |
| 10 | + - cron: '25 12 * * *' |
| 11 | + |
8 | 12 | jobs: |
9 | 13 | build: |
10 | 14 | name: ${{ matrix.config.name }} |
@@ -135,3 +139,30 @@ jobs: |
135 | 139 | with: |
136 | 140 | file: ${{runner.workspace}}/optional/.build/coverage.json |
137 | 141 | github-token: ${{ secrets.GITHUB_TOKEN }} |
| 142 | + |
| 143 | + create-issue-when-fault: |
| 144 | + runs-on: ubuntu-latest |
| 145 | + needs: [preset-test, gtest-test, configuration-test, compiler-test] |
| 146 | + if: failure() && github.event_name == 'schedule' |
| 147 | + steps: |
| 148 | + # See https://github.com/cli/cli/issues/5075 |
| 149 | + - uses: actions/checkout@v4 |
| 150 | + - name: Create issue |
| 151 | + run: | |
| 152 | + issue_num=$(gh issue list -s open -S "[SCHEDULED-BUILD] Build & Test failure" -L 1 --json number | jq 'if length == 0 then -1 else .[0].number end') |
| 153 | +
|
| 154 | + body="**Build-and-Test Failure Report** |
| 155 | + - **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z') |
| 156 | + - **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}) |
| 157 | + - **Action Run**: [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) |
| 158 | +
|
| 159 | + The scheduled build-and-test triggered by cron has failed. |
| 160 | + Please investigate the logs and recent changes associated with this commit or rerun the workflow if you believe this is an error." |
| 161 | +
|
| 162 | + if [[ $issue_num -eq -1 ]]; then |
| 163 | + gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] Build & Test failure" --body "$body" |
| 164 | + else |
| 165 | + gh issue comment --repo ${{ github.repository }} $issue_num --body "$body" |
| 166 | + fi |
| 167 | + env: |
| 168 | + GH_TOKEN: ${{ github.token }} |
0 commit comments