Scheduled tests #104
This file contains hidden or 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: Scheduled tests | |
| # The integration lane's home. Advisory: see CONTRIBUTING.md. | |
| on: | |
| schedule: | |
| # One hour per SDK repo sharing the Stream app, so no two mutate app-global settings at once. | |
| - cron: "0 10 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| integration: | |
| uses: ./.github/workflows/run_integration.yml | |
| secrets: inherit | |
| # Was a Slack notification, which failed every one of the 5 times it fired: the | |
| # SLACK_NOTIFICATIONS_BOT_TOKEN secret it read does not exist in this repository. | |
| # A schedule event carries no repository in its payload, so it passes by event name; it | |
| # always runs on the default branch anyway. | |
| report: | |
| name: Report a red run | |
| needs: integration | |
| # Not failure(): a job that hits timeout-minutes concludes `cancelled`, and a hung run | |
| # must report too. Default branch only: a manual dispatch on a feature branch must not | |
| # touch the default branch's issue. | |
| if: ${{ !cancelled() && needs.integration.result != 'success' && (github.event_name == 'schedule' || github.ref_name == github.event.repository.default_branch) }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| issues: write | |
| steps: | |
| - name: Open or update the tracking issue | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TITLE: Daily integration run is red | |
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| run: | | |
| # Unguarded, a non-2xx would abort the step under `bash -e` and a red run would | |
| # report nothing at all. Fail toward creating the issue, which is the loud way. | |
| if ! num="$(gh issue list --repo "$GITHUB_REPOSITORY" --state open --search "in:title \"$TITLE\"" \ | |
| --json number,title --jq "map(select(.title == \"$TITLE\")) | .[0].number // empty")"; then | |
| echo "::warning::Could not list open issues; creating a new one." | |
| num="" | |
| fi | |
| if [ -n "$num" ]; then | |
| gh issue comment "$num" --repo "$GITHUB_REPOSITORY" --body "Still red: $RUN_URL" | |
| else | |
| gh issue create --repo "$GITHUB_REPOSITORY" --title "$TITLE" --body \ | |
| "The daily \`integrationTest\` run failed: $RUN_URL | |
| Integration is advisory, so nothing is blocked by this. It still has to be read: the suite | |
| runs against a live Stream app shared by five SDK repos, so decide whether this is the app, | |
| the backend, or this SDK, and close the issue once a daily run is green again." | |
| fi |