Skip to content

Commit

Permalink
ci: add tests on deploy to prod and pr (#2)
Browse files Browse the repository at this point in the history
* ci: add tests on deploy to prod and pr

* fix: remove mask preventing service_url from showing

* fix: trailing space in service url
  • Loading branch information
bernardobridge authored Jan 24, 2024
1 parent 348a221 commit bc0d6bd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
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

0 comments on commit bc0d6bd

Please sign in to comment.