Repository navigation
111 lines (93 loc) · 2.92 KB
/
Copy pathtest.yml
File metadata and controls
111 lines (93 loc) · 2.92 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
name: Tests
on:
push:
branches: [ main, develop, claude/** ]
pull_request:
branches: [ main, develop ]
jobs:
unit-tests:
runs-on: ubuntu-latest
name: Unit Tests (Python ${{ matrix.python-version }})
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install -e ".[dev,test]"
- name: Run unit tests with coverage
env:
PYTHONPATH: .
AVI_TEST_MODE: "1"
REQUIRE_API_KEY: "false"
run: |
pytest tests/ -v --cov=src --cov-report=xml --cov-report=term-missing \
--ignore=tests/e2e --ignore=tests/performance
- name: Upload coverage to Codecov
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
- name: Check coverage threshold
if: matrix.python-version == '3.11'
run: |
coverage report --fail-under=45
integration-tests:
runs-on: ubuntu-latest
name: Integration Tests
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
qdrant:
image: qdrant/qdrant:v1.8.3
ports:
- 6333:6333
- 6334:6334
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install -e ".[dev,test]"
- name: Wait for services
run: |
timeout 60 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' localhost 6379
timeout 60 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' localhost 6333
- name: Run integration tests
env:
PYTHONPATH: .
AVI_TEST_MODE: "1"
REQUIRE_API_KEY: "false"
REDIS_URL: redis://localhost:6379/0
QDRANT_HOST: localhost
QDRANT_PORT: 6333
VECTOR_DB_PROVIDER: qdrant
run: |
pytest tests/ -m integration -v --ignore=tests/e2e --ignore=tests/performance \
|| { code=$?; [ $code -eq 5 ] || exit $code; }