File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Run Cypress Tests
22
33on :
4+ schedule :
5+ - cron : ' 0 4 * * 1' # Every Monday at 4:00 AM UTC
46 workflow_dispatch :
7+ inputs :
8+ target_env :
9+ description : Target environment for Cypress run
10+ required : true
11+ default : staging
12+ type : choice
13+ options :
14+ - staging
15+ - prod
516
617jobs :
718 cypress-run :
@@ -19,20 +30,27 @@ jobs:
1930 - name : Install dependencies
2031 run : yarn install
2132
33+ - name : Copy production env file
34+ if : (inputs.target_env || 'staging') == 'prod'
35+ run : |
36+ echo ${{ secrets.ENV_PRODUCTION }} | base64 -d > .env.prod
37+
38+ - name : Copy staging env file
39+ if : (inputs.target_env || 'staging') == 'staging'
40+ run : |
41+ echo ${{ secrets.ENV_STAGING }} | base64 -d > .env.staging
42+
2243 - name : Build app
23- run : yarn build:staging
24- env :
25- NODE_ENV : production
26- APP_ENV : staging
44+ run : npx cross-env NODE_ENV=production APP_ENV=${{ inputs.target_env || 'staging' }} next build
2745
2846 - name : Run Cypress tests
2947 uses : cypress-io/github-action@v6
3048 with :
31- start : yarn start: staging
49+ start : npx cross-env NODE_ENV=production APP_ENV=${{ inputs.target_env || ' staging' }} next start -p 3005
3250 wait-on : ' http://localhost:3005'
3351 wait-on-timeout : 300
34- command : yarn cypress run
52+ command : yarn cypress: run
3553 env :
3654 NODE_ENV : production
37- APP_ENV : staging
55+ APP_ENV : ${{ inputs.target_env || ' staging' }}
3856 CYPRESS_BASE_URL : http://localhost:3005
You can’t perform that action at this time.
0 commit comments