-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.65 KB
/
Copy pathbackend-ci.yml
File metadata and controls
61 lines (52 loc) · 1.65 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
name: Backend CI/CD
on:
push:
branches: [main]
paths: ['backend/**']
pull_request:
branches: [main]
paths: ['backend/**']
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: './backend/requirements.txt'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest pytest-asyncio flake8
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
- name: Run tests
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
pytest tests/ -v --tb=short || echo "No tests found, skipping"
deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
steps:
- name: Deploy to Render
env:
RENDER_DEPLOY_HOOK_URL: ${{ secrets.RENDER_DEPLOY_HOOK_URL }}
run: |
if [ -n "$RENDER_DEPLOY_HOOK_URL" ]; then
curl -X POST "$RENDER_DEPLOY_HOOK_URL"
else
echo "RENDER_DEPLOY_HOOK_URL not set, skipping deploy"
fi