Skip to content

daily-smoke-test

daily-smoke-test #434

name: daily-smoke-test
on:
workflow_dispatch: # As per documentation, the colon is needed even though no config is required.
schedule:
# Cron syntax is "minute[0-59] hour[0-23] date[1-31] month[1-12] day[0-6]". '*' is 'any value', and multiple values
# can be specified with comma-separated lists. All times are UTC.
# So this expression means "run at 13:30 UTC every day". This time was chosen because it corresponds to
# 8:30AM CDT, meaning that any issues will be surfaced towards the start of business.
- cron: "30 13 * * *"
jobs:
# Step 1: Build the scanner tarball so it can be installed locally.
build-scanner-tarball:
name: 'Build scanner tarball'
uses: ./.github/workflows/build-scanner-tarball.yml
with:
target-branch: 'dev'
# Step 2: Actually run the tests.
smoke-test:
name: 'Run smoke tests'
needs: build-scanner-tarball
uses: ./.github/workflows/run-tests.yml
with:
# For daily builds, we want to make sure we haven't pushed a breaking change
# to the scanner's `dev` branch.
use-scanner-tarball: true
# Step 3: Build a VSIX artifact for use if needed.
create-vsix-artifact:
name: 'Upload VSIX as artifact'
uses: ./.github/workflows/create-vsix-artifact.yml
# Step 4: Report any problems
report-problems:
name: 'Report problems'
runs-on: ubuntu-latest
needs: [build-scanner-tarball, smoke-test, create-vsix-artifact]
if: ${{ failure() || cancelled() }}
steps:
- name: Report problems
shell: bash
env:
IS_CRITICAL: ${{ contains(join(steps.*.outcome), 'failure') || contains(join(steps.*.outcome), 'skipped') }}
RUN_LINK: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
if [[ ${{ env.IS_CRITICAL }} == true ]]; then
ALERT_SEV="critical"
ALERT_SUMMARY="Daily smoke test failed on ${{ runner.os }}"
else
ALERT_SEV="info"
ALERT_SUMMARY="Daily smoke test succeeded with retries on ${{ runner.os }}"
fi
generate_post_data() {
cat <<EOF
{
"payload": {
"summary": "${ALERT_SUMMARY}",
"source": "Github Actions",
"severity": "${ALERT_SEV}"
},
"links": [{
"href": "${{ env.RUN_LINK }}",
"text": "Link to action execution"
}],
"event_action": "trigger",
"dedup_key": "GH-HB-${{ matrix.os.vm }}-${{ matrix.node }}",
"routing_key": "${{ secrets.PAGERDUTY_HEARTBEAT_KEY }}"
}
EOF
}
curl --request POST --data "$(generate_post_data)" https://events.pagerduty.com/v2/enqueue