-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (80 loc) · 3.08 KB
/
Copy pathazure-dev-python-AI-deploy.yml
File metadata and controls
99 lines (80 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: staging - Embedding Service deployment
on:
pull_request:
branches: ['main']
push:
branches: ['main']
env:
PYTHON_VERSION: "3.13"
jobs:
# CI job - runs for PRs to main
ci:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install fastembed fastapi uvicorn pydantic pytest flake8 black
- name: Code formatting check
run: |
black --check python-embedding/ || echo "Code formatting issues found"
- name: Lint code
run: |
flake8 python-embedding/ --count --select=E9,F63,F7,F82 --show-source --statistics || echo "Linting issues found"
- name: Run tests
run: |
# Add your test commands here
python -m pytest python-embedding/tests/ || echo "No tests found or tests failed"
- name: Build verification
run: |
mkdir -p build
pip install --target build fastembed fastapi uvicorn pydantic
cp python-embedding/*.py build/
cp python-embedding/requirements.txt build/
echo "✅ Build verification completed successfully"
# Deploy job - runs when PR is merged to main (push to main)
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run CI checks before deployment
run: |
pip install --upgrade pip
pip install fastembed fastapi uvicorn pydantic pytest flake8 black
echo "Running pre-deployment CI checks..."
black --check python-embedding/ || echo "Code formatting issues found"
flake8 python-embedding/ --count --select=E9,F63,F7,F82 --show-source --statistics || echo "Linting issues found"
python -m pytest python-embedding/tests/ || echo "No tests found or tests failed"
- name: Build application for deployment
run: |
mkdir -p build
pip install --target build fastembed fastapi uvicorn pydantic
cp python-embedding/*.py build/
cp python-embedding/requirements.txt build/
- name: Zip application for deployment
run: |
cd build
zip -r ../python-embedding.zip .
- name: Deploy to Azure Web App (Linux)
uses: azure/webapps-deploy@v3
with:
app-name: python-AI-model
publish-profile: ${{ secrets.AZURE_PYTHON_MODEL_PUBLISH_PROFILE }}
package: python-embedding.zip
- name: Post-deployment verification
run: |
echo "✅ Deployment completed successfully"
echo "Application deployed to Azure Web App: python-AI-model"