Skip to content

Commit

Permalink
Add smoke test post deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
RMcVelia committed Dec 1, 2023
1 parent ab2d67c commit bd5d58d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 40 deletions.
44 changes: 4 additions & 40 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,47 +86,11 @@ runs:
TF_VAR_azure_sp_credentials: ${{ inputs.azure-credentials }}
CONFIRM_PRODUCTION: true

- name: Set up environment variables
shell: bash
run: |
case ${{ env.cluster }} in
test)
echo "cluster_rg=s189t01-tsc-ts-rg" >> $GITHUB_ENV
echo "cluster_name=s189t01-tsc-test-aks" >> $GITHUB_ENV
;;
production)
echo "cluster_rg=s189p01-tsc-pd-rg" >> $GITHUB_ENV
echo "cluster_name=s189p01-tsc-production-aks" >> $GITHUB_ENV
;;
*)
echo "unknown cluster"
;;
esac
- name: Install kubectl
uses: azure/setup-kubectl@v3
- name: Run Smoke Tests for ${{ inputs.environment }}
uses: ./.github/actions/smoke-test/
with:
version: "v1.26.1" # default is latest stable

- name: K8 setup
shell: bash
run: |
az aks get-credentials -g ${{ env.cluster_rg }} -n ${{ env.cluster_name }}
make install-konduit
# review app seeded?
# - name: Generate example data
# shell: bash
# if: inputs.environment == 'review'
# run: kubectl exec -n ${{ env.namespace }} deployment/teacher-relocation-payment-${APP_NAME} -- /bin/sh -c "cd /app && bin/rails RAILS_ENV=test db:schema:load && bin/rails RAILS_ENV=test db:seed"

# - name: Run Smoke Tests for ${{ inputs.environment }}
# uses: ./.github/actions/smoke-test_v2/
# with:
# environment: ${{ inputs.environment }}
# app-env: ${{ env.aks_app_environment }}
# pr-number: ${{ inputs.pr-number }}
# slack-webhook: ${{ inputs.slack-webhook }}
environment: ${{ inputs.environment }}
url: ${{ steps.set_env_var.outputs.deploy_url }}

# - name: Notify Slack channel on job failure
# if: ${{ failure() && github.ref == 'refs/heads/main' }}
Expand Down
34 changes: 34 additions & 0 deletions .github/actions/smoke-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: smoke-test
description: runs smoke tests

inputs:
environment:
description: Environment to run tests in
required: true
url:
description: APP URL
required: true

runs:
using: composite
steps:
- name: Set up Ruby 3.2.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2

- name: Bundle smoke test gems
shell: bash
run: |
gem install bundler
echo 'gem "rspec"' >> Gemfile
bundle
- name: Run smoke tests
shell: bash
run: bin/smoke
env:
RAILS_ENV: test
SMOKE_URL: ${{ inputs.url }}
GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }}
GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID: ${{ secrets.GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID }}

0 comments on commit bd5d58d

Please sign in to comment.