diff --git a/.github/actions/post-deploy-smoke-test/action.yml b/.github/actions/post-deploy-smoke-test/action.yml new file mode 100644 index 00000000000..39aed1d12f5 --- /dev/null +++ b/.github/actions/post-deploy-smoke-test/action.yml @@ -0,0 +1,33 @@ +name: Smoke test post deploy +description: Ping a backend health endpoint that reaches into the db and return a status message to a frontend status page. Visit that page and ensure things are healthy +inputs: + deploy-env: + description: The environment being deployed (e.g. "prod" or "test") + required: true + + smoke-test-front-and-back-end: + runs-on: ubuntu-latest + steps: + - name: create env file + working-directory: frontend + run: | + touch .env + echo REACT_APP_BASE_URL=https://${{ inputs.deploy_env }}.simplereport.gov/ >> .env.production.local + - name: Run smoke test script + working-directory: frontend + run: yarn smoke:prod:deploy:ci + + # slack_alert: + # runs-on: ubuntu-latest + # if: failure() + # needs: [ smoke-test-front-and-back-end ] + # steps: + # - uses: actions/checkout@v4 + # - name: Send alert to Slack + # uses: ./.github/actions/slack-message + # with: + # username: ${{ github.actor }} + # description: | + # :siren-gif: Post-deploy smoke test couldn't verify that the frontend is talking to the backend. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} :siren-gif: + # webhook_url: ${{ secrets.SR_ALERTS_SLACK_WEBHOOK_URL }} + # user_map: $${{ secrets.SR_ALERTS_GITHUB_SLACK_MAP }} \ No newline at end of file diff --git a/.github/workflows/smokeTestDeploy.yml b/.github/workflows/smokeTestDeploy.yml deleted file mode 100644 index 9f26f58492f..00000000000 --- a/.github/workflows/smokeTestDeploy.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Smoke test deploy -run-name: Smoke test the deploy for ${{ inputs.deploy_env }} by @${{ github.actor }} - -on: - # DELETE ME WHEN MERGING - push: - workflow_dispatch: - inputs: - deploy_env: - description: 'The environment to smoke test' - required: true - type: choice - options: - - "" - - dev - - dev2 - - dev3 - - dev4 - - dev5 - - dev6 - - dev7 - - pentest - workflow_run: - workflows: [ "Deploy Dev", " Deploy Prod" ] - types: - - completed - -env: - NODE_VERSION: 18 - -jobs: - smoke-test-front-and-back-end: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: '18' - - name: Cache yarn - uses: actions/cache@v3.3.2 - with: - path: ~/.cache/yarn - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - - name: Set up dependencies - working-directory: frontend - run: yarn install --prefer-offline - - name: Run smoke test script - working-directory: frontend - run: yarn smoke:prod:deploy:ci - -# slack_alert: -# runs-on: ubuntu-latest -# if: failure() -# needs: [ smoke-test-front-and-back-end ] -# steps: -# - uses: actions/checkout@v4 -# - name: Send alert to Slack -# uses: ./.github/actions/slack-message -# with: -# username: ${{ github.actor }} -# description: | -# :siren-gif: Post-deploy smoke test couldn't verify that the frontend is talking to the backend. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} :siren-gif: -# webhook_url: ${{ secrets.SR_ALERTS_SLACK_WEBHOOK_URL }} -# user_map: $${{ secrets.SR_ALERTS_GITHUB_SLACK_MAP }} \ No newline at end of file diff --git a/.github/workflows/smokeTestDeployDev.yml b/.github/workflows/smokeTestDeployDev.yml new file mode 100644 index 00000000000..d0a4ea24dc6 --- /dev/null +++ b/.github/workflows/smokeTestDeployDev.yml @@ -0,0 +1,47 @@ +name: Smoke test deploy +run-name: Smoke test the deploy for ${{ inputs.deploy_env }} by @${{ github.actor }} + +on: + # DELETE ME WHEN MERGING + push: + workflow_dispatch: + inputs: + deploy_env: + description: 'The environment to smoke test' + required: true + type: choice + options: + - "" + - dev + - dev2 + - dev3 + - dev4 + - dev5 + - dev6 + - dev7 + - pentest + +env: + NODE_VERSION: 18 + +jobs: + smoke-test-front-and-back-end: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Cache yarn + uses: actions/cache@v3.3.2 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + - name: Set up dependencies + working-directory: frontend + run: yarn install --prefer-offline + - name: Smoke test the env + uses: ./.github/actions/post-deploy-smoke-test + with: + # REPLACE ME WITH deploy-env: ${{inputs.deploy_env}} + deploy-env: dev7 + diff --git a/.github/workflows/smokeTestDeployProd.yml b/.github/workflows/smokeTestDeployProd.yml new file mode 100644 index 00000000000..b2b83037eed --- /dev/null +++ b/.github/workflows/smokeTestDeployProd.yml @@ -0,0 +1,34 @@ +name: Smoke test deploy +run-name: Smoke test the deploy for ${{ inputs.deploy_env }} by @${{ github.actor }} + +on: + # DELETE ME WHEN MERGING + push: + workflow_run: + workflows: [ " Deploy Prod" ] + types: + - completed + +env: + NODE_VERSION: 18 + DEPLOY_ENV: prod + +jobs: + smoke-test-front-and-back-end: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Cache yarn + uses: actions/cache@v3.3.2 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + - name: Set up dependencies + working-directory: frontend + run: yarn install --prefer-offline + - name: Smoke test the env + uses: ./.github/actions/post-deploy-smoke-test + with: + deploy-env: ${{env.DEPLOY_ENV}} diff --git a/frontend/package.json b/frontend/package.json index ba6b7b015ce..690d715f00e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -77,7 +77,7 @@ "maintenance:start": "[ -z \"$MAINTENANCE_MESSAGE\" ] && echo \"MAINTENANCE_MESSAGE must be set!\" || (echo $MAINTENANCE_MESSAGE > maintenance.json && yarn maintenance:deploy && rm maintenance.json)", "maintenance:deploy": "[ -z \"$MAINTENANCE_ENV\" ] && echo \"MAINTENANCE_ENV must be set!\" || az storage blob upload -f maintenance.json -n maintenance.json -c '$web' --account-name simplereport${MAINTENANCE_ENV}app --overwrite", "smoke:prod:deploy": "node prod-smoke.js", - "smoke:prod:deploy:ci": "node -r dotenv/config prod-smoke.js dotenv_config_path=.env.production dotenv_config_debug=true" + "smoke:prod:deploy:ci": "node -r dotenv/config prod-smoke.js dotenv_config_path=.env.production.local dotenv_config_debug=true" }, "prettier": { "singleQuote": false