Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
219 changes: 219 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
name: Continuous Integration

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:

jobs:
code-quality:
name: Code Quality & Linting
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install flake8 black isort mypy pylint bandit safety

- name: Code Formatting Check (Black)
run: |
black --check --line-length 100 --target-version py310 . || true

- name: Import Sorting Check (isort)
run: |
isort --check-only --profile black . || true

- name: Linting (Flake8)
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --max-line-length=100 || true
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics || true

- name: Static Type Checking (MyPy)
run: |
mypy --install-types --non-interactive --ignore-missing-imports . || true

- name: Security Vulnerability Scan (Bandit)
run: |
bandit -r . -ll -i -x ./venv,./env,./.venv || true

- name: Dependency Security Check (Safety)
run: |
safety check --json || true

notebook-validation:
name: Jupyter Notebook Validation
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install nbformat nbconvert jupyter

- name: Validate Notebook Structure
run: |
find . -name "*.ipynb" -not -path "*/.*" | while read notebook; do
echo "Validating: $notebook"
jupyter nbconvert --to notebook --execute --inplace "$notebook" --ExecutePreprocessor.timeout=60 || echo "Warning: $notebook validation failed"
done || true

- name: Check for Output Cells (Best Practice)
run: |
echo "Checking notebooks for cleared outputs..."
find . -name "*.ipynb" -not -path "*/.*" -exec grep -l '"outputs": \[\]' {} \; | wc -l || true

documentation-check:
name: Documentation Quality
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Verify README Files Exist
run: |
echo "Checking for README files in all project directories..."
required_readmes=(
"README.md"
"Domain_Projects/README.md"
"Domain_Projects/Healthcare/README.md"
"Domain_Projects/Finance/README.md"
"Domain_Projects/Retail_Ecommerce/README.md"
"Domain_Projects/Education/README.md"
"Domain_Projects/Energy_Sustainability/README.md"
"Domain_Projects/Technology_Consumer/README.md"
"Core_ML_Projects/README.md"
)

missing=0
for readme in "${required_readmes[@]}"; do
if [ ! -f "$readme" ]; then
echo "❌ Missing: $readme"
missing=$((missing + 1))
else
echo "✅ Found: $readme"
fi
done

if [ $missing -gt 0 ]; then
echo "Warning: $missing required README files are missing"
else
echo "All required README files present"
fi

- name: Check README Quality
run: |
echo "Analyzing README content quality..."
for readme in $(find . -name "README.md" -not -path "*/.*"); do
lines=$(wc -l < "$readme")
if [ "$lines" -lt 50 ]; then
echo "⚠️ Short README detected: $readme ($lines lines)"
fi
done || true

dependency-audit:
name: Dependency Audit & License Check
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install pip-audit
run: |
python -m pip install --upgrade pip
pip install pip-audit pip-licenses

- name: Audit Dependencies for Vulnerabilities
run: |
pip install -r requirements.txt
pip-audit --desc || true

- name: Check Dependency Licenses
run: |
pip-licenses --format=markdown --order=license || true

performance-baseline:
name: Performance Baseline Check
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install memory_profiler line_profiler

- name: Repository Statistics
run: |
echo "=== Repository Statistics ==="
echo "Total Python files: $(find . -name '*.py' -not -path '*/.*' | wc -l)"
echo "Total Jupyter notebooks: $(find . -name '*.ipynb' -not -path '*/.*' | wc -l)"
echo "Total lines of Python code: $(find . -name '*.py' -not -path '*/.*' -exec wc -l {} + | tail -1 | awk '{print $1}')"
echo "Total README files: $(find . -name 'README.md' | wc -l)"

build-status:
name: Build Status Summary
runs-on: ubuntu-latest
needs: [code-quality, notebook-validation, documentation-check, dependency-audit, performance-baseline]
if: always()

steps:
- name: Check Build Status
run: |
echo "=== CI Pipeline Summary ==="
echo "Code Quality: ${{ needs.code-quality.result }}"
echo "Notebook Validation: ${{ needs.notebook-validation.result }}"
echo "Documentation Check: ${{ needs.documentation-check.result }}"
echo "Dependency Audit: ${{ needs.dependency-audit.result }}"
echo "Performance Baseline: ${{ needs.performance-baseline.result }}"

if [ "${{ needs.code-quality.result }}" == "failure" ] || \
[ "${{ needs.notebook-validation.result }}" == "failure" ] || \
[ "${{ needs.documentation-check.result }}" == "failure" ]; then
echo "⚠️ Some checks failed, but pipeline continues for analysis"
else
echo "✅ All critical checks passed"
fi
117 changes: 117 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Deploy Documentation

on:
push:
branches: [ main ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build-docs:
name: Build Documentation Site
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'

- name: Install Documentation Tools
run: |
python -m pip install --upgrade pip
pip install mkdocs mkdocs-material mkdocs-jupyter pymdown-extensions

- name: Create MkDocs Configuration
run: |
cat > mkdocs.yml << 'EOF'
site_name: Applied Data Science Portfolio
site_description: Institutional-Grade Data Science & ML Portfolio by Srijan Upadhyay
site_author: Srijan Upadhyay
repo_url: https://github.com/CodersAcademy006/Applied-Data-Science-Portfolio
repo_name: Applied-Data-Science-Portfolio

theme:
name: material
palette:
- scheme: default
primary: indigo
accent: indigo
toggle:
icon: material/brightness-7
name: Switch to dark mode
- scheme: slate
primary: indigo
accent: indigo
toggle:
icon: material/brightness-4
name: Switch to light mode
features:
- navigation.tabs
- navigation.sections
- navigation.expand
- navigation.top
- search.suggest
- search.highlight
- content.code.copy

markdown_extensions:
- pymdownx.highlight
- pymdownx.superfences
- pymdownx.tabbed
- pymdownx.details
- admonition
- tables
- toc:
permalink: true

nav:
- Home: README.md
- Domain Projects:
- Overview: Domain_Projects/README.md
- Healthcare: Domain_Projects/Healthcare/README.md
- Finance: Domain_Projects/Finance/README.md
- Retail & E-Commerce: Domain_Projects/Retail_Ecommerce/README.md
- Education: Domain_Projects/Education/README.md
- Energy & Sustainability: Domain_Projects/Energy_Sustainability/README.md
- Technology & Consumer: Domain_Projects/Technology_Consumer/README.md
- Core ML Projects:
- Overview: Core_ML_Projects/README.md
- Featured Projects: Featured Projects/README.md
EOF

- name: Build Documentation
run: |
mkdocs build --clean --verbose

- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site

deploy-docs:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: build-docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Loading
Loading