Skip to content

Commit 3203c2b

Browse files
authored
Merge pull request #44 from keepsimpleio/chore/cypress-schedule
chore: add cypress schedule
2 parents cedbde9 + c32af33 commit 3203c2b

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

.github/workflows/cypress-manual.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
name: Run Cypress Tests
22

33
on:
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

617
jobs:
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

0 commit comments

Comments
 (0)