Skip to content

Commit 5f94bba

Browse files
authored
Run E2E tests only on prod deployments (#407)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Restructured CI/CD deployment workflows with enhanced testing phases (unit tests and end-to-end tests now separated). * Improved QA build process and artifact management. * Refined post-deployment testing with live integration testing. * Streamlined deployment dependencies and workflow orchestration. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 57e8a32 commit 5f94bba

File tree

3 files changed

+87
-11
lines changed

3 files changed

+87
-11
lines changed

.github/workflows/deploy-prod.yml

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- 'v*'
99

1010
jobs:
11-
test:
11+
test-unit:
1212
permissions:
1313
contents: read
1414
runs-on: ubuntu-latest
@@ -70,7 +70,7 @@ jobs:
7070
id: get_version
7171
run: echo "VITE_BUILD_HASH=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV"
7272

73-
- name: Run build
73+
- name: Run Prod build
7474
run: make build
7575
env:
7676
HUSKY: "0"
@@ -88,6 +88,87 @@ jobs:
8888
dist/
8989
dist_ui/
9090
91+
- name: Clean and run QA build
92+
run: rm -rf dist/ && rm -rf dist_ui/ && make build
93+
env:
94+
HUSKY: "0"
95+
VITE_RUN_ENVIRONMENT: qa
96+
RunEnvironment: qa
97+
98+
- name: Upload Build files
99+
uses: actions/upload-artifact@v4
100+
with:
101+
include-hidden-files: true
102+
name: build-qa
103+
path: |
104+
.aws-sam/
105+
dist/
106+
dist_ui/
107+
108+
test-e2e:
109+
runs-on: ubuntu-latest
110+
timeout-minutes: 30
111+
name: Run E2E testing
112+
concurrency:
113+
group: ${{ github.event.repository.name }}-dev-env
114+
cancel-in-progress: false
115+
permissions:
116+
id-token: write
117+
contents: read
118+
needs:
119+
- build
120+
environment: "AWS QA"
121+
steps:
122+
- uses: actions/checkout@v5
123+
env:
124+
HUSKY: "0"
125+
126+
- name: Set up Node for testing
127+
uses: actions/setup-node@v5
128+
with:
129+
node-version: 22.x
130+
cache: "yarn"
131+
132+
- name: Setup Terraform
133+
uses: hashicorp/setup-terraform@v3
134+
with:
135+
terraform_version: 1.12.2
136+
137+
- name: Restore Yarn Cache
138+
uses: actions/cache@v4
139+
with:
140+
path: node_modules
141+
key: yarn-modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-dev
142+
restore-keys: |
143+
yarn-modules-${{ runner.arch }}-${{ runner.os }}-
144+
145+
- name: Download Build files
146+
uses: actions/download-artifact@v5
147+
with:
148+
name: build-qa
149+
150+
- uses: aws-actions/configure-aws-credentials@v5
151+
with:
152+
role-to-assume: arn:aws:iam::427040638965:role/GitHubActionsRole
153+
role-session-name: Core_QA_Deployment_${{ github.run_id }}
154+
aws-region: us-east-2
155+
156+
- name: Publish to AWS
157+
run: make deploy_qa
158+
env:
159+
HUSKY: "0"
160+
VITE_RUN_ENVIRONMENT: dev
161+
162+
- name: Run health check
163+
run: make dev_health_check
164+
165+
- name: Run E2E testing
166+
run: make test_e2e
167+
env:
168+
JWT_KEY: ${{ secrets.JWT_KEY }}
169+
PLAYWRIGHT_USERNAME: ${{ secrets.PLAYWRIGHT_USERNAME }}
170+
PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }}
171+
91172
deploy-prod:
92173
runs-on: ubuntu-latest
93174
timeout-minutes: 30
@@ -99,8 +180,8 @@ jobs:
99180
id-token: write
100181
contents: read
101182
needs:
102-
- test
103-
- build
183+
- test-unit
184+
- test-e2e
104185
environment: "AWS PROD"
105186
steps:
106187
- name: Set up Node for testing

.github/workflows/deploy-qa.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ jobs:
127127
with:
128128
name: build
129129

130-
131130
- uses: aws-actions/configure-aws-credentials@v5
132131
with:
133132
role-to-assume: arn:aws:iam::427040638965:role/GitHubActionsRole
@@ -143,9 +142,7 @@ jobs:
143142
- name: Run health check
144143
run: make dev_health_check
145144

146-
- name: Run post-deploy testing (Live and E2E)
147-
run: make test_post_deploy -j 2
145+
- name: Run live integration testing
146+
run: make test_live_integration
148147
env:
149-
PLAYWRIGHT_USERNAME: ${{ secrets.PLAYWRIGHT_USERNAME }}
150-
PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }}
151148
JWT_KEY: ${{ secrets.JWT_KEY }}

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ test_e2e: install
8787
yarn playwright install
8888
yarn test:e2e
8989

90-
test_post_deploy: test_live_integration test_e2e
91-
9290
dev_health_check:
9391
curl -f https://core.aws.qa.acmuiuc.org/api/v1/healthz && curl -f https://core.aws.qa.acmuiuc.org/
9492

0 commit comments

Comments
 (0)