Nightly Contract Tests #223
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 | |
| # The long-running tests wait on real RETRY backoff timing, so this job runs | |
| # roughly an hour. A regression that stops retrying makes every scenario burn | |
| # its full timeout instead of returning early, so leave headroom -- while | |
| # staying well under the 6-hour default that would otherwise apply. | |
| timeout-minutes: 120 | |
| 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: Build Contract Test Service | |
| shell: bash | |
| run: make build-contract-tests -C lib/sdk/server | |
| - name: Start Contract Test Service | |
| shell: bash | |
| run: make start-contract-test-service-bg -C lib/sdk/server | |
| - name: Create JUnit output directory | |
| shell: bash | |
| run: mkdir -p junit | |
| - name: Contract Tests (v2) | |
| uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1 | |
| with: | |
| test_service_port: '8000' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| debug_logging: 'true' | |
| stop_service: 'false' | |
| enable_persistence_tests: 'false' | |
| extra_params: '-skip-from=lib/sdk/server/contract-tests/test-suppressions.txt -enable-long-running-tests -junit junit/contract-tests-v2.xml' | |
| - name: Contract Tests v3 (with long-running tests) | |
| uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1 | |
| with: | |
| test_service_port: '8000' | |
| version: 'v3.0.0-alpha.6' | |
| branch: 'v3.0.0-alpha.6' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| debug_logging: 'true' | |
| enable_persistence_tests: 'false' | |
| extra_params: '-skip-from=lib/sdk/server/contract-tests/test-suppressions-fdv2.txt -enable-long-running-tests -junit junit/contract-tests-v3.xml' | |
| - name: Upload contract test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: contract-test-results | |
| path: junit/ | |
| if-no-files-found: warn | |
| - name: Upload contract test service log | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: contract-test-service-log | |
| path: /tmp/sdk-test-service.log | |
| if-no-files-found: warn | |
| notify-slack-on-failure: | |
| runs-on: ubuntu-latest | |
| # Any outcome that is not a clean pass, not just 'failure' -- this also | |
| # covers a timeout or an infrastructure cancellation. | |
| if: ${{ always() && needs.nightly-contract-tests.result != 'success' }} | |
| 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 Did Not Pass* :warning:\nThe nightly contract tests (with long-running tests enabled) finished with result `${{ needs.nightly-contract-tests.result }}` 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 }}" | |
| } | |
| } | |
| ] | |
| } |