Skip to content

Commit c38551c

Browse files
authored
Prepare basic UI tests in the pipeline (#30)
* add basic ui tests * fix lint * setup ui tests to be run in our pipeline * fix health check to run both UI and API * fix clean command * fix editorconfig * fix pipelines to reuse environments and ensure consistency * fix name * fix name * Fix some values
1 parent b47c64f commit c38551c

File tree

15 files changed

+263
-227
lines changed

15 files changed

+263
-227
lines changed

.editorconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ trim_trailing_whitespace = true
1010

1111
[*.md]
1212
max_line_length = off
13-
trim_trailing_whitespace = false
13+
trim_trailing_whitespace = false
14+
15+
[{Makefile,**.mk}]
16+
# Use tabs for indentation (Makefiles require tabs)
17+
indent_style = tab

.github/workflows/deploy-dev.yml

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
deploy-dev:
2828
runs-on: ubuntu-latest
2929
concurrency:
30-
group: ${{ github.event.repository.name }}-dev-aws
30+
group: ${{ github.event.repository.name }}-dev-env
3131
cancel-in-progress: false
3232
environment: "AWS DEV"
33-
name: Deploy to AWS DEV
33+
name: Deploy to DEV
3434
needs:
3535
- test-unit
3636
steps:
@@ -53,33 +53,12 @@ jobs:
5353
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
5454
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
5555
aws-region: us-east-1
56-
- run: make deploy_dev
56+
- name: Publish to AWS
57+
run: make deploy_dev
5758
env:
5859
HUSKY: "0"
59-
deploy-cf-pages-dev:
60-
runs-on: ubuntu-latest
61-
concurrency:
62-
group: ${{ github.event.repository.name }}-dev-cf
63-
cancel-in-progress: false
64-
permissions:
65-
contents: read
66-
deployments: write
67-
needs:
68-
- test-unit
69-
name: Deploy to Cloudflare Pages DEV
70-
environment: "Cloudflare Pages"
71-
steps:
72-
- name: Checkout
73-
uses: actions/checkout@v3
74-
- name: Setup Node LTS
75-
uses: actions/setup-node@v4
76-
with:
77-
node-version: 20
78-
- name: Build
79-
run: corepack enable && yarn && yarn run build
80-
env:
8160
VITE_RUN_ENVIRONMENT: dev
82-
- name: Publish
61+
- name: Publish to Cloudflare
8362
uses: cloudflare/pages-action@v1
8463
with:
8564
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
@@ -88,14 +67,14 @@ jobs:
8867
directory: dist_ui/
8968
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
9069
branch: main
91-
test:
70+
71+
test-dev:
9272
runs-on: ubuntu-latest
9373
name: Run Live Integration Tests
9474
needs:
9575
- deploy-dev
96-
- deploy-cf-pages-dev
9776
concurrency:
98-
group: ${{ github.event.repository.name }}-dev
77+
group: ${{ github.event.repository.name }}-dev-env
9978
cancel-in-progress: false
10079
steps:
10180
- name: Set up Node

.github/workflows/deploy-prod.yml

Lines changed: 19 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
name: Run Unit Tests
1313
steps:
14-
- name: Set up Node for testing
14+
- name: Set up Node
1515
uses: actions/setup-node@v4
1616
with:
1717
node-version: 20.x
@@ -27,10 +27,10 @@ jobs:
2727
deploy-dev:
2828
runs-on: ubuntu-latest
2929
concurrency:
30-
group: ${{ github.event.repository.name }}-dev-aws
30+
group: ${{ github.event.repository.name }}-dev
3131
cancel-in-progress: false
3232
environment: "AWS DEV"
33-
name: Deploy to AWS DEV
33+
name: Deploy to DEV
3434
needs:
3535
- test-unit
3636
steps:
@@ -53,51 +53,31 @@ jobs:
5353
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
5454
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
5555
aws-region: us-east-1
56-
- run: make deploy_dev
56+
- name: Publish to AWS
57+
run: make deploy_dev
5758
env:
5859
HUSKY: "0"
59-
deploy-cf-pages-dev:
60-
runs-on: ubuntu-latest
61-
concurrency:
62-
group: ${{ github.event.repository.name }}-dev-cf
63-
cancel-in-progress: false
64-
permissions:
65-
contents: read
66-
deployments: write
67-
needs:
68-
- test-unit
69-
name: Deploy to Cloudflare Pages DEV
70-
environment: "Cloudflare Pages"
71-
steps:
72-
- name: Checkout
73-
uses: actions/checkout@v3
74-
- name: Setup Node LTS
75-
uses: actions/setup-node@v4
76-
with:
77-
node-version: 20
78-
- name: Build
79-
run: corepack enable && yarn && yarn run build
80-
env:
8160
VITE_RUN_ENVIRONMENT: dev
82-
- name: Publish
61+
- name: Publish to Cloudflare
8362
uses: cloudflare/pages-action@v1
8463
with:
8564
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
8665
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
8766
projectName: management-ui-dev
8867
directory: dist_ui/
8968
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
90-
test:
69+
branch: main
70+
71+
test-dev:
9172
runs-on: ubuntu-latest
9273
name: Run Live Integration Tests
9374
needs:
9475
- deploy-dev
95-
- deploy-cf-pages-dev
9676
concurrency:
9777
group: ${{ github.event.repository.name }}-dev
9878
cancel-in-progress: false
9979
steps:
100-
- name: Set up Node for testing
80+
- name: Set up Node
10181
uses: actions/setup-node@v4
10282
with:
10383
node-version: 20.x
@@ -110,11 +90,12 @@ jobs:
11090
python-version: 3.11
11191
- name: Run live testing
11292
run: make test_live_integration
113-
deploy-aws-prod:
93+
94+
deploy-prod:
11495
runs-on: ubuntu-latest
115-
name: Deploy to AWS PROD
96+
name: Deploy to Prod
11697
concurrency:
117-
group: ${{ github.event.repository.name }}-prod-aws
98+
group: ${{ github.event.repository.name }}-prod
11899
cancel-in-progress: false
119100
needs:
120101
- test
@@ -139,33 +120,12 @@ jobs:
139120
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
140121
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
141122
aws-region: us-east-1
142-
- run: make deploy_prod
123+
- name: Publish to AWS
124+
run: make deploy_prod
143125
env:
144126
HUSKY: "0"
145-
deploy-cf-pages-prod:
146-
runs-on: ubuntu-latest
147-
needs:
148-
- test
149-
permissions:
150-
contents: read
151-
deployments: write
152-
concurrency:
153-
group: ${{ github.event.repository.name }}-prod-cf
154-
cancel-in-progress: false
155-
name: Deploy to Cloudflare Pages Prod
156-
environment: "Cloudflare Pages"
157-
steps:
158-
- name: Checkout
159-
uses: actions/checkout@v3
160-
- name: Setup Node LTS
161-
uses: actions/setup-node@v4
162-
with:
163-
node-version: 20
164-
- name: Build
165-
run: corepack enable && yarn && yarn run build
166-
env:
167127
VITE_RUN_ENVIRONMENT: prod
168-
- name: Publish
128+
- name: Publish to Cloudflare
169129
uses: cloudflare/pages-action@v1
170130
with:
171131
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
@@ -174,11 +134,12 @@ jobs:
174134
directory: dist_ui/
175135
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
176136
branch: main
137+
177138
health-check-prod:
178139
runs-on: ubuntu-latest
179140
name: Confirm services healthy
180141
needs:
181-
- deploy-aws-prod
142+
- deploy-prod
182143
concurrency:
183144
group: ${{ github.event.repository.name }}-prod
184145
cancel-in-progress: false

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ region="us-east-1"
1616

1717
# DO NOT CHANGE
1818
common_params = --no-confirm-changeset \
19-
--no-fail-on-empty-changeset \
20-
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
21-
--region $(region) \
22-
--stack-name $(application_key) \
19+
--no-fail-on-empty-changeset \
20+
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
21+
--region $(region) \
22+
--stack-name $(application_key) \
2323
--tags "project=$(application_key)" "techlead=$(techlead)" \
2424
--s3-prefix $(application_key) \
2525
--resolve-s3
@@ -45,6 +45,7 @@ clean:
4545
rm -rf src/api/node_modules/
4646
rm -rf src/ui/node_modules/
4747
rm -rf dist/
48+
rm -rf dist_ui/
4849

4950
build: src/ cloudformation/ docs/
5051
yarn -D
@@ -54,7 +55,7 @@ build: src/ cloudformation/ docs/
5455
local:
5556
yarn run dev
5657

57-
deploy_prod: check_account_prod build
58+
deploy_prod: check_account_prod build
5859
aws sts get-caller-identity --query Account --output text
5960
sam deploy $(common_params) --parameter-overrides $(run_env)=prod $(set_application_prefix)=$(application_key) $(set_application_name)="$(application_name)"
6061

@@ -74,7 +75,7 @@ test_unit: install_test_deps
7475
yarn test:unit
7576

7677
dev_health_check:
77-
curl -f https://$(application_key).aws.qa.acmuiuc.org/api/v1/healthz
78+
curl -f https://$(application_key).aws.qa.acmuiuc.org/api/v1/healthz && curl -f https://manage.qa.acmuiuc.org
7879

7980
prod_health_check:
80-
curl -f https://$(application_key).aws.acmuiuc.org/api/v1/healthz
81+
curl -f https://$(application_key).aws.acmuiuc.org/api/v1/healthz && curl -f https://manage.acm.illinois.edu

0 commit comments

Comments
 (0)