-
Notifications
You must be signed in to change notification settings - Fork 19
206 lines (175 loc) · 6.45 KB
/
ci.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
200
201
202
203
204
205
206
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- "v*"
# Cancel in-progress CI jobs if there is a new push
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
sdk_tests:
name: SDK unit tests
runs-on: ubuntu-latest-l
# runs-on: namespace-profile-ubuntu-latest-8cpu-16gb-96gb
strategy:
matrix:
python-version: ["3.10"]
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Inspect git version
run: |
git --version
- name: Remove cloud-only modules and install Python client
run: |
set -e
bash scripts/remove_cloud_modules.sh
cd clients/python
python -m pip install .[test]
- name: Check Docker Version
run: docker version
- name: Check Docker Compose Version
run: docker compose version
- name: Authenticating to the Container registry
run: echo $JH_PAT | docker login ghcr.io -u tanjiahuei@gmail.com --password-stdin
env:
JH_PAT: ${{ secrets.JH_PAT }}
- name: Edit env file
run: |
set -e
mv .env.example .env
ORGS=$(printenv | grep API_KEY | xargs -I {} echo {} | cut -d '=' -f 1)
KEYS=$(printenv | grep API_KEY | xargs -I {} echo {} | cut -d '=' -f 2-)
# Convert them into arrays
ORG_ARRAY=($ORGS)
KEY_ARRAY=($KEYS)
# Loop through the ORG_ARRAY
for i in "${!ORG_ARRAY[@]}"; do
# Get the org and key
org="${ORG_ARRAY[$i]}"
key="${KEY_ARRAY[$i]}"
# Replace the org with the key in the .env file
sed -i "s/$org=.*/$org=$key/g" .env
done
sed -i "s:EMBEDDING_MODEL=.*:EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2:g" .env
sed -i "s:RERANKER_MODEL=.*:RERANKER_MODEL=cross-encoder/ms-marco-TinyBERT-L-2:g" .env
echo 'OWL_MODELS_CONFIG=models_ci.json' >> .env
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
HYPERBOLIC_API_KEY: ${{ secrets.HYPERBOLIC_API_KEY }}
- name: Launch services (OSS)
id: launch_oss
timeout-minutes: 20
run: |
set -e
docker compose -p jamai -f docker/compose.cpu.yml --profile minio up --quiet-pull -d --wait
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
- name: Inspect owl Python version
run: docker exec jamai-owl-1 python -V
- name: Inspect owl environment
run: docker exec jamai-owl-1 pip list
- name: Python SDK tests (OSS)
id: python_sdk_test_oss
if: always() && steps.launch_oss.outcome == 'success'
run: |
set -e
export JAMAI_API_BASE=http://localhost:6969/api
python -m pytest -vv \
--timeout 300 \
--doctest-modules \
--junitxml=junit/test-results-${{ matrix.python-version }}.xml \
--cov-report=xml \
--no-flaky-report \
clients/python/tests/oss
- name: Inspect owl logs if Python SDK tests failed
if: failure() && steps.python_sdk_test_oss.outcome == 'failure'
timeout-minutes: 1
run: docker exec jamai-owl-1 cat /app/api/logs/owl.log
- name: Upload Pytest Test Results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Always run this step to publish test results even when there are test failures
if: always()
- name: TS/JS SDK tests (OSS)
id: ts_sdk_test_oss
if: always() && steps.launch_oss.outcome == 'success'
run: |
cd clients/typescript
echo "BASEURL=http://localhost:6969" >> __tests__/.env
npm install
npm run test
- name: Inspect owl logs if TS/JS SDK tests failed
if: failure() && steps.ts_sdk_test_oss.outcome == 'failure'
timeout-minutes: 1
run: docker exec jamai-owl-1 cat /app/api/logs/owl.log
- name: Update owl service for S3 test
run: |
# Update the .env file to include the new environment variable
echo 'OWL_FILE_DIR=s3://file' >> .env
echo 'S3_ENDPOINT=http://minio:9000' >> .env
echo 'S3_ACCESS_KEY_ID=minioadmin' >> .env
echo 'S3_SECRET_ACCESS_KEY=minioadmin' >> .env
# Restart the owl service with the updated environment
docker compose -p jamai -f docker/compose.cpu.yml up --quiet-pull -d --wait --no-deps --build --force-recreate owl
- name: Python SDK tests (File API, OSS)
id: python_sdk_test_oss_file
if: always() && steps.launch_oss.outcome == 'success'
run: |
set -e
export JAMAI_API_BASE=http://localhost:6969/api
python -m pytest -vv \
--timeout 300 \
--doctest-modules \
--junitxml=junit/test-results-${{ matrix.python-version }}.xml \
--cov-report=xml \
--no-flaky-report \
clients/python/tests/oss/test_file.py
- name: Inspect owl logs if Python SDK tests failed
if: failure() && steps.python_sdk_test_oss_file.outcome == 'failure'
timeout-minutes: 1
run: docker exec jamai-owl-1 cat /app/api/logs/owl.log
lance_tests:
name: Lance tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Inspect git version
run: |
git --version
- name: Install owl
run: |
set -e
cd services/api
python -m pip install .[test]
- name: Run tests
run: pytest services/api/tests/test_lance.py