Skip to content

Commit d689596

Browse files
committed
Merge main with paidevent
2 parents 2e5953f + f727980 commit d689596

File tree

109 files changed

+7001
-2108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+7001
-2108
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
"image": "mcr.microsoft.com/devcontainers/base:jammy",
77
"features": {
88
"ghcr.io/devcontainers/features/node:1": {},
9-
"ghcr.io/devcontainers/features/aws-cli:1": {},
9+
"ghcr.io/devcontainers/features/aws-cli:1": {},
1010
"ghcr.io/jungaretti/features/make:1": {},
11-
"ghcr.io/customink/codespaces-features/sam-cli:1": {}
11+
"ghcr.io/customink/codespaces-features/sam-cli:1": {},
12+
"ghcr.io/devcontainers/features/python:1": {}
1213
},
1314

1415
// Features to add to the dev container. More info: https://containers.dev/features.

.github/workflows/deploy-dev.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Node
1515
uses: actions/setup-node@v4
1616
with:
17-
node-version: 20.x
17+
node-version: 22.x
1818
- uses: actions/checkout@v4
1919
env:
2020
HUSKY: "0"
@@ -37,7 +37,7 @@ jobs:
3737
- name: Set up Node for testing
3838
uses: actions/setup-node@v4
3939
with:
40-
node-version: 20.x
40+
node-version: 22.x
4141
- uses: actions/checkout@v4
4242
env:
4343
HUSKY: "0"
@@ -70,7 +70,7 @@ jobs:
7070

7171
test-dev:
7272
runs-on: ubuntu-latest
73-
name: Run Live Integration Tests
73+
name: Run Live Tests
7474
needs:
7575
- deploy-dev
7676
concurrency:
@@ -80,13 +80,22 @@ jobs:
8080
- name: Set up Node
8181
uses: actions/setup-node@v4
8282
with:
83-
node-version: 20.x
83+
node-version: 22.x
8484
- uses: actions/checkout@v4
8585
env:
8686
HUSKY: "0"
8787
- name: Set up Python 3.11 for testing
8888
uses: actions/setup-python@v5
8989
with:
9090
python-version: 3.11
91+
- name: Run health check
92+
run: make dev_health_check
9193
- name: Run live testing
9294
run: make test_live_integration
95+
env:
96+
JWT_KEY: ${{ secrets.JWT_KEY }}
97+
- name: Run E2E testing
98+
run: make test_e2e
99+
env:
100+
PLAYWRIGHT_USERNAME: ${{ secrets.PLAYWRIGHT_USERNAME }}
101+
PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }}

.github/workflows/deploy-prod.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Node
1515
uses: actions/setup-node@v4
1616
with:
17-
node-version: 20.x
17+
node-version: 22.x
1818
- uses: actions/checkout@v4
1919
env:
2020
HUSKY: "0"
@@ -37,7 +37,7 @@ jobs:
3737
- name: Set up Node for testing
3838
uses: actions/setup-node@v4
3939
with:
40-
node-version: 20.x
40+
node-version: 22.x
4141
- uses: actions/checkout@v4
4242
env:
4343
HUSKY: "0"
@@ -70,7 +70,7 @@ jobs:
7070

7171
test-dev:
7272
runs-on: ubuntu-latest
73-
name: Run Live Integration Tests
73+
name: Run Live Tests
7474
needs:
7575
- deploy-dev
7676
concurrency:
@@ -80,7 +80,7 @@ jobs:
8080
- name: Set up Node
8181
uses: actions/setup-node@v4
8282
with:
83-
node-version: 20.x
83+
node-version: 22.x
8484
- uses: actions/checkout@v4
8585
env:
8686
HUSKY: "0"
@@ -90,6 +90,13 @@ jobs:
9090
python-version: 3.11
9191
- name: Run live testing
9292
run: make test_live_integration
93+
env:
94+
JWT_KEY: ${{ secrets.JWT_KEY }}
95+
- name: Run E2E testing
96+
run: make test_e2e
97+
env:
98+
PLAYWRIGHT_USERNAME: ${{ secrets.PLAYWRIGHT_USERNAME }}
99+
PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }}
93100

94101
deploy-prod:
95102
runs-on: ubuntu-latest
@@ -98,13 +105,13 @@ jobs:
98105
group: ${{ github.event.repository.name }}-prod
99106
cancel-in-progress: false
100107
needs:
101-
- test
108+
- test-dev
102109
environment: "AWS PROD"
103110
steps:
104111
- name: Set up Node for testing
105112
uses: actions/setup-node@v4
106113
with:
107-
node-version: 20.x
114+
node-version: 22.x
108115
- uses: actions/checkout@v4
109116
env:
110117
HUSKY: "0"
@@ -147,7 +154,7 @@ jobs:
147154
- name: Set up Node for testing
148155
uses: actions/setup-node@v4
149156
with:
150-
node-version: 20.x
157+
node-version: 22.x
151158
- uses: actions/checkout@v4
152159
env:
153160
HUSKY: "0"

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,8 @@ dist_ui/
137137

138138
*.pyc
139139
__pycache__
140+
/test-results/
141+
/playwright-report/
142+
/blob-report/
143+
/playwright/.cache/
144+
dist_devel/

.husky/pre-commit

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
yarn lint --fix
1+
# Get all staged files
2+
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR)
3+
4+
if [ -n "$STAGED_FILES" ]; then
5+
echo "Running lint with fix on staged files..."
6+
# Run lint on all files (modifies files in the working directory)
7+
yarn lint --fix
8+
yarn prettier:write
9+
10+
echo "Re-adding originally staged files to the staging area..."
11+
# Re-add only the originally staged files
12+
echo "$STAGED_FILES" | xargs git add
13+
else
14+
echo "No staged files to process."
15+
fi

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2024, ACM@UIUC
3+
Copyright (c) 2024-2025, ACM@UIUC
44

55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:

Makefile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ integration_test_directory_root = tests/live_integration/
1111
# CHANGE ME (as needed)
1212
application_key=infra-core-api
1313
application_name="InfraCoreApi"
14-
techlead="dsingh14@illinois.edu"
14+
techlead="tarasha2@illinois.edu"
1515
region="us-east-1"
1616

1717
# DO NOT CHANGE
@@ -24,6 +24,8 @@ common_params = --no-confirm-changeset \
2424
--s3-prefix $(application_key) \
2525
--resolve-s3
2626

27+
GIT_HASH := $(shell git rev-parse --short HEAD)
28+
2729
.PHONY: build clean
2830

2931
check_account_prod:
@@ -46,14 +48,17 @@ clean:
4648
rm -rf src/ui/node_modules/
4749
rm -rf dist/
4850
rm -rf dist_ui/
51+
rm -rf dist_devel/
4952

5053
build: src/ cloudformation/ docs/
5154
yarn -D
52-
yarn build
55+
VITE_BUILD_HASH=$(GIT_HASH) yarn build
56+
cp -r src/api/resources/ dist/api/resources
57+
rm -rf dist/lambda/sqs
5358
sam build --template-file cloudformation/main.yml
5459

5560
local:
56-
yarn run dev
61+
VITE_BUILD_HASH=$(GIT_HASH) yarn run dev
5762

5863
deploy_prod: check_account_prod build
5964
aws sts get-caller-identity --query Account --output text
@@ -62,18 +67,24 @@ deploy_prod: check_account_prod build
6267
deploy_dev: check_account_dev build
6368
sam deploy $(common_params) --parameter-overrides $(run_env)=dev $(set_application_prefix)=$(application_key) $(set_application_name)="$(application_name)"
6469

65-
install_test_deps:
70+
install:
6671
yarn -D
72+
pip install cfn-lint
6773

68-
test_live_integration: install_test_deps
74+
test_live_integration: install
6975
yarn test:live
7076

71-
test_unit: install_test_deps
77+
test_unit: install
7278
yarn typecheck
7379
yarn lint
80+
cfn-lint cloudformation/**/* --ignore-templates cloudformation/phony-swagger.yml
7481
yarn prettier
7582
yarn test:unit
7683

84+
test_e2e: install
85+
yarn playwright install
86+
yarn test:e2e
87+
7788
dev_health_check:
7889
curl -f https://$(application_key).aws.qa.acmuiuc.org/api/v1/healthz && curl -f https://manage.qa.acmuiuc.org
7990

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ACM @ UIUC Core
2-
This repository is split into two:
2+
This repository is split into multiple parts:
33
* `src/api/` for the API source code
44
* `src/ui/` for the UI source code
5-
* `src/common/` for common modules between the two (such as types)
5+
* `src/common/` for common modules between the API and the UI (such as constants, types, errors, etc.)
6+
7+
## Getting Started
8+
You will need node>=22 installed, as well as the AWS CLI and the AWS SAM CLI. The best way to work with all of this is to open the environment in a container within your IDE (VS Code should prompt you to do so: use "Clone in Container" for best performance). This container will have all needed software installed.
9+
10+
Then, run `make install` to install all packages, and `make local` to start the UI and API servers! The UI will be accessible on `http://localhost:5173/` and the API on `http://localhost:8080/`.

cloudformation/custom-domain.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Parameters:
2+
GWCertArn:
3+
Description: Certificate ARN
4+
Type: String
5+
GWBaseDomainName:
6+
Description: Base domain name
7+
Type: String
8+
GWApiId:
9+
Description: API ID
10+
Type: String
11+
GWHostedZoneId:
12+
Description: Hosted Zone ID
13+
Type: String
14+
RunEnvironment:
15+
Type: String
16+
AllowedValues: [ 'dev', 'prod' ]
17+
RecordName:
18+
Type: String
19+
20+
Conditions:
21+
IsDev: !Equals [!Ref RunEnvironment, 'dev']
22+
23+
Resources:
24+
CustomDomainName:
25+
Type: AWS::ApiGateway::DomainName
26+
Properties:
27+
RegionalCertificateArn: !Ref GWCertArn
28+
EndpointConfiguration:
29+
Types:
30+
- REGIONAL
31+
DomainName: !Sub "${RecordName}.${GWBaseDomainName}"
32+
SecurityPolicy: TLS_1_2
33+
34+
CDApiMapping:
35+
Type: 'AWS::ApiGatewayV2::ApiMapping'
36+
Properties:
37+
DomainName: !Ref CustomDomainName
38+
ApiId: !Ref GWApiId
39+
Stage: default
40+
41+
CDRoute53RecordSetDev:
42+
Condition: IsDev
43+
Type: AWS::Route53::RecordSet
44+
Properties:
45+
HostedZoneId: !Ref GWHostedZoneId
46+
Name: !Sub "${RecordName}.${GWBaseDomainName}"
47+
Type: A
48+
AliasTarget:
49+
DNSName: !GetAtt CustomDomainName.RegionalDomainName
50+
HostedZoneId: !GetAtt CustomDomainName.RegionalHostedZoneId

cloudformation/iam.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ Parameters:
1010
LambdaFunctionName:
1111
Type: String
1212
AllowedPattern: ^[a-zA-Z0-9]+[a-zA-Z0-9-]+[a-zA-Z0-9]+$
13+
SesEmailDomain:
14+
Type: String
15+
SqsQueueArn:
16+
Type: String
1317
Resources:
1418
ApiLambdaIAMRole:
1519
Type: AWS::IAM::Role
1620
Properties:
21+
ManagedPolicyArns:
22+
- arn:aws:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole
1723
AssumeRolePolicyDocument:
1824
Version: '2012-10-17'
1925
Statement:
@@ -24,6 +30,29 @@ Resources:
2430
Service:
2531
- lambda.amazonaws.com
2632
Policies:
33+
- PolicyDocument:
34+
Version: '2012-10-17'
35+
Statement:
36+
- Action:
37+
- ses:SendEmail
38+
- ses:SendRawEmail
39+
Effect: Allow
40+
Resource: "*"
41+
Condition:
42+
StringEquals:
43+
ses:FromAddress: !Sub "membership@${SesEmailDomain}"
44+
ForAllValues:StringLike:
45+
ses:Recipients:
46+
- "*@illinois.edu"
47+
PolicyName: ses-membership
48+
- PolicyDocument:
49+
Version: '2012-10-17'
50+
Statement:
51+
- Action:
52+
- sqs:SendMessage
53+
Effect: Allow
54+
Resource: !Ref SqsQueueArn
55+
PolicyName: lambda-sqs
2756
- PolicyDocument:
2857
Version: '2012-10-17'
2958
Statement:
@@ -77,6 +106,8 @@ Resources:
77106
- !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-iam-userroles/*
78107
- !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-iam-grouproles
79108
- !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-iam-grouproles/*
109+
- !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-stripe-links
110+
- !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-stripe-links/*
80111

81112
PolicyName: lambda-dynamo
82113
Outputs:
@@ -85,4 +116,4 @@ Outputs:
85116
Value:
86117
Fn::GetAtt:
87118
- ApiLambdaIAMRole
88-
- Arn
119+
- Arn

0 commit comments

Comments
 (0)