Skip to content

Commit aa250ea

Browse files
committed
workflow added
1 parent af8ca5f commit aa250ea

File tree

4 files changed

+178
-0
lines changed

4 files changed

+178
-0
lines changed

.github/workflows/ci-cd.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: CI/CD Pipeline
2+
3+
# Trigger the workflow on push or pull request to the main branch
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest # The OS environment the workflow will run on
15+
16+
services:
17+
docker:
18+
image: docker:19.03.12 # Docker image to use for running Docker commands
19+
options: --privileged # Run in privileged mode to allow Docker-in-Docker
20+
ports:
21+
- 2375:2375 # Expose Docker port
22+
env:
23+
DOCKER_TLS_CERTDIR: "" # Disable Docker's TLS
24+
25+
steps:
26+
# Step 1: Checkout code from the repository
27+
- name: Checkout code
28+
uses: actions/checkout@v3
29+
30+
# Step 2: Set up Node.js for building the React app
31+
- name: Set up Node.js
32+
uses: actions/setup-node@v3
33+
with:
34+
node-version: '18' # Use Node.js version 18
35+
36+
# Step 3: Cache Node.js modules to speed up subsequent runs
37+
- name: Cache Node.js modules
38+
uses: actions/cache@v3
39+
with:
40+
path: frontend-react/node_modules # Path to cache
41+
key: ${{ runner.os }}-node-${{ hashFiles('**/frontend-react/package-lock.json') }}
42+
restore-keys: |
43+
${{ runner.os }}-node/ # Restore cache if available
44+
45+
# Step 4: Install Node.js dependencies and build the React app
46+
- name: Install dependencies and build React app
47+
working-directory: ./frontend-react
48+
run: |
49+
npm ci # Install dependencies using package-lock.json
50+
npm run build # Build the React app
51+
52+
# Step 5: Set up Python for the FastAPI backend
53+
- name: Set up Python
54+
uses: actions/setup-python@v3
55+
with:
56+
python-version: '3.11' # Use Python version 3.11
57+
58+
# Step 6: Install Python dependencies for the FastAPI backend
59+
- name: Install dependencies for FastAPI
60+
run: |
61+
python -m pip install --upgrade pip # Upgrade pip
62+
pip install -r requirements.txt # Install dependencies from requirements.txt
63+
64+
# Step 7: Run pytest tests for the FastAPI backend
65+
- name: Run pytest tests
66+
run: |
67+
pytest --maxfail=1 --disable-warnings # Run pytest, stop at first failure
68+
69+
# Step 8: Log in to Docker Hub
70+
# Use Docker credentials stored in GitHub Secrets to log in
71+
- name: Log in to Docker Hub
72+
uses: docker/login-action@v2
73+
with:
74+
username: ${{ secrets.DOCKER_USERNAME }} # Docker Hub username stored in secrets
75+
password: ${{ secrets.DOCKER_PASSWORD }} # Docker Hub password stored in secrets
76+
77+
# Step 9: Build and push Docker image
78+
# This step builds the Docker image from the Dockerfile and pushes it to Docker Hub
79+
- name: Build and push Docker image
80+
run: |
81+
docker build -t ${{ secrets.DOCKER_USERNAME }}/fullstack-app:latest . # Build the Docker image
82+
docker push ${{ secrets.DOCKER_USERNAME }}/fullstack-app:latest # Push the image to Docker Hub
83+
84+
# Step 10: Notify of a successful build
85+
# This step outputs a success message if the Docker build and push steps succeed
86+
- name: Build Success Notification
87+
run: echo "Docker image has been built and pushed successfully."
88+
89+
deploy:
90+
runs-on: ubuntu-latest # The OS environment for deployment
91+
needs: build # Ensure the deployment job runs only after the build job
92+
93+
steps:
94+
# Step 11: Checkout code from the repository
95+
- name: Checkout code
96+
uses: actions/checkout@v3
97+
98+
# Step 12: Pull and run the Docker container for the application
99+
# This step pulls the built Docker image and runs it on the server
100+
- name: Deploy Application
101+
run: |
102+
docker pull ${{ secrets.DOCKER_USERNAME }}/fullstack-app:latest # Pull the latest image from Docker Hub
103+
docker run -d -p 8000:8000 --name fullstack-app ${{ secrets.DOCKER_USERNAME }}/fullstack-app:latest # Run the app in a container

.github/workflows/cicd-main.yml

Whitespace-only changes.

.github/workflows/main.yml

Whitespace-only changes.

pyproject.toml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
[tool.poetry]
2+
name = "Indian-Tax-Advisor" # Replace with your project's name
3+
version = "0.1.0" # Specify your project's version
4+
description = "A FastAPI application with a React frontend" # Short description of your project
5+
authors = ["Mohit Kumar <mohitpanghal12345@gmail.com>"]
6+
license = "MIT" # Specify the license type
7+
8+
[tool.poetry.dependencies]
9+
# FastAPI and its dependencies
10+
fastapi = "^0.115.0"
11+
uvicorn = "^0.31.0"
12+
13+
# Other dependencies
14+
aiohttp = "^3.10.9"
15+
boto3 = "^1.35.34"
16+
sqlalchemy = "^2.0.35"
17+
requests = "^2.32.3"
18+
python-dotenv = "^1.0.1"
19+
pydantic = "^2.9.2"
20+
pytest = "^8.3.3" # Testing framework
21+
22+
# Additional dependencies based on your requirements
23+
aiohappyeyeballs = "2.4.3"
24+
aiosignal = "1.3.1"
25+
attrs = "24.2.0"
26+
botocore = "1.35.34"
27+
certifi = "2024.8.30"
28+
charset-normalizer = "3.3.2"
29+
click = "8.1.7"
30+
colorama = "0.4.6"
31+
dataclasses-json = "0.6.7"
32+
faiss-cpu = "1.8.0.post1"
33+
frozenlist = "1.4.1"
34+
greenlet = "3.1.1"
35+
h11 = "0.14.0"
36+
httpcore = "1.0.6"
37+
httpx = "0.27.2"
38+
idna = "3.10"
39+
iniconfig = "2.0.0"
40+
jmespath = "1.0.1"
41+
jsonpatch = "1.33"
42+
jsonpointer = "3.0.0"
43+
langchain = "0.3.2"
44+
langchain-aws = "0.2.2"
45+
langchain-community = "0.3.1"
46+
langchain-core = "0.3.9"
47+
langchain-text-splitters = "0.3.0"
48+
langsmith = "0.1.131"
49+
marshmallow = "3.22.0"
50+
multidict = "6.1.0"
51+
mypy-extensions = "1.0.0"
52+
numpy = "1.26.4"
53+
orjson = "3.10.7"
54+
packaging = "24.1"
55+
pluggy = "1.5.0"
56+
pyasn1 = "0.6.1"
57+
pydantic-settings = "2.5.2"
58+
pydantic-core = "2.23.4"
59+
pypdf = "5.0.1"
60+
six = "1.16.0"
61+
sniffio = "1.3.1"
62+
tenacity = "8.5.0"
63+
typing-inspect = "0.9.0"
64+
typing_extensions = "4.12.2"
65+
urllib3 = "2.2.3"
66+
yarl = "1.13.1"
67+
68+
[tool.poetry.dev-dependencies]
69+
# Development dependencies for testing
70+
pytest = "^8.3.3"
71+
# Add additional dev dependencies as needed...
72+
73+
[build-system]
74+
requires = ["poetry-core>=1.0.0"] # Specify the minimum version of poetry-core
75+
build-backend = "poetry.core.masonry.api" # Build backend to use

0 commit comments

Comments
 (0)