Skip to content

Commit 1a0f7e9

Browse files
committed
Merge branch 'develop'
2 parents 93d8b47 + 79a4c9e commit 1a0f7e9

22 files changed

Lines changed: 3083 additions & 1030 deletions

.github/workflows/ci-cd.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
# Code Quality Checks
12+
lint:
13+
name: Code Quality
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.11'
23+
cache: 'pip'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install black ruff isort
29+
30+
- name: Check formatting with Black
31+
run: black --check .
32+
33+
- name: Lint with Ruff
34+
run: ruff check .
35+
36+
- name: Check imports with isort
37+
run: isort --check-only .
38+
39+
# Run Tests
40+
test:
41+
name: Tests (Python ${{ matrix.python-version }})
42+
runs-on: ubuntu-latest
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
python-version: ['3.10', '3.11', '3.12']
47+
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
52+
- name: Set up Python ${{ matrix.python-version }}
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: ${{ matrix.python-version }}
56+
cache: 'pip'
57+
58+
- name: Install dependencies
59+
run: |
60+
python -m pip install --upgrade pip
61+
pip install pytest pytest-cov
62+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
63+
64+
- name: Run tests with pytest
65+
run: |
66+
pytest tests/ -v --cov=. --cov-report=xml --cov-report=term-missing || echo "No tests found or tests failed"
67+
68+
- name: Upload coverage to Codecov
69+
uses: codecov/codecov-action@v3
70+
with:
71+
file: ./coverage.xml
72+
flags: unittests
73+
env_vars: OS,PYTHON
74+
name: codecov-${{ matrix.python-version }}
75+
fail_ci_if_error: false
76+
77+
# Security Scan
78+
security:
79+
name: Security Scan
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Checkout code
83+
uses: actions/checkout@v4
84+
85+
- name: Set up Python
86+
uses: actions/setup-python@v5
87+
with:
88+
python-version: '3.11'
89+
cache: 'pip'
90+
91+
- name: Install Bandit
92+
run: pip install bandit
93+
94+
- name: Run Bandit security scan
95+
run: bandit -r basics/ fastapi/ rest_api/ llm_fundamentals/ -f json -o bandit-report.json || true
96+
97+
- name: Upload security report
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: bandit-report
101+
path: bandit-report.json
102+
retention-days: 30
103+
104+
# Build Docker Image
105+
docker:
106+
name: Docker Build
107+
runs-on: ubuntu-latest
108+
needs: [lint, test]
109+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
110+
111+
steps:
112+
- name: Checkout code
113+
uses: actions/checkout@v4
114+
115+
- name: Set up Docker Buildx
116+
uses: docker/setup-buildx-action@v3
117+
118+
- name: Build Docker image
119+
uses: docker/build-push-action@v5
120+
with:
121+
context: .
122+
push: false
123+
tags: python-learning:latest
124+
cache-from: type=gha
125+
cache-to: type=gha,mode=max
126+
127+
# Deploy Documentation (Future)
128+
docs:
129+
name: Deploy Docs
130+
runs-on: ubuntu-latest
131+
needs: [lint, test]
132+
if: false # Disabled until docs are set up
133+
steps:
134+
- name: Checkout code
135+
uses: actions/checkout@v4
136+
137+
- name: Deploy to GitHub Pages
138+
run: echo "Documentation deployment to be implemented"
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Code Quality Report
2+
3+
on:
4+
pull_request:
5+
branches: [main, develop]
6+
7+
jobs:
8+
quality-report:
9+
name: Generate Quality Report
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.11'
23+
cache: 'pip'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install black ruff pytest
29+
30+
- name: Run Black check
31+
run: black --check . 2>&1 | tee black-output.txt || true
32+
33+
- name: Run Ruff check
34+
run: ruff check . 2>&1 | tee ruff-output.txt || true
35+
36+
- name: Run tests
37+
run: pytest tests/ -v 2>&1 | tee pytest-output.txt || true
38+
39+
- name: Generate summary report
40+
run: |
41+
echo "## Code Quality Report" > report.md
42+
echo "" >> report.md
43+
echo "### Black Formatting" >> report.md
44+
if grep -q "would reformat" black-output.txt; then
45+
echo "❌ Some files need formatting" >> report.md
46+
else
47+
echo "✅ All files are properly formatted" >> report.md
48+
fi
49+
echo "" >> report.md
50+
echo "### Ruff Linting" >> report.md
51+
if [ -s ruff-output.txt ]; then
52+
echo "❌ Linting issues found:" >> report.md
53+
cat ruff-output.txt >> report.md
54+
else
55+
echo "✅ No linting issues" >> report.md
56+
fi
57+
echo "" >> report.md
58+
echo "### Tests" >> report.md
59+
if grep -q "passed" pytest-output.txt; then
60+
echo "✅ Tests passing" >> report.md
61+
else
62+
echo "⚠️ No tests or tests failed" >> report.md
63+
fi
64+
65+
- name: Comment PR with report
66+
uses: actions/github-script@v7
67+
with:
68+
script: |
69+
const fs = require('fs');
70+
const report = fs.readFileSync('report.md', 'utf8');
71+
github.rest.issues.createComment({
72+
issue_number: context.issue.number,
73+
owner: context.repo.owner,
74+
repo: context.repo.repo,
75+
body: report
76+
});

.gitignore

Lines changed: 72 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,91 @@
1-
# ==========================
2-
# macOS system files
3-
# ==========================
4-
.DS_Store
5-
.AppleDouble
6-
.LSOverride
7-
8-
# Thumbnails
9-
._*
10-
.Spotlight-V100
11-
.Trashes
12-
13-
# ==========================
14-
# Windows system files
15-
# ==========================
16-
Thumbs.db
17-
ehthumbs.db
18-
Desktop.ini
19-
$RECYCLE.BIN/
20-
21-
# ==========================
22-
# Python cache / compiled files
23-
# ==========================
1+
# Python
242
__pycache__/
253
*.py[cod]
264
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
pip-wheel-metadata/
20+
share/python-wheels/
21+
*.egg-info/
22+
.installed.cfg
23+
*.egg
24+
MANIFEST
2725

28-
# ==========================
2926
# Virtual environments
30-
# ==========================
3127
venv/
32-
env/
33-
.venv/
3428
ENV/
29+
env/
30+
.venv
3531

36-
# ==========================
37-
# IDE/editor files
38-
# ==========================
39-
# VS Code
32+
# IDE
4033
.vscode/
41-
# PyCharm
4234
.idea/
43-
*.iml
44-
# Sublime Text
45-
*.sublime-project
46-
*.sublime-workspace
47-
# Emacs
48-
*~
49-
# Vim
5035
*.swp
36+
*.swo
37+
*~
38+
.DS_Store
5139

52-
# ==========================
53-
# Local config / secrets / instance folders
54-
# ==========================
55-
instance/
56-
config.ini
57-
*.env
58-
secrets.json
40+
# Testing
41+
.pytest_cache/
42+
.coverage
43+
htmlcov/
44+
.tox/
45+
.nox/
5946

60-
# ==========================
61-
# Data / model files
62-
# ==========================
63-
gpt2/
64-
*.h5
65-
*.pt
66-
*.ckpt
67-
*.model
68-
*.bin
69-
*.csv
70-
*.tsv
47+
# myPy
48+
.mypy_cache/
49+
.dmypy.json
50+
dmypy.json
51+
52+
# Jupyter Notebook
53+
.ipynb_checkpoints
7154

72-
# Keep data/ folder but ignore large model files
73-
data/*.pt
74-
data/*.bin
75-
data/*.model
55+
# pyenv
56+
.python-version
7657

77-
# ==========================
78-
# Logs and temporary files
79-
# ==========================
58+
# Environment variables
59+
.env
60+
.env.local
61+
.env.*.local
62+
63+
# Logs
8064
*.log
81-
*.tmp
82-
*.bak
83-
*.cache
84-
*.pid
85-
*.seed
86-
*.swp
87-
*.swo
65+
logs/
8866

89-
# ==========================
90-
# Git-specific
91-
# ==========================
92-
*.orig
93-
*.rej
67+
# Database
68+
*.db
69+
*.sqlite
70+
*.sqlite3
9471

95-
# ==========================
96-
# Jupyter Notebook / IPython
97-
# ==========================
98-
.ipynb_checkpoints
99-
*.ipynb
72+
# Machine Learning
73+
*.h5
74+
*.pkl
75+
*.pth
76+
*.pt
77+
*.ckpt
78+
*.onnx
79+
*.model
80+
gpt2/
81+
models/
10082

101-
# ==========================
102-
# Build / distribution
103-
# ==========================
104-
build/
105-
dist/
106-
*.egg-info/
107-
*.egg
108-
*.whl
109-
pip-wheel-metadata/
83+
# Large data files
84+
data/*.csv
85+
data/*.json
86+
data/*.txt
87+
!data/.gitkeep
88+
89+
# OS
90+
Thumbs.db
91+
.DS_Store

0 commit comments

Comments
 (0)