-
Notifications
You must be signed in to change notification settings - Fork 17
164 lines (143 loc) · 5.66 KB
/
ci-unit-tests.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
name: CI - RAGStack tests
on:
pull_request:
branches:
- main
concurrency:
group: ragstack-tests-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
preconditions:
name: Preconditions
runs-on: ubuntu-latest
outputs:
docker_examples: ${{ steps.filter.outputs.docker_examples }}
libs_colbert: ${{ steps.filter.outputs.libs_colbert }}
libs_langchain: ${{ steps.filter.outputs.libs_langchain }}
libs_llamaindex: ${{ steps.filter.outputs.libs_llamaindex }}
libs_knowledge_store: ${{ steps.filter.outputs.libs_knowledge_store }}
libs_knowledge_graph: ${{ steps.filter.outputs.libs_knowledge_graph }}
libs_ragulate: ${{ steps.filter.outputs.libs_ragulate }}
integration_tests: ${{ steps.filter.outputs.integration_tests }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: ./.github/changes-filter.yaml
build-docker:
name: Docker
runs-on: ubuntu-latest
needs: ["preconditions"]
if: ${{ needs.preconditions.outputs.docker_examples == 'true' }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Docker examples - basic
run: |
docker --version
cd docker/examples/basic
sudo docker build -t ragstack-basic .
- name: Docker examples - multistage
run: |
cd docker/examples/multistage
sudo docker build -t ragstack-multistage .
- name: Docker examples - local llm
run: |
cd docker/examples/local-llm
sudo docker build -t local-llm .
unit-tests:
name: Unit Tests (Python ${{ matrix.python-version }})
needs: ["preconditions"]
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.12"
- "3.11"
- "3.10"
- "3.9"
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: "Setup: Python ${{ matrix.python-version }}"
uses: ./.github/actions/setup-python
with:
python-version: "${{ matrix.python-version }}"
- name: Run lint
if: ${{ matrix.python-version != '3.12' }}
uses: ./.github/actions/lint
- name: "Unit tests (root)"
# yamllint disable-line rule:line-length
if: ${{ needs.preconditions.outputs.libs_langchain == 'true' || needs.preconditions.outputs.libs_colbert == 'true' || needs.preconditions.outputs.libs_llamaindex == 'true' }}
run: tox -e unit-tests && rm -rf .tox
- name: "Unit tests (ragulate)"
if: ${{ needs.preconditions.outputs.libs_ragulate == 'true' && matrix.python-version != '3.9' }}
run: tox -e unit-tests -c libs/ragulate && rm -rf libs/ragulate/.tox
- name: "Unit tests (colbert)"
if: ${{ needs.preconditions.outputs.libs_colbert == 'true' }}
run: tox -e unit-tests -c libs/colbert && rm -rf libs/colbert/.tox
- name: "Unit tests (langchain)"
if: ${{ needs.preconditions.outputs.libs_langchain == 'true' }}
run: tox -e unit-tests -c libs/langchain && rm -rf libs/langchain/.tox
- name: "Unit tests (llamaindex)"
if: ${{ needs.preconditions.outputs.libs_llamaindex == 'true' }}
run: tox -e unit-tests -c libs/llamaindex && rm -rf libs/llamaindex/.tox
- name: "Unit tests (knowledge-store)"
if: ${{ needs.preconditions.outputs.libs_knowledge_store == 'true' }}
run: tox -e unit-tests -c libs/knowledge-store && rm -rf libs/knowledge-store/.tox
- name: "Unit tests (knowledge-graph)"
# yamllint disable-line rule:line-length
if: ${{ needs.preconditions.outputs.libs_knowledge_graph == 'true' && matrix.python-version != '3.9' && matrix.python-version != '3.10' }}
env:
OPENAI_API_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
run: tox -e unit-tests -c libs/knowledge-graph && rm -rf libs/knowledge-graph/.tox
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
if: ${{ needs.preconditions.outputs.integration_tests == 'true' }}
needs: ["preconditions"]
timeout-minutes: 30
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: "Setup: Python 3.11"
uses: ./.github/actions/setup-python
- name: Setup AstraDB
uses: nicoloboschi/setup-astradb@v1
id: astra-db
with:
token: ${{ secrets.E2E_TESTS_ASTRA_DEV_DB_TOKEN }}
env: "DEV"
region: "us-west-2"
cloud: "aws"
- name: "Integration tests"
env:
ASTRA_DB_TOKEN: "${{ secrets.E2E_TESTS_ASTRA_DEV_DB_TOKEN }}"
ASTRA_DB_ID: "${{ steps.astra-db.outputs.id }}"
ASTRA_DB_ENV: "DEV"
OPENAI_API_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
run: |
set -ex
run_itests() {
local dir=$1
tox -e integration-tests -c $dir
rm -rf $dir/.tox
}
if [[ "true" == "${{ needs.preconditions.outputs.libs_colbert }}" ]]; then
run_itests libs/colbert
fi
if [[ "true" == "${{ needs.preconditions.outputs.libs_langchain }}" ]]; then
run_itests libs/langchain
fi
if [[ "true" == "${{ needs.preconditions.outputs.libs_llamaindex }}" ]]; then
run_itests libs/llamaindex
fi
- name: Cleanup AstraDB
uses: nicoloboschi/cleanup-astradb@v1
if: ${{ always() && steps.astra-db.outputs.name != '' }}
with:
token: ${{ secrets.E2E_TESTS_ASTRA_DEV_DB_TOKEN }}
name: ${{ steps.astra-db.outputs.name }}
env: "DEV"
wait: false