Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions .github/workflows/cypress-manual.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
name: Run Cypress Tests

on:
schedule:
- cron: '0 4 * * 1' # Every Monday at 4:00 AM UTC
workflow_dispatch:
inputs:
target_env:
description: Target environment for Cypress run
required: true
default: staging
type: choice
options:
- staging
- prod

jobs:
cypress-run:
Expand All @@ -19,20 +30,27 @@ jobs:
- name: Install dependencies
run: yarn install

- name: Copy production env file
if: (inputs.target_env || 'staging') == 'prod'
run: |
echo ${{ secrets.ENV_PRODUCTION }} | base64 -d > .env.prod

- name: Copy staging env file
if: (inputs.target_env || 'staging') == 'staging'
run: |
echo ${{ secrets.ENV_STAGING }} | base64 -d > .env.staging

- name: Build app
run: yarn build:staging
env:
NODE_ENV: production
APP_ENV: staging
run: npx cross-env NODE_ENV=production APP_ENV=${{ inputs.target_env || 'staging' }} next build

- name: Run Cypress tests
uses: cypress-io/github-action@v6
with:
start: yarn start:staging
start: npx cross-env NODE_ENV=production APP_ENV=${{ inputs.target_env || 'staging' }} next start -p 3005
wait-on: 'http://localhost:3005'
wait-on-timeout: 300
command: yarn cypress run
command: yarn cypress:run
env:
NODE_ENV: production
APP_ENV: staging
APP_ENV: ${{ inputs.target_env || 'staging' }}
CYPRESS_BASE_URL: http://localhost:3005