-
Notifications
You must be signed in to change notification settings - Fork 45
199 lines (169 loc) · 6.17 KB
/
test.yml
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Test Suite
on:
pull_request:
push:
branches:
- main
schedule:
- cron: "0 2 * * *" # 2 AM UTC nightly
workflow_dispatch:
env:
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.8.3"
jobs:
service-tests:
name: Service Tests
runs-on: ubuntu-latest
env:
HF_HOME: ${{ github.workspace }}/hf_cache
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Cache HuggingFace Models
id: hf-cache
uses: actions/cache@v3
with:
path: hf_cache
key: ${{ runner.os }}-hf-cache
- name: Set HuggingFace token
run: |
mkdir -p ~/.huggingface
echo '{"token":"${{ secrets.HF_TOKEN }}"}' > ~/.huggingface/token
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: pip
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
run: |
poetry install --all-extras
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: Run full test suite and prime the HF cache
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_HOME: ${{ github.workspace }}/hf_cache
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GCP_LOCATION: ${{ secrets.GCP_LOCATION }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_DEPLOYMENT_NAME }}
OPENAI_API_VERSION: ${{ secrets.OPENAI_API_VERSION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
make test-all
test:
name: Python ${{ matrix.python-version }} - ${{ matrix.connection }} [redis ${{ matrix.redis-version }}]
runs-on: ubuntu-latest
needs: service-tests
env:
HF_HOME: ${{ github.workspace }}/hf_cache
strategy:
fail-fast: false
matrix:
# 3.11 tests are run in the service-tests job
python-version: ["3.9", "3.10", 3.12, 3.13]
connection: ["hiredis", "plain"]
redis-version: ["6.2.6-v9", "latest", "8.0-M03"]
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Cache HuggingFace Models
uses: actions/cache@v3
with:
path: hf_cache
key: ${{ runner.os }}-hf-cache
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
run: |
poetry install --all-extras
- name: Install hiredis if needed
if: matrix.connection == 'hiredis'
run: |
poetry add hiredis
- name: Set Redis image name
run: |
if [[ "${{ matrix.redis-version }}" == "8.0-M03" ]]; then
echo "REDIS_IMAGE=redis:${{ matrix.redis-version }}" >> $GITHUB_ENV
else
echo "REDIS_IMAGE=redis/redis-stack-server:${{ matrix.redis-version }}" >> $GITHUB_ENV
fi
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: Run tests
if: matrix.connection == 'plain' && matrix.redis-version == 'latest'
env:
HF_HOME: ${{ github.workspace }}/hf_cache
GCP_LOCATION: ${{ secrets.GCP_LOCATION }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
run: |
make test
- name: Run tests (alternate)
if: matrix.connection != 'plain' || matrix.redis-version != 'latest'
run: |
make test
- name: Run notebooks
if: matrix.connection == 'plain' && matrix.redis-version == 'latest'
env:
HF_HOME: ${{ github.workspace }}/hf_cache
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GCP_LOCATION: ${{ secrets.GCP_LOCATION }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_DEPLOYMENT_NAME }}
OPENAI_API_VERSION: ${{ secrets.OPENAI_API_VERSION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
docker run -d --name redis -p 6379:6379 redis/redis-stack-server:latest
if [[ "${{ matrix.python-version }}" > "3.9" ]]; then
make test-notebooks
else
poetry run test-notebooks --ignore ./docs/user_guide/09_threshold_optimization.ipynb --ignore ./docs/user_guide/release_guide/0_5_0_release.ipynb
fi
docs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
run: |
poetry install --all-extras
- name: Build docs
run: |
make docs-build