Skip to content

Commit f34aea1

Browse files
committed
feat: Add CI/CD pipeline and project configuration
- Add GitHub Actions workflow for testing and deployment - Add pyproject.toml for dependency management - Update .gitignore with comprehensive patterns - Add static/.gitkeep to track empty directory
1 parent 5f06528 commit f34aea1

File tree

3 files changed

+246
-0
lines changed

3 files changed

+246
-0
lines changed

.github/workflows/ci-cd.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
PYTHON_VERSION: '3.9'
11+
POETRY_VERSION: '1.4.0'
12+
13+
jobs:
14+
test:
15+
name: Run Tests
16+
runs-on: ubuntu-latest
17+
18+
services:
19+
# Add Redis if you implement caching later
20+
# redis:
21+
# image: redis
22+
# ports:
23+
# - 6379:6379
24+
# options: >-
25+
# --health-cmd "redis-cli ping"
26+
# --health-interval 10s
27+
# --health-timeout 5s
28+
# --health-retries 5
29+
30+
steps:
31+
- uses: actions/checkout@v3
32+
33+
- name: Set up Python ${{ env.PYTHON_VERSION }}
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: ${{ env.PYTHON_VERSION }}
37+
38+
- name: Install Poetry
39+
uses: snok/install-poetry@v1
40+
with:
41+
version: ${{ env.POETRY_VERSION }}
42+
43+
- name: Cache Poetry virtualenv
44+
uses: actions/cache@v3
45+
id: cache
46+
with:
47+
path: ~/.cache/pypoetry/virtualenvs
48+
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
49+
50+
- name: Install dependencies
51+
run: |
52+
poetry config virtualenvs.in-project true
53+
poetry install --no-interaction --no-root
54+
55+
- name: Run linting
56+
run: |
57+
poetry run black --check .
58+
poetry run flake8 .
59+
60+
- name: Run tests
61+
env:
62+
PYTHONPATH: ${{ github.workspace }}
63+
RAPIDAPI_PROXY_SECRET: test_secret_key
64+
FASTAPI_ENV: test
65+
run: |
66+
poetry run pytest -v --cov=app --cov-report=xml
67+
68+
- name: Upload coverage to Codecov
69+
uses: codecov/codecov-action@v3
70+
with:
71+
file: ./coverage.xml
72+
fail_ci_if_error: false
73+
74+
deploy:
75+
name: Deploy to Render
76+
needs: test
77+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
78+
runs-on: ubuntu-latest
79+
80+
steps:
81+
- uses: actions/checkout@v3
82+
83+
- name: Deploy to Render
84+
uses: render-oss/deploy-render@v1
85+
with:
86+
apiKey: ${{ secrets.RENDER_API_KEY }}
87+
serviceId: ${{ secrets.RENDER_SERVICE_ID }}
88+
# Uncomment and set this if you want to wait for the deployment to complete
89+
# waitForDeployment: true

.gitignore

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,75 @@ __pycache__/
33
*.py[cod]
44
*$py.class
55

6+
# Environment variables
7+
.env
8+
.env.*
9+
!.env.example
10+
11+
# Local development
12+
.venv/
13+
venv/
14+
ENV/
15+
16+
# IDE specific files
17+
.vscode/
18+
.idea/
19+
*.swp
20+
*.swo
21+
*~
22+
23+
# Local configuration
24+
local_settings.py
25+
db.sqlite3
26+
27+
# Logs
28+
*.log
29+
30+
# Coverage reports
31+
htmlcov/
32+
.coverage
33+
.coverage.*
34+
35+
# Test artifacts
36+
.pytest_cache/
37+
.mypy_cache/
38+
39+
# Build and distribution
40+
dist/
41+
build/
42+
*.egg-info/
43+
44+
# Virtual environments
45+
.env/
46+
.venv/
47+
venv/
48+
ENV/
49+
50+
# Jupyter Notebook
51+
.ipynb_checkpoints
52+
53+
# VS Code
54+
.vscode/*
55+
!.vscode/settings.json
56+
!.vscode/tasks.json
57+
!.vscode/launch.json
58+
!.vscode/extensions.json
59+
60+
# macOS
61+
.DS_Store
62+
.AppleDouble
63+
.LSOverride
64+
65+
# Windows
66+
Thumbs.db
67+
ehthumbs.db
68+
Desktop.ini
69+
$RECYCLE.BIN/
70+
71+
# Project specific
72+
static/
73+
!static/.gitkeep
74+
675
# C extensions
776
*.so
877

pyproject.toml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
[tool.poetry]
2+
name = "dev-api-vault"
3+
version = "1.0.0"
4+
description = "A comprehensive collection of developer utilities API"
5+
authors = ["Krunal Valvi <[email protected]>"]
6+
license = "MIT"
7+
readme = "README.md"
8+
packages = [{include = "app"}]
9+
10+
[tool.poetry.dependencies]
11+
python = "^3.9"
12+
fastapi = "^0.95.0"
13+
uvicorn = {extras = ["standard"], version = "^0.21.1"}
14+
pydantic = "^1.10.5"
15+
python-multipart = "^0.0.6"
16+
markdown = "^3.4.1"
17+
qrcode = "^7.4.2"
18+
Pillow = "^9.5.0"
19+
beautifulsoup4 = "^4.12.2"
20+
requests = "^2.28.2"
21+
nltk = "^3.8.1"
22+
python-dotenv = "^1.0.0"
23+
python-jose = {extras = ["cryptography"], version = "^3.3.0"}
24+
passlib = {extras = ["bcrypt"], version = "^1.7.4"}
25+
prometheus-fastapi-instrumentator = "^6.1.0"
26+
27+
[tool.poetry.group.dev.dependencies]
28+
pytest = "^7.3.1"
29+
pytest-cov = "^4.0.0"
30+
black = "^23.3.0"
31+
isort = "^5.12.0"
32+
flake8 = "^6.0.0"
33+
mypy = "^1.1.1"
34+
httpx = "^0.23.3"
35+
36+
[build-system]
37+
requires = ["poetry-core>=1.0.0"]
38+
build-backend = "poetry.core.masonry.api"
39+
40+
[tool.black]
41+
line-length = 88
42+
target-version = ['py39']
43+
include = '\.pyi?$'
44+
45+
[tool.isort]
46+
profile = "black"
47+
multi_line_output = 3
48+
include_trailing_comma = true
49+
force_grid_wrap = 0
50+
use_parentheses = true
51+
ensure_newline_before_comments = true
52+
line_length = 88
53+
54+
[tool.pytest.ini_options]
55+
testpaths = ["tests"]
56+
python_files = ["test_*.py"]
57+
python_functions = ["test_*"]
58+
addopts = "-v --cov=app --cov-report=term-missing"
59+
60+
[tool.coverage.run]
61+
source = ["app"]
62+
omit = [
63+
"**/__pycache__/*",
64+
"**/tests/*",
65+
"**/main.py",
66+
]
67+
68+
[tool.coverage.report]
69+
show_missing = true
70+
skip_covered = true
71+
72+
[metadata]
73+
name = "dev-api-vault"
74+
version = "1.0.0"
75+
description = "A comprehensive collection of developer utilities API"
76+
author = "Krunal Valvi"
77+
author_email = "[email protected]"
78+
license = "MIT"
79+
classifiers = [
80+
"Development Status :: 4 - Beta",
81+
"Intended Audience :: Developers",
82+
"License :: OSI Approved :: MIT License",
83+
"Programming Language :: Python :: 3.9",
84+
"Programming Language :: Python :: 3.10",
85+
"Programming Language :: Python :: 3.11",
86+
"Topic :: Software Development :: Libraries :: Python Modules",
87+
"Framework :: FastAPI",
88+
]

0 commit comments

Comments
 (0)