Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
84e08ad
Update main.py
PandaBroRepo Mar 20, 2025
ab0d8ef
Add Pylint configuration file
Mar 20, 2025
05e17af
Move verify_password, get_password_hash, create_access_token, SECRET_…
jiayiliu0111 Mar 22, 2025
b8620c4
Add auth.repository for managing data access for user entities, apply…
jiayiliu0111 Mar 24, 2025
2f69d18
Create auth.service. Move username and email check for creating users…
jiayiliu0111 Mar 24, 2025
82a2499
Move UserCreate and UserResponse class, authenticate_user(), create_u…
jiayiliu0111 Mar 24, 2025
2997dbd
Authentication dependencies for FastAPI dependency injection.
jiayiliu0111 Mar 24, 2025
7e84c8c
Save changes
jiayiliu0111 Mar 24, 2025
49b1551
Refactor client_service to adhere SOLID principles
Mar 25, 2025
8c92514
Refactor Router at Client part to adhere SOLID Princeples
Mar 25, 2025
3fe52c9
add new models
Mar 26, 2025
31b5a9b
Added 3 API endpoints in router.py
PandaBroRepo Mar 26, 2025
0afae89
Merge pull request #1 from wuwulingling/Jason_Branch
qilin7000 Mar 26, 2025
74b1236
moved 3 pkl files into Service folder
PandaBroRepo Mar 26, 2025
d81ca47
Merge pull request #2 from wuwulingling/Jason_Branch
qilin7000 Mar 26, 2025
9d9c3f8
Use get_password_hash from auth.security
jiayiliu0111 Mar 26, 2025
8135f7e
API tested
Mar 26, 2025
80c627e
admin_user is always existed
jiayiliu0111 Mar 26, 2025
3eb07b2
functions are moved from auth.router to auth.dependencies
jiayiliu0111 Mar 26, 2025
31d5412
Merge branch 'main' into Richard_Dev
rcyangg Mar 26, 2025
24999f0
Merge pull request #3 from wuwulingling/Richard_Dev
rcyangg Mar 26, 2025
3980ee0
Add pyproject.toml file and .env file
Mar 26, 2025
18b2c01
Merge pull request #4 from wuwulingling/Richard_Dev
rcyangg Mar 26, 2025
6c0f167
Deal with merge conflicts in client.router
jiayiliu0111 Mar 26, 2025
7227e40
Merge pull request #5 from wuwulingling/Jiayi_Branch
jiayiliu0111 Mar 26, 2025
69e9b1b
Revert the changes in client.router
jiayiliu0111 Mar 26, 2025
a33984d
Merge pull request #6 from wuwulingling/Jiayi_Branch
jiayiliu0111 Mar 26, 2025
d666f4c
Update the pyproject.toml and .env files
Mar 26, 2025
b03d9d0
Merge pull request #7 from wuwulingling/Richard_Dev
rcyangg Mar 26, 2025
7837471
Fix the pickled model consistency problem
Mar 26, 2025
ddf4ab1
Delete import of get_prediction_service from client.router
jiayiliu0111 Mar 26, 2025
5610b30
Merge pull request #8 from wuwulingling/Jiayi_Branch
jiayiliu0111 Mar 26, 2025
8ff7f31
Add docker-compose.yml
jiayiliu0111 Apr 3, 2025
a51b077
Update README
jiayiliu0111 Apr 3, 2025
d6c094f
Merge pull request #23 from wuwulingling/Jiayi_Branch
jiayiliu0111 Apr 3, 2025
05849fc
Updated CI Pipeline
PandaBroRepo Apr 8, 2025
62962ec
Merge pull request #32 from wuwulingling/Jason_Branch
PandaBroRepo Apr 8, 2025
b275fed
Added Code Formatter black
PandaBroRepo Apr 9, 2025
9635738
Merge pull request #33 from wuwulingling/Jason_Branch
PandaBroRepo Apr 9, 2025
a859cac
resolve conflict in get_clients function
Apr 9, 2025
5ec4edd
Add Docker CI steps
Apr 9, 2025
03c885b
cd.yml changed
Apr 9, 2025
1f13bfe
cd.yml changed
Apr 9, 2025
bda3d73
pkl files path changed
Apr 9, 2025
64dccfb
fixed multiple files
Apr 9, 2025
78e2363
Test AWS EC2 deployment
Apr 15, 2025
5da294c
Add new swagger component for test
Apr 15, 2025
f9cc733
Update cd.yml
Apr 15, 2025
395ba06
Update cd.yml
Apr 15, 2025
eb29e55
Merge pull request #34 from wuwulingling/Richard_Dev
rcyangg Apr 15, 2025
263c4ca
remove unsupported pylint options
Apr 16, 2025
1e2ac05
remove unsupported pylint options
Apr 16, 2025
87cbd06
fixed ci.yml
Apr 16, 2025
ea91a94
format code with black
Apr 16, 2025
eb32ed8
updated black version
Apr 16, 2025
2e9920b
update CI pipeline
Apr 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Database Configuration
DATABASE_URL="sqlite:///./sql_app.db"
# For PostgreSQL: DATABASE_URL="postgresql://username:password@localhost:5432/dbname"

# Security
SECRET_KEY="your-secret-key-here"
ALGORITHM="HS256"
ACCESS_TOKEN_EXPIRE_MINUTES=30

# Application Settings
DEBUG=1
ENVIRONMENT="development"

# Default Admin User
ADMIN_USERNAME="admin"
ADMIN_PASSWORD="admin123"
45 changes: 29 additions & 16 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: CI/CD Pipeline

on:
push:
branches: [master, main]
branches:
- master
- main
pull_request:
branches: [master, main]
branches:
- master
- main

jobs:
test:
Expand All @@ -28,20 +32,29 @@ jobs:
python -m pytest tests/

deploy:
needs: test # This ensures deploy only runs if tests pass
runs-on: ubuntu-latest
needs: test

steps:
- uses: actions/checkout@v4

- name: Build Docker image
run: docker build -t common-assessment-tool .

- name: Run Docker container
run: |
docker run -d -p 8000:8000 common-assessment-tool
sleep 10 # Wait for container to start

- name: Test Docker container
run: |
curl http://localhost:8000/docs
- name: Checkout Code
uses: actions/checkout@v3

- name: Set Up SSH Key
shell: bash
run: |
echo "${{ secrets.EC2_KEY }}" > ~/my-common-assessment-tool.pem
chmod 600 ~/my-common-assessment-tool.pem

- name: Deploy Code
shell: bash
run: |
# Copy all project files to the EC2 instance
scp -o StrictHostKeyChecking=no -i ~/my-common-assessment-tool.pem -r ./* ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:/home/${{ secrets.EC2_USER }}/CommonAssessmentTool/

# SSH into the EC2 instance and deploy with cleanup
ssh -o StrictHostKeyChecking=no -i ~/my-common-assessment-tool.pem ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "
cd /home/${{ secrets.EC2_USER }}/CommonAssessmentTool &&
sudo docker-compose down -v &&
sudo docker system prune -f --volumes &&
sudo docker-compose up --build -d
"
53 changes: 48 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,84 @@ name: Python CI Pipeline

on:
push:
branches: [master, main]
branches: [main, master]
pull_request:
branches: [master, main]


jobs:
test:
build:
runs-on: ubuntu-latest # Use the latest Ubuntu runner

steps:
# Step 1: Checkout the code from the repository
- name: Checkout Code
uses: actions/checkout@v4 # Checkout the repository

# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v5 # Set up Python environment
with:
python-version: "3.11"

# Step 3: Install project dependencies, linters, formatters, and testing tools
- name: Install dependencies
run: |
python -m pip install --upgrade pip # Upgrade pip to the latest version
pip install setuptools wheel
pip install -r requirements.txt # Install dependencies from requirements.txt
pip install pylint pytest
pip install pylint pytest black

# Step 4: Run code quality checks with pylint
- name: Lint with pylint
run: |
pylint app/ tests/ --exit-zero

# Step 5: Check code formatting with black
- name: Check code formatting with black
run: |
black --check app/ tests/

# Step 6: Run tests with pytest
- name: Run Tests
run: |
python -m pytest tests/
pytest tests/

# Step 7: Lint Dockerfile syntax (optional)
- name: Lint Dockerfile syntax
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: ./Dockerfile

# Step 8: Build Docker Image
- name: Build Docker Image
run: docker build -t case-management-api .

# Step 9: Run Docker Container
- name: Run Docker Container
run: |
docker run -d -p 8000:8000 --name test-container case-management-api
sleep 5

# Step 10: Test API Endpoint
- name: Test API Endpoint
run: curl --fail http://localhost:8000/docs

# Step 11: Cleanup Docker Container
- name: Cleanup Docker Container
run: |
docker stop test-container
docker rm test-container

# Step 12: Print Success Message
- name: Print Success Message
if: success() # Only runs if previous steps are successful
run: |
echo "CI Pipeline completed successfully!"
echo "========================"
echo "✓ Code checked out"
echo "✓ Python environment set up"
echo "✓ Dependencies installed"
echo "✓ Linting and formatting completed"
echo "✓ Tests executed"
echo "✓ Linting completed"
echo "========================"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.venv
venv/
env/
.env


# IDE and System
.idea
Expand Down
Loading