Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add tests on deploy to prod and pr #2

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/deploy-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Deploy to prod
on:
workflow_dispatch:
schedule:
# every monday at 6:00 AM UTC
- cron: '0 6 * * 1'
# every 2 hours
- cron: '0 */2 * * *'

jobs:
deploy-prod:
Expand All @@ -16,4 +16,17 @@ jobs:
AWS_DEPLOYER_ROLE: ${{ secrets.AWS_DEPLOYER_ROLE }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}
with:
ENVIRONMENT: prod
ENVIRONMENT: prod

run-perf-smoke:
uses: ./.github/workflows/run-performance-test.yaml
permissions:
id-token: write
contents: read
secrets:
DD_API_KEY: ${{ secrets.DD_API_KEY }}
ARTILLERY_CLOUD_API_KEY: ${{ secrets.ARTILLERY_CLOUD_API_KEY }}
with:
ENVIRONMENT: prod
TEST_TYPE: smoke
VERSION: ${{ github.sha }}
19 changes: 17 additions & 2 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
AWS_DEPLOYER_ROLE: ${{ secrets.AWS_DEPLOYER_ROLE }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}
with:
ENVIRONMENT: ${{ github.actor }}-${{ github.event.pull_request.number }}
ENVIRONMENT: ${{ github.actor }}-${{ github.event.pull_request.number || github.run_id }}
SHOULD_SEED_DB: true

run-functional-tests:
Expand All @@ -37,10 +37,25 @@ jobs:
run: echo "Running functional tests against ${{ needs.deploy-ephemeral.outputs.SERVICE_URL }}"
env:
SERVICE_URL: ${{ needs.deploy-ephemeral.outputs.SERVICE_URL }}

run-perf-regression:
uses: ./.github/workflows/run-performance-test.yaml
needs: [deploy-ephemeral, run-functional-tests]
permissions:
id-token: write
contents: read
secrets:
DD_API_KEY: ${{ secrets.DD_API_KEY }}
ARTILLERY_CLOUD_API_KEY: ${{ secrets.ARTILLERY_CLOUD_API_KEY }}
with:
ENVIRONMENT: custom
TEST_TYPE: regression
VERSION: ${{ github.sha }}
SERVICE_URL: ${{ needs.deploy-ephemeral.outputs.SERVICE_URL }}

teardown-ephemeral-env:
uses: ./.github/workflows/stack-delete.yaml
needs: run-functional-tests
needs: run-perf-regression
permissions:
id-token: write
contents: read
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/serverless-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ jobs:
- id: set_service_url
name: Generate, mask, and output a secret
run: |
SERVICE_URL="$(npx serverless info --stage ${{ inputs.ENVIRONMENT }} --verbose | grep ServiceEndpoint | sed s/ServiceEndpoint\:\ //g)"
echo "::add-mask::$SERVICE_URL"
SERVICE_URL="$(npx serverless info --stage ${{ inputs.ENVIRONMENT }} --verbose 2>&1 | grep -i 'ServiceEndpoint:' | sed -e 's/[[:space:]]*ServiceEndpoint:[[:space:]]*//I' | head -n 1)"
echo "SERVICE_URL=$SERVICE_URL" >> "$GITHUB_OUTPUT"
- name: Send Datadog Deployment Event
if: success()
Expand Down
Loading