Skip to content

feat: Complete production-ready AI voice assistant implementation #1

feat: Complete production-ready AI voice assistant implementation

feat: Complete production-ready AI voice assistant implementation #1

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main, develop, 'claude/**' ]
pull_request:
branches: [ main, develop ]
env:
PYTHON_VERSION: '3.11'
DOCKER_IMAGE: ai-voice-assistant
REGISTRY: ghcr.io
jobs:
lint-and-test:
name: Lint and Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install flake8 black isort mypy
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Check code formatting with black
run: |
black --check --diff .
- name: Check import sorting with isort
run: |
isort --check-only --diff .
- name: Run tests with pytest
env:
FLASK_ENV: testing
AI_PROVIDER: openai
OPENAI_API_KEY: test-key-12345
run: |
pytest test_app.py -v --cov=. --cov-report=xml --cov-report=html
- name: Upload coverage reports
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run security scan with Bandit
run: |
pip install bandit
bandit -r . -f json -o bandit-report.json || true
- name: Run dependency check
run: |
pip install safety
safety check --json || true
docker-build:
name: Build Docker Image
runs-on: ubuntu-latest
needs: [lint-and-test, security-scan]
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: ${{ env.DOCKER_IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test Docker image
run: |
docker run --rm -d -p 5000:5000 \
-e OPENAI_API_KEY=test-key \
-e AI_PROVIDER=openai \
--name test-container \
${{ env.DOCKER_IMAGE }}:latest
sleep 10
curl --fail http://localhost:5000/health || exit 1
docker stop test-container
deploy:
name: Deploy to Production
runs-on: ubuntu-latest
needs: [docker-build]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ github.repository }}:latest
${{ env.REGISTRY }}/${{ github.repository }}:${{ github.sha }}
- name: Deploy notification
run: |
echo "Deployment successful! 🚀"
echo "Image: ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.sha }}"