Skip to content

docs: Add 1000 Python Programs complete index with proper names #13

docs: Add 1000 Python Programs complete index with proper names

docs: Add 1000 Python Programs complete index with proper names #13

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
# Code Quality Checks
lint:
name: Code Quality
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black ruff isort
- name: Check formatting with Black
run: black --check .
- name: Lint with Ruff
run: ruff check .
- name: Check imports with isort
run: isort --check-only .
# Run Tests
test:
name: Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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
pip install pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run tests with pytest
run: |
pytest tests/ -v --cov=. --cov-report=xml --cov-report=term-missing || echo "No tests found or tests failed"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-${{ matrix.python-version }}
fail_ci_if_error: false
# Security Scan
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install Bandit
run: pip install bandit
- name: Run Bandit security scan
run: bandit -r basics/ fastapi/ rest_api/ llm_fundamentals/ -f json -o bandit-report.json || true
- name: Upload security report
uses: actions/upload-artifact@v4
with:
name: bandit-report
path: bandit-report.json
retention-days: 30
# Build Docker Image
docker:
name: Docker Build
runs-on: ubuntu-latest
needs: [lint, test]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: python-learning:latest
cache-from: type=gha
cache-to: type=gha,mode=max
# Deploy Documentation (Future)
docs:
name: Deploy Docs
runs-on: ubuntu-latest
needs: [lint, test]
if: false # Disabled until docs are set up
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to GitHub Pages
run: echo "Documentation deployment to be implemented"