-
Notifications
You must be signed in to change notification settings - Fork 510
112 lines (100 loc) · 2.79 KB
/
unit_test_main.yaml
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
name: Unit test
on:
push:
branches:
- main
- dev
paths:
- 'examples/**'
- 'gptcache/**'
- 'tests/**'
- '!**.md'
- '.github/workflows/**'
pull_request:
branches:
- main
- dev
paths:
- 'examples/**'
- 'gptcache/**'
- 'tests/**'
- '!**.md'
- '.github/workflows/**'
workflow_dispatch:
jobs:
unit-test-main:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
services:
postgres:
image: ankane/pgvector
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis/redis-stack-server
ports:
- 6379:6379
mongo:
image: mongo
ports:
- 27017:27017
steps:
- uses: actions/checkout@main
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
- name: Install dependency
shell: bash
run: |
pip install -r requirements.txt
- name: Build and install
shell: bash
timeout-minutes: 10
run: |
python setup.py install
- name: Install test dependency
shell: bash
working-directory: tests
run: |
pip install -r requirements.txt
- name: Download the `en_core_web_sm` model
shell: bash
working-directory: tests
run: |
python3 -m spacy download en_core_web_sm
- name: Remove coverage xml
run: |
rm -rf ./coverage.xml
- name: Normal Unit Tests
timeout-minutes: 30
shell: bash
run: |
export IS_CI=true
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
python3 -m pytest -k "not embedding and not processor" --cov=gptcache --cov-report xml:coverage.xml --cov-append ./tests/
- name: Embedding Unit Tests
timeout-minutes: 30
shell: bash
run: |
export IS_CI=true
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
python3 -m pytest --cov=gptcache --cov-report xml:coverage.xml --cov-append ./tests/unit_tests/embedding/
- name: Processor Unit Tests
timeout-minutes: 30
shell: bash
run: |
export IS_CI=true
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
python3 -m pytest --cov=gptcache --cov-append --cov-report xml:coverage.xml ./tests/unit_tests/processor/
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true