Skip to content

Commit

Permalink
use envs
Browse files Browse the repository at this point in the history
  • Loading branch information
sprutton1 committed Jun 24, 2024
1 parent a7b413e commit fba467b
Showing 1 changed file with 21 additions and 31 deletions.
52 changes: 21 additions & 31 deletions .github/workflows/e2e-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ on:
# - cron: '*/5 * * * *' # Runs every 5 minutes
inputs:
environment:
description: 'Select environment'
required: true
default: 'PROD'
type: choice
required: true
description: "where to deploy"
default: "tools"
options:
- PROD
- TOOLS
- tools
- production

jobs:
cypress-tests:
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
strategy:
# don't fail the entire matrix on failure
Expand All @@ -25,31 +26,13 @@ jobs:
containers: [1] # , 2, 3, 4, 5, 6, 7, 8, 9, 10] - temp disabled mass
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '18.18.2'

- name: Setup authentication for vite & other synthetic test variables
working-directory: app/web
run: |
sudo apt update
sudo apt install uuid -y
cp .env .env.local
echo "VITE_AUTH0_USERNAME=${{ secrets.VITE_AUTH0_USERNAME }}" >> .env.local
echo "VITE_AUTH0_PASSWORD=${{ secrets.VITE_AUTH0_PASSWORD }}" >> .env.local
echo "VITE_SI_CYPRESS_MULTIPLIER=${{ vars.VITE_SI_CYPRESS_MULTIPLIER }}" >> .env.local
if [ "${{ github.event.inputs.environment }}" == "PROD" ]; then
echo "VITE_SI_WORKSPACE_URL=${{ vars.VITE_PROD_SI_WORKSPACE_URL }}" >> .env.local
echo "VITE_SI_WORKSPACE_ID=${{ vars.VITE_PROD_SI_WORKSPACE_ID }}" >> .env.local
elif [ "${{ github.event.inputs.environment }}" == "TOOLS" ]; then
echo "VITE_SI_WORKSPACE_URL=${{ vars.VITE_TOOLS_SI_WORKSPACE_URL }}" >> .env.local
echo "VITE_SI_WORKSPACE_ID=${{ vars.VITE_TOOLS_SI_WORKSPACE_ID }}" >> .env.local
fi
echo "VITE_UUID=$(uuid)" >> .env.local
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
Expand All @@ -60,18 +43,25 @@ jobs:
run: |
pnpm i
pnpm install cypress
- name: install uuid
run: |
sudo apt update
sudo apt install uuid -y
- uses: nick-fields/retry@v2
with:
max_attempts: 3
timeout_minutes: 20
command: |
if [ "${{ github.event.inputs.environment }}" == "PROD" ]; then
export VITE_HOST_URL=${{ vars.VITE_PROD_SI_WORKSPACE_URL }}
elif [ "${{ github.event.inputs.environment }}" == "TOOLS" ]; then
export VITE_HOST_URL=${{ vars.VITE_TOOLS_SI_WORKSPACE_URL }}
fi
cd app/web
export VITE_AUTH0_USERNAME=${{ secrets.VITE_AUTH0_USERNAME }}
export VITE_AUTH0_PASSWORD=${{ secrets.VITE_AUTH0_PASSWORD }},\
export VITE_SI_CYPRESS_MULTIPLIER=${{ vars.VITE_SI_CYPRESS_MULTIPLIER }}
export VITE_SI_WORKSPACE_URL=${{ vars.VITE_SI_WORKSPACE_URL }}
export VITE_HOST_URL=${{ vars.VITE_SI_WORKSPACE_URL }}
export VITE_SI_WORKSPACE_ID=${{ vars.VITE_SI_WORKSPACE_ID }}
export VITE_UUID=$(uuid)
npx cypress run --spec "cypress/e2e/**"
- name: 'Upload Cypress Recordings to Github'
Expand Down

0 comments on commit fba467b

Please sign in to comment.