Nightly Contract Tests #10
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: Nightly Contract Tests | |
| on: | |
| schedule: | |
| - cron: "0 4 * * *" # every day at 4am UTC | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Branch to run contract tests on' | |
| required: false | |
| default: '' | |
| test_slack_notification: | |
| description: 'Also send a test Slack notification (to verify Slack integration)' | |
| required: false | |
| type: boolean | |
| default: false | |
| jobs: | |
| nightly-contract-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ inputs.branch || github.ref }} | |
| - name: Shared CI Steps | |
| uses: ./.github/actions/ci | |
| with: | |
| workspace_path: 'lib/sdk/server' | |
| java_version: 8 | |
| - name: Contract Tests (with long-running tests) | |
| uses: ./.github/actions/contract-tests | |
| with: | |
| workspace_path: 'lib/sdk/server' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| test_harness_params_v3: '-enable-long-running-tests' | |
| notify-slack-on-failure: | |
| runs-on: ubuntu-latest | |
| if: ${{ always() && needs.nightly-contract-tests.result == 'failure' }} | |
| needs: | |
| - nightly-contract-tests | |
| steps: | |
| - name: Send Slack notification | |
| uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1 | |
| with: | |
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: | | |
| { | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": ":warning: *Nightly Contract Tests Failed* :warning:\nThe nightly contract tests (with long-running tests enabled) failed on `${{ github.ref_name }}`." | |
| }, | |
| "accessory": { | |
| "type": "button", | |
| "text": { | |
| "type": "plain_text", | |
| "text": "View failed run" | |
| }, | |
| "url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| } | |
| } | |
| ] | |
| } | |
| test-slack-notification: | |
| runs-on: ubuntu-latest | |
| if: ${{ inputs.test_slack_notification == true || inputs.test_slack_notification == 'true' }} | |
| steps: | |
| - name: Send test Slack notification | |
| uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1 | |
| with: | |
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: | | |
| { | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": ":white_check_mark: *Nightly Contract Tests – Slack test*\nThis is a test notification to verify Slack integration is working. Triggered manually from the Nightly Contract Tests workflow." | |
| }, | |
| "accessory": { | |
| "type": "button", | |
| "text": { | |
| "type": "plain_text", | |
| "text": "View workflow run" | |
| }, | |
| "url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| } | |
| } | |
| ] | |
| } |