-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (71 loc) · 2.24 KB
/
Copy pathtest.yml
File metadata and controls
84 lines (71 loc) · 2.24 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
name: GraphO2C CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('backend/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install dependencies
run: |
cd backend
pip install -r requirements.txt
pip install pytest pytest-cov httpx
- name: Run smoke tests
run: |
cd backend
pytest tests/ -v --tb=short \
--cov=. --cov-report=term-missing \
--cov-report=xml:coverage.xml
env:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
SENTRY_DSN: "" # disabled in CI — errors go to test output only
ENVIRONMENT: "ci"
CI: "true"
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
file: backend/coverage.xml
fail_ci_if_error: false
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install and build
run: |
cd frontend
npm ci
npm run build
- name: Check bundle size (gzip)
run: |
echo "--- JS bundle sizes ---"
for f in frontend-dist/assets/*.js; do
gz=$(gzip -c "$f" | wc -c)
echo " $(basename $f): $(( gz / 1024 ))KB gzipped"
done
GZIP_TOTAL=$(for f in frontend-dist/assets/*.js; do gzip -c "$f" | wc -c; done | awk '{sum+=$1} END {print sum}')
echo "Total gzipped JS: $(( GZIP_TOTAL / 1024 ))KB (limit: 300KB)"
if [ "$GZIP_TOTAL" -gt 307200 ]; then
echo "FAIL: bundle too large (${GZIP_TOTAL} bytes > 307200 bytes)"
exit 1
fi
echo "PASS: bundle within limit"