Repository navigation
116 lines (100 loc) · 3.47 KB
/
Copy pathci.yml
File metadata and controls
116 lines (100 loc) · 3.47 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: CI – Run Tests
on:
push:
branches: ["main", "master"]
pull_request:
branches: ["main", "master"]
jobs:
test:
name: pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r backend/requirements.txt
pip install pytest pytest-cov
pip install flask-wtf bleach Pillow beautifulsoup4 "pydantic[email]" pytest pytest-cov
- name: Run pytest
env:
GOOGLE_BOOKS_API_KEY: "ci-fake-key"
OPENAI_API_KEY: "ci-fake-key"
GROQ_API_KEY: "ci-fake-key"
GEMINI_API_KEY: "ci-fake-key"
FLASK_ENV: testing
PYTHONPATH: ".:backend"
run: |
python -m pytest tests/ \
--ignore=tests/test_llm.py \
--ignore=tests/test_mood_improvements.py \
--ignore=tests/test_mood_cache_db.py \
--ignore=tests/test_category_cache.py \
--ignore=tests/test_env_validation.py \
--ignore=tests/test_purchase_links.py \
-v --tb=short --cov=backend
- name: Install dependencies
run: |
pip install --upgrade pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -r backend/requirements.txt
pip install flask-wtf bleach Pillow pytest pytest-cov
- name: Install dependencies
run: |
pip install --upgrade pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -r backend/requirements.txt
pip install flask-wtf bleach Pillow beautifulsoup4 pytest pytest-cov
e2e:
name: Cypress E2E
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install backend dependencies
run: |
pip install --upgrade pip
pip install -r backend/requirements.txt
pip install flask-wtf bleach Pillow beautifulsoup4 "pydantic[email]" pytest pytest-cov
- name: Start backend server
env:
GOOGLE_BOOKS_API_KEY: "ci-fake-key"
OPENAI_API_KEY: "ci-fake-key"
GROQ_API_KEY: "ci-fake-key"
GEMINI_API_KEY: "ci-fake-key"
JWT_SECRET_KEY: "ci-fake-jwt-secret-key-that-is-at-least-32-bytes"
DATABASE_URL: "sqlite:///:memory:"
FLASK_ENV: testing
PYTHONPATH: ".:backend"
run: |
nohup python backend/app.py > backend.log 2>&1 &
sleep 5
- name: Install frontend dependencies
run: npm ci
- name: Start frontend server
run: |
nohup python -m http.server 5500 > frontend.log 2>&1 &
sleep 2
- name: Run Cypress tests
uses: cypress-io/github-action@v6
with:
wait-on: 'http://127.0.0.1:5000, http://127.0.0.1:5500'
wait-on-timeout: 30
browser: chrome
- name: Print backend logs on failure
if: failure()
run: |
echo "=== BACKEND LOG ==="
cat backend.log || true
echo "=== FRONTEND LOG ==="
cat frontend.log || true