-
Notifications
You must be signed in to change notification settings - Fork 16
239 lines (217 loc) · 8.73 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: RAGStack CI
on:
workflow_dispatch: {}
schedule:
- cron: "0 */6 * * *"
pull_request:
paths-ignore:
- ".github/workflows/langchain-master-daily.yml"
- ".github/workflows/llamaindex-main-daily.yml"
- ".github/workflows/release-ragstack.yml"
- ".github/workflows/security-scan.yml"
- "scripts/**"
- "docs/**"
- "README.adoc"
- "PACKAGE_README.md"
branches:
- main
concurrency:
group: ragstack-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
preconditions:
name: Preconditions
runs-on: ubuntu-latest
outputs:
notebooks: ${{ steps.filter.outputs.notebooks }}
e2e_tests: ${{ steps.filter.outputs.e2e_tests }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: ./.github/changes-filter.yaml
build-docker:
name: Build Docker image
needs: ["preconditions"]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Build docker image
uses: ./.github/actions/build-deploy-docker-image
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# we don't really care about the version here, we just want to make sure the image builds
ragstack-version: "0.*"
docker-tag: latest-dev
push: "false"
- name: Scan docker image
uses: ./.github/actions/scan-docker-image
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
docker-tag: "latest"
snyk-token: ${{ secrets.SNYK_TOKEN }}
- name: Docker examples - basic
run: |
docker --version
cd docker/examples/basic
sudo docker build -t ragstack-basic .
- name: Docker examples - multistage
run: |
docker --version
cd docker/examples/multistage
sudo docker build -t ragstack-multistage .
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: "Setup: Python 3.11"
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run ragstack-ai unit tests
run: |
tox
e2e-tests:
name: End-to-end Tests (${{ matrix.name }})
needs: ["preconditions"]
if: needs.preconditions.outputs.e2e_tests == 'true' || needs.preconditions.outputs.notebooks == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# - name: Astra PROD
# vector_db_mode: "astradb"
# needs_astra_setup: true
# astra_token_secret: E2E_TESTS_ASTRA_PROD_DB_TOKEN
# env: PROD
# region: eu-west-1
# cloud: aws
# run_notebooks: true
# testspace_space: ""
- name: Astra DEV
type: "astradb"
needs_astra_setup: "true"
astra_token_secret: E2E_TESTS_ASTRA_DEV_DB_TOKEN
env: DEV
region: us-west-2
cloud: aws
run_notebooks: "false"
testspace_space: "RAGStack test suite - RAGStack dev - AstraDB"
- name: DSE
type: "local-cassandra"
needs_astra_setup: "false"
astra_token_secret: ""
env: ""
region: ""
cloud: ""
run_notebooks: "false"
testspace_space: "RAGStack test suite - RAGStack dev - DSE"
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: "Setup: Python 3.11"
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Setup AstraDB
uses: ./.github/actions/setup-astra-db
if: matrix.needs_astra_setup == 'true'
id: astra-db
with:
astra-token: ${{ secrets[matrix.astra_token_secret] }}
db-name: ${{ github.run_id }}
env: ${{ matrix.env }}
region: ${{ matrix.region }}
cloud: ${{ matrix.cloud }}
- name: Run notebook tests
# we run notebook tests only on PROD env since we CassIO need different parameters for DEV, and we don't want to dirty the notebook
if: matrix.run_notebooks == 'true' && (needs.preconditions.outputs.notebooks == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
env:
ASTRA_DB_APPLICATION_TOKEN: "${{ secrets[matrix.astra_token_secret] }}"
ASTRA_DB_API_ENDPOINT: "${{ steps.astra-db.outputs.db_endpoint }}"
ASTRA_DB_ID: "${{ steps.astra-db.outputs.db_id }}"
OPENAI_API_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
LANGCHAIN_API_KEY: "${{ secrets.E2E_TESTS_LANGCHAIN_API_KEY }}"
GCLOUD_ACCOUNT_KEY_JSON: "${{ secrets.E2E_TESTS_GCLOUD_ACCOUNT_KEY_JSON }}"
run: |
source scripts/ci-common-env.sh
tox -e notebooks
- name: Run E2E tests
id: e2e-tests
if: needs.preconditions.outputs.e2e_tests == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
env:
VECTOR_DATABASE_TYPE: "${{ matrix.type }}"
ASTRA_DB_TOKEN: "${{ secrets[matrix.astra_token_secret] }}"
ASTRA_DB_ENDPOINT: "${{ steps.astra-db.outputs.db_endpoint }}"
ASTRA_DB_ID: "${{ steps.astra-db.outputs.db_id }}"
ASTRA_DB_ENV: "${{ matrix.env }}"
OPEN_AI_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
AZURE_OPEN_AI_KEY: "${{ secrets.E2E_TESTS_AZURE_OPEN_AI_KEY }}"
AZURE_OPEN_AI_ENDPOINT: "${{ secrets.E2E_TESTS_AZURE_OPEN_AI_ENDPOINT }}"
AZURE_BLOB_STORAGE_CONNECTION_STRING: "${{ secrets.E2E_TESTS_AZURE_BLOB_STORAGE_CONNECTION_STRING }}"
GCLOUD_ACCOUNT_KEY_JSON: "${{ secrets.E2E_TESTS_GCLOUD_ACCOUNT_KEY_JSON }}"
GOOGLE_API_KEY: "${{ secrets.E2E_TESTS_GOOGLE_API_KEY }}"
AWS_ACCESS_KEY_ID: "${{ secrets.E2E_TESTS_AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.E2E_TESTS_AWS_SECRET_ACCESS_KEY }}"
BEDROCK_AWS_REGION: "${{ secrets.E2E_TESTS_BEDROCK_AWS_REGION }}"
HUGGINGFACE_HUB_KEY: "${{ secrets.E2E_TESTS_HUGGINGFACE_HUB_KEY }}"
NVIDIA_API_KEY: "${{ secrets.E2E_TESTS_NVIDIA_API_KEY }}"
LANGCHAIN_API_KEY: "${{ secrets.E2E_TESTS_LANGCHAIN_API_KEY }}"
run: |
source scripts/ci-common-env.sh
tox -c ragstack-e2e-tests
- name: Dump report on Github Summary
if: always()
uses: ./.github/actions/add-report-to-github-summary
with:
all: true
- name: Compute commit URL
if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
id: commit-ref
run: echo "commit-ref=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Prepare report for Slack
if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: ./.github/actions/generate-slack-report
with:
from-report-file: ragstack-e2e-tests/failed-tests-report.txt
output-file: slack-report.json
type: "RAGStack Tests"
outcome: ${{ steps.e2e-tests.outcome }}
commit-url: "https://github.com/datastax/ragstack-ai/commits/${{ steps.commit-ref.outputs.commit-ref }}"
- name: Dump report on Slack
if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: slackapi/[email protected]
with:
payload-file-path: "./slack-report.json"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Testspace deploy report
uses: ./.github/actions/deploy-testspace-report
if: always() && matrix.testspace_space != '' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
with:
token: ${{ secrets.TESTSPACE_TOKEN }}
report-file: ragstack-e2e-tests/results.xml
space: ${{ matrix.testspace_space }}
- name: Cleanup AstraDB
uses: ./.github/actions/cleanup-astra-db
if: always() && matrix.needs_astra_setup == 'true'
continue-on-error: true
with:
astra-token: ${{ secrets[matrix.astra_token_secret] }}
db-name: ${{ github.run_id }}
env: ${{ matrix.env }}