Skip to content

Commit

Permalink
Build and run cypress in Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
alismx committed Apr 25, 2022
1 parent 5e52e4a commit 9d14978
Show file tree
Hide file tree
Showing 123 changed files with 1,682 additions and 926 deletions.
15 changes: 15 additions & 0 deletions .env.remote.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Docker settings
DOCKER_CLIENT_TIMEOUT=180
COMPOSE_HTTP_TIMEOUT=180

# Cypress settings
SPEC_PATH="cypress/integration/*"
TEST_ENV=https://test.simplereport.gov
CYPRESS_SKIP_OKTA=false

CYPRESS_OKTA_USERNAME=
CYPRESS_OKTA_PASSWORD=
CYPRESS_OKTA_SECRET=
CYPRESS_OKTA_REDIRECT_URI="https%3A%2F%2Ftest.simplereport.gov%2Fapp%2F"
CYPRESS_OKTA_SCOPE="simple_report_test"
CYPRESS_OKTA_CLIENT_ID="0oa1khettjHnj3EPT1d7"
36 changes: 33 additions & 3 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
# Smarty streets secrets
# Docker settings
DOCKER_CLIENT_TIMEOUT=180
COMPOSE_HTTP_TIMEOUT=180

# Backend settings
SPRING_PROFILES_ACTIVE=e2e,db-dockerized
WIREMOCK_URL=http://cypress:8088
SPRING_LIQUIBASE_ENABLED="true"
OKTA_TESTING_DISABLEHTTPSCHECK="true"

OKTA_API_KEY=
OKTA_OAUTH2_CLIENT_ID=
SMARTY_AUTH_ID=
SMARTY_AUTH_TOKEN=

# Okta secrets
OKTA_API_KEY=
# Cypress settings
SPEC_PATH="cypress/integration/*"
TEST_ENV=https://localhost.simplereport.gov
CYPRESS_SKIP_OKTA=false

CYPRESS_OKTA_USERNAME=
CYPRESS_OKTA_PASSWORD=
CYPRESS_OKTA_SECRET=

# Frontend settings
REACT_APP_BACKEND_URL=https://localhost.simplereport.gov/api
PUBLIC_URL=/app/
REACT_APP_OKTA_ENABLED=true
REACT_APP_DISABLE_MAINTENANCE_BANNER=true
REACT_APP_OKTA_URL=http://cypress:8088
REACT_APP_BASE_URL=https://localhost.simplereport.gov

REACT_APP_OKTA_CLIENT_ID=

# Shared settings (Backend, Frontend)
GIT_DISCOVERY_ACROSS_FILESYSTEM=1
70 changes: 0 additions & 70 deletions .github/actions/run-e2e-checks/action.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/buildCypressImage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build cypress docker image

on:
workflow_call:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/cypress

jobs:
build-and-push-cypress-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: cypress
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
25 changes: 11 additions & 14 deletions .github/workflows/deployStg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ on:
branches:
- main

# this
# on:
# workflow_run:
# workflows: ["Deploy Test"]
# types:
# - completed

env:
DEPLOY_ENV: stg
NODE_VERSION: 14
Expand All @@ -13,6 +20,7 @@ concurrency:

jobs:
build-docker:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -26,6 +34,7 @@ jobs:
- name: Build and push Docker images
run: ./build_and_push.sh
prerelease-backend:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
needs: build-docker
defaults:
Expand Down Expand Up @@ -56,6 +65,7 @@ jobs:
timeout-minutes: 1
run: make wait-for-${{ env.DEPLOY_ENV }}-slot-readiness
build-frontend:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -88,6 +98,7 @@ jobs:
path: client.tgz
retention-days: 1
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment:
name: Staging
Expand All @@ -107,17 +118,3 @@ jobs:
with:
client-tarball: client.tgz
deploy-env: ${{env.DEPLOY_ENV}}
e2e:
needs: [deploy]
runs-on: ubuntu-latest
env:
E2E_SPEC_FILES: "cypress/integration/00*,cypress/integration/01*,cypress/integration/02*,cypress/integration/03*,cypress/integration/04*,cypress/integration/05*,cypress/integration/06*"
CYPRESS_OKTA_USERNAME: ${{ secrets.CYPRESS_OKTA_USERNAME }}
CYPRESS_OKTA_PASSWORD: ${{ secrets.CYPRESS_OKTA_PASSWORD }}
CYPRESS_OKTA_SECRET: ${{ secrets.CYPRESS_OKTA_SECRET }}
CYPRESS_BASE_URL: https://stg.simplereport.gov
steps:
- name: "Checkout"
uses: actions/checkout@v2
- name: Run Cypress checks against the dev remote environment
uses: ./.github/actions/run-e2e-checks
20 changes: 19 additions & 1 deletion .github/workflows/deployTest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Deploy Test

on:
workflow_dispatch:
push:
branches:
- alis/1770-3280

concurrency:
group: test-deploy
Expand All @@ -11,6 +13,8 @@ env:
NODE_VERSION: 14

jobs:
build-cypress:
uses: ./.github/workflows/buildCypressImage.yml
build-docker:
runs-on: ubuntu-latest
defaults:
Expand Down Expand Up @@ -110,3 +114,17 @@ jobs:
with:
client-tarball: client.tgz
deploy-env: ${{env.DEPLOY_ENV}}
run-cypress:
needs: [build-cypress, deploy]
uses: ./.github/workflows/e2eRemote.yml
with:
cypress_okta_redirect_uri: "https%3A%2F%2Ftest.simplereport.gov%2Fapp%2F"
cypress_okta_scope: "simple_report_test"
cypress_okta_client_id: "0oa1khettjHnj3EPT1d7"
# spec_path: "cypress/integration/00*,cypress/integration/01*,cypress/integration/02*,cypress/integration/03*,cypress/integration/04*,cypress/integration/05*,cypress/integration/06*"
spec_path: "cypress/integration/07*"
test_env: "https://test.simplereport.gov"
secrets:
cypress_okta_username: ${{ secrets.CYPRESS_OKTA_USERNAME }}
cypress_okta_password: ${{ secrets.CYPRESS_OKTA_PASSWORD }}
cypress_okta_secret: ${{ secrets.CYPRESS_OKTA_SECRET }}
Loading

0 comments on commit 9d14978

Please sign in to comment.