Skip to content

Nightly Contract Tests #134

Nightly Contract Tests

Nightly Contract Tests #134

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: 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: 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'
- 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'
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 }}"
}
}
]
}