Skip to content

DPC - Smoke Test

DPC - Smoke Test #200

Workflow file for this run

name: 'DPC - Smoke Test'
on:
workflow_dispatch:
inputs:
env:
description: AWS environment to check
required: true
type: 'string'
default: 'dev'
workflow_call:
inputs:
env:
description: AWS environment to check
required: true
type: 'string'
default: 'dev'
permissions:
id-token: write
contents: read
concurrency:
group: smoke-test-${{ inputs.env }}
cancel-in-progress: false
jobs:
smoke-test:
defaults:
run:
working-directory: ./dpc-load-testing
name: Smoke Test
runs-on: codebuild-dpc-app-${{github.run_id}}-${{github.run_attempt}}
steps:
- uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
name: Slack Starting
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
# Sends to dpc-deploys
payload: |
channel: "CMC1E4AEQ"
attachments:
- color: warning
text: "Smoke test of `${{ inputs.env }}` has started"
footer: "<${{ github.server_url}}/${{ github.repository}}/actions/runs/${{ github.run_id }}|Smoke Test - Build ${{ github.run_id }}>"
mrkdown_in:
- footer
- name: "Checkout code"
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: AWS Credentials (non-prod)
if: ${{ inputs.env == 'dev' || inputs.env == 'test' }}
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.NON_PROD_ACCOUNT_ID }}:role/delegatedadmin/developer/dpc-${{ inputs.env }}-github-actions
- name: AWS Credentials (prod)
if: ${{ inputs.env == 'sandbox' || inputs.env == 'prod' }}
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.PROD_ACCOUNT_ID }}:role/delegatedadmin/developer/dpc-${{ inputs.env }}-github-actions
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: '1.24.x'
- name: Install PACE cert
env:
PACE_CERT: ${{ secrets.PACE_CERT }}
run: |
echo "${PACE_CERT}" > /etc/pki/ca-trust/source/anchors/pace.pem
update-ca-trust
- name: Build K6
run: |
# Install xk6
go install go.k6.io/xk6/cmd/xk6@v1.1.5
# Build the k6 binary
xk6 build
- name: Set env vars from AWS params
uses: cmsgov/cdap/actions/aws-params-env-action@8343fb96563ce4b74c4dececee9b268f42bd4a40
env:
AWS_REGION: ${{ vars.AWS_REGION }}
with:
params: |
GOLDEN_MACAROON=/dpc/${{ inputs.env }}/web/golden_macaroon
- name: Run Smoke Test
id: run-smoke-test
env:
ENVIRONMENT: ${{ inputs.env }}
run: |
./k6 run ./smoke-test.js
- uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
name: Slack Success
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
# Sends to dpc-deploys
payload: |
channel: "CMC1E4AEQ"
attachments:
- color: good
text: "Smoke test of `${{ inputs.env }}` has succeeded"
footer: "<${{ github.server_url}}/${{ github.repository}}/actions/runs/${{ github.run_id }}|Smoke Test - Build ${{ github.run_id }}>"
mrkdown_in:
- footer
- uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
name: Slack failure
if: ${{ failure() }}
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
# Sends to dpc-deploys
payload: |
channel: "CMC1E4AEQ"
attachments:
- color: danger
text: "Smoke test of `${{ inputs.env }}` has failed"
footer: "<${{ github.server_url}}/${{ github.repository}}/actions/runs/${{ github.run_id }}|Smoke Test - Build ${{ github.run_id }}>"
mrkdown_in:
- footer