Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenAIComps microservices refactor #1048

Closed
wants to merge 113 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
bdf4b21
[TEST] Refactor helmchart (#964)
XinyaoWa Dec 3, 2024
6682318
add deployment for 3rd party
XinyaoWa Dec 3, 2024
bec8360
refactor src & development
XinyaoWa Dec 10, 2024
14dea41
fix
XinyaoWa Dec 10, 2024
29ce89d
fix
XinyaoWa Dec 10, 2024
36d90f4
refactor embedding
lvliang-intel Dec 11, 2024
67db564
refactor for TGI LLM
XinyaoWa Dec 11, 2024
fb57cb5
refactor dataprep redis
letonghan Dec 12, 2024
93a0d24
fix for tgi llm
XinyaoWa Dec 12, 2024
e0edef9
support vllm LLM
XinyaoWa Dec 12, 2024
aeb0ec4
Refactor for Reranking with TEI (#1029)
wangkl2 Dec 12, 2024
20b91d1
support milvus dataprep
letonghan Dec 13, 2024
b359328
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
letonghan Dec 13, 2024
4e3e228
add docker compose
XinyaoWa Dec 13, 2024
423a950
update embedding code
lvliang-intel Dec 17, 2024
ea4913f
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 17, 2024
b852e04
Merge branch 'main' of https://github.com/opea-project/GenAIComps int…
lvliang-intel Dec 17, 2024
6945af4
update docker compose and test scripts
lvliang-intel Dec 17, 2024
6da4f71
modify dataprep variable names
letonghan Dec 17, 2024
7b6c8f6
refactor retrievers redis
letonghan Dec 17, 2024
bb8ff6a
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
letonghan Dec 17, 2024
843f1c0
fix merge conflict
letonghan Dec 17, 2024
ceb4869
Fix embedding issue
lvliang-intel Dec 17, 2024
4ec50b0
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 17, 2024
cb5527e
delete redundant comments
letonghan Dec 18, 2024
3494b7b
modify test scripts
letonghan Dec 18, 2024
191e58e
update milvus dataprep docker compose
letonghan Dec 18, 2024
3cfb65d
fix spell issue
letonghan Dec 18, 2024
4f6677f
fix bugs
letonghan Dec 18, 2024
9c6f50c
fix multi components issue and refine ci scripts
letonghan Dec 18, 2024
06a714a
refactor retriever milvus
letonghan Dec 18, 2024
8e6a2bf
Refactor comps CI (#1045)
chensuyue Dec 19, 2024
c3b19b3
Add multimodal embedding refactor
lvliang-intel Dec 19, 2024
eb3e114
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 19, 2024
60747a8
Merge branch 'main' of https://github.com/opea-project/GenAIComps int…
lvliang-intel Dec 19, 2024
ee3b687
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 19, 2024
7d7fb58
fix preci issue
lvliang-intel Dec 19, 2024
910f77d
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 19, 2024
4977920
fix docker file path
lvliang-intel Dec 19, 2024
c5a54b7
Merge remote-tracking branch 'upstream/refactor_comps' into refactor_…
XinyaoWa Dec 20, 2024
93c7a85
fix ci issues
lvliang-intel Dec 20, 2024
103ac36
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2024
cf698a4
fix ci issues
lvliang-intel Dec 20, 2024
b9a938b
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 20, 2024
4d29328
Merge branch 'main' of https://github.com/opea-project/GenAIComps int…
lvliang-intel Dec 20, 2024
c4d189f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2024
2dc93c9
change src folder for test scripts
letonghan Dec 20, 2024
b5ee03c
update
letonghan Dec 20, 2024
99f9172
udpate folder src in python scripts
letonghan Dec 20, 2024
f791ae2
update readmes
letonghan Dec 20, 2024
40a55a8
Fix dataprep/retrievers/vectorstores CI Issues (#1053)
letonghan Dec 20, 2024
cde85ca
add test file into test matrix only when the file still exist
chensuyue Dec 20, 2024
f327ef1
Merge remote-tracking branch 'upstream/refactor_comps' into refactor_…
XinyaoWa Dec 20, 2024
944ce63
fix path
XinyaoWa Dec 20, 2024
7e00ace
fix
XinyaoWa Dec 20, 2024
03568a4
fix
XinyaoWa Dec 20, 2024
049452a
revert other comps folders
letonghan Dec 20, 2024
5cedcab
fix
XinyaoWa Dec 20, 2024
c03e1c4
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
letonghan Dec 20, 2024
d78c1d3
modify lvms path
letonghan Dec 20, 2024
bc6d202
revert some microservices
lvliang-intel Dec 20, 2024
83fad17
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 20, 2024
bf20d83
revert other dataprep comps
letonghan Dec 20, 2024
7bb0707
fix ci issues
lvliang-intel Dec 20, 2024
29c3c34
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2024
5d92450
add llm ut
XinyaoWa Dec 20, 2024
0183dbc
revert retrievers and vectorstores
letonghan Dec 20, 2024
6c9cd31
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
letonghan Dec 20, 2024
7b3de64
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2024
b0bc877
fix
letonghan Dec 20, 2024
394913f
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
letonghan Dec 20, 2024
31071ea
Merge remote-tracking branch 'upstream/refactor_comps' into refactor_…
XinyaoWa Dec 20, 2024
9ea2bb4
fix llm bug
XinyaoWa Dec 20, 2024
594c7ec
fix path
XinyaoWa Dec 20, 2024
e206281
fix bug
XinyaoWa Dec 20, 2024
c6d8215
Merge remote-tracking branch 'upstream/refactor_comps' into refactor_…
XinyaoWa Dec 20, 2024
0450cde
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2024
3d1dc4f
Merge remote-tracking branch 'upstream/refactor_comps' into refactor_…
XinyaoWa Dec 20, 2024
0128f2b
fix bug
XinyaoWa Dec 20, 2024
eb64bb1
fix docker file path issue
lvliang-intel Dec 20, 2024
4bb0fef
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 20, 2024
c9d6578
fix bug
XinyaoWa Dec 20, 2024
aeb8cf4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2024
3463490
fix readme link issues
lvliang-intel Dec 20, 2024
56f1666
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 20, 2024
e8c95c0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2024
8c1de45
fix finetuning issue
lvliang-intel Dec 20, 2024
09eaafa
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 20, 2024
4fa3a83
update finetune code
lvliang-intel Dec 20, 2024
25285c3
remove redundant docker compose
letonghan Dec 20, 2024
bd7435d
fix ci issues
lvliang-intel Dec 21, 2024
068f9b8
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 21, 2024
2d4130d
fix readme path
lvliang-intel Dec 21, 2024
baf91a4
move OpenAI LLM to OPEA LLM
XinyaoWa Dec 23, 2024
da3fdd2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 23, 2024
e2311e0
revert folder
XinyaoWa Dec 23, 2024
f45229c
add dataprep/retriever type control parameter, minimize requirements
letonghan Dec 23, 2024
83b8283
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
letonghan Dec 23, 2024
fb47706
fix dockerfile path
XinyaoWa Dec 23, 2024
969ae6d
update docker build
lvliang-intel Dec 23, 2024
f0ca9aa
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
lvliang-intel Dec 23, 2024
808b04c
fix llm docker compose
XinyaoWa Dec 23, 2024
14bb3ee
fix conflict
XinyaoWa Dec 23, 2024
eb2e858
update test matrix
chensuyue Dec 23, 2024
865687c
Merge remote-tracking branch 'origin/refactor_comps' into refactor_comps
chensuyue Dec 23, 2024
66ab254
update test matrix
chensuyue Dec 23, 2024
bb24747
update log print for test matrix
chensuyue Dec 23, 2024
8346d93
rename test scripts
letonghan Dec 23, 2024
aa2d1a1
add print logs
chensuyue Dec 23, 2024
0577689
Merge remote-tracking branch 'origin/refactor_comps' into refactor_comps
chensuyue Dec 23, 2024
3fd7fae
rename llm
XinyaoWa Dec 23, 2024
493b5b2
rename python files
letonghan Dec 23, 2024
7b07925
Merge branch 'refactor_comps' of https://github.com/opea-project/GenA…
letonghan Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/docker/compose/3rd_parties-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

services:
embedding-mosec:
build:
dockerfile: comps/3rd_parties/mosec/deployment/docker/Dockerfile
image: ${REGISTRY:-opea}/embedding-mosec:${TAG:-latest}
nginx:
build:
dockerfile: comps/3rd_parties/nginx/deployment/docker/Dockerfile
image: ${REGISTRY:-opea}/nginx:${TAG:-latest}
4 changes: 4 additions & 0 deletions .github/workflows/docker/compose/dataprep-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

# this file should be run in the root of the repo
services:
dataprep:
build:
dockerfile: comps/dataprep/src/Dockerfile
image: ${REGISTRY:-opea}/dataprep:${TAG:-latest}
dataprep-redis:
build:
dockerfile: comps/dataprep/redis/langchain/Dockerfile
Expand Down
26 changes: 7 additions & 19 deletions .github/workflows/docker/compose/embeddings-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,29 @@
services:
embedding-tei:
build:
dockerfile: comps/embeddings/tei/langchain/Dockerfile
dockerfile: comps/embeddings/src/Dockerfile
image: ${REGISTRY:-opea}/embedding-tei:${TAG:-latest}
embedding-multimodal-clip:
build:
dockerfile: comps/embeddings/multimodal_clip/Dockerfile
dockerfile: comps/embeddings/src/integrations/dependency/clip/Dockerfile
image: ${REGISTRY:-opea}/embedding-multimodal-clip:${TAG:-latest}
embedding-multimodal-bridgetower:
build:
dockerfile: comps/embeddings/multimodal/bridgetower/Dockerfile
dockerfile: comps/embeddings/src/integrations/dependency/bridgetower/Dockerfile
image: ${REGISTRY:-opea}/embedding-multimodal-bridgetower:${TAG:-latest}
embedding-multimodal:
build:
dockerfile: comps/embeddings/multimodal/multimodal_langchain/Dockerfile
dockerfile: comps/embeddings/src/Dockerfile
image: ${REGISTRY:-opea}/embedding-multimodal:${TAG:-latest}
embedding-langchain-mosec-endpoint:
build:
dockerfile: comps/embeddings/mosec/langchain/dependency/Dockerfile
image: ${REGISTRY:-opea}/embedding-langchain-mosec-endpoint:${TAG:-latest}
embedding-langchain-mosec:
build:
dockerfile: comps/embeddings/mosec/langchain/Dockerfile
dockerfile: comps/embeddings/src/Dockerfile
image: ${REGISTRY:-opea}/embedding-langchain-mosec:${TAG:-latest}
embedding-tei-llama-index:
build:
dockerfile: comps/embeddings/tei/llama_index/Dockerfile
image: ${REGISTRY:-opea}/embedding-tei-llama-index:${TAG:-latest}
embedding-multimodal-bridgetower-gaudi:
build:
dockerfile: comps/embeddings/multimodal/bridgetower/Dockerfile.intel_hpu
dockerfile: comps/embeddings/src/integrations/dependency/bridgetower/Dockerfile.intel_hpu
image: ${REGISTRY:-opea}/embedding-multimodal-bridgetower-gaudi:${TAG:-latest}
embedding-predictionguard:
build:
dockerfile: comps/embeddings/predictionguard/Dockerfile
dockerfile: comps/embeddings/src/Dockerfile
image: ${REGISTRY:-opea}/embedding-predictionguard:${TAG:-latest}
embedding-reranking-local:
build:
dockerfile: comps/embeddings/tei/langchain/Dockerfile.dynamic_batching
image: ${REGISTRY:-opea}/embedding-reranking-local:${TAG:-latest}
4 changes: 2 additions & 2 deletions .github/workflows/docker/compose/image2image-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
services:
image2image:
build:
dockerfile: comps/image2image/Dockerfile
dockerfile: comps/image2image/src/Dockerfile
image: ${REGISTRY:-opea}/image2image:${TAG:-latest}
image2image-gaudi:
build:
dockerfile: comps/image2image/Dockerfile.intel_hpu
dockerfile: comps/image2image/src/Dockerfile.intel_hpu
image: ${REGISTRY:-opea}/image2image-gaudi:${TAG:-latest}
6 changes: 3 additions & 3 deletions .github/workflows/docker/compose/image2video-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
services:
image2video:
build:
dockerfile: comps/image2video/Dockerfile
dockerfile: comps/image2video/src/Dockerfile
image: ${REGISTRY:-opea}/image2video:${TAG:-latest}
svd:
build:
dockerfile: comps/image2video/dependency/Dockerfile
dockerfile: comps/image2video/src/dependency/Dockerfile
image: ${REGISTRY:-opea}/svd:${TAG:-latest}
svd-gaudi:
build:
dockerfile: comps/image2video/dependency/Dockerfile.intel_hpu
dockerfile: comps/image2video/src/dependency/Dockerfile.intel_hpu
image: ${REGISTRY:-opea}/svd-gaudi:${TAG:-latest}
8 changes: 2 additions & 6 deletions .github/workflows/docker/compose/llms-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
services:
llm-tgi:
build:
dockerfile: comps/llms/text-generation/tgi/Dockerfile
dockerfile: comps/llms/src/text-generation/Dockerfile
image: ${REGISTRY:-opea}/llm-tgi:${TAG:-latest}
llm-ollama:
build:
Expand All @@ -21,7 +21,7 @@ services:
image: ${REGISTRY:-opea}/llm-faqgen-tgi:${TAG:-latest}
llm-vllm:
build:
dockerfile: comps/llms/text-generation/vllm/langchain/Dockerfile
dockerfile: comps/llms/src/text-generation/Dockerfile
image: ${REGISTRY:-opea}/llm-vllm:${TAG:-latest}
llm-native:
build:
Expand Down Expand Up @@ -50,10 +50,6 @@ services:
build:
dockerfile: comps/llms/utils/lm-eval/Dockerfile
image: ${REGISTRY:-opea}/llm-eval:${TAG:-latest}
llm-vllm-llamaindex:
build:
dockerfile: comps/llms/text-generation/vllm/llama_index/Dockerfile
image: ${REGISTRY:-opea}/llm-vllm-llamaindex:${TAG:-latest}
llm-textgen-predictionguard:
build:
dockerfile: comps/llms/text-generation/predictionguard/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker/compose/nginx-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
services:
nginx:
build:
dockerfile: comps/nginx/Dockerfile
dockerfile: comps/3rd_parties/nginx/deployment/docker/Dockerfile
image: ${REGISTRY:-opea}/nginx:${TAG:-latest}
2 changes: 1 addition & 1 deletion .github/workflows/docker/compose/ragas-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
services:
ragas:
build:
dockerfile: comps/ragas/tgi/langchain/Dockerfile
dockerfile: comps/ragas/src/tgi/langchain/Dockerfile
image: ${REGISTRY:-opea}/ragas:${TAG:-latest}
10 changes: 5 additions & 5 deletions .github/workflows/docker/compose/reranks-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
services:
reranking-tei:
build:
dockerfile: comps/reranks/tei/Dockerfile
dockerfile: comps/reranks/src/Dockerfile
image: ${REGISTRY:-opea}/reranking-tei:${TAG:-latest}
reranking-videoqna:
build:
dockerfile: comps/reranks/videoqna/Dockerfile
dockerfile: comps/reranks/src/Dockerfile # TODO. need to update
image: ${REGISTRY:-opea}/reranking-videoqna:${TAG:-latest}
reranking-fastrag:
build:
dockerfile: comps/reranks/fastrag/Dockerfile
dockerfile: comps/reranks/src/Dockerfile # TODO. need to update
image: ${REGISTRY:-opea}/reranking-fastrag:${TAG:-latest}
reranking-langchain-mosec-endpoint:
build:
dockerfile: comps/reranks/mosec/langchain/dependency/Dockerfile
dockerfile: comps/reranks/src//Dockerfile # TODO. need to update
image: ${REGISTRY:-opea}/reranking-langchain-mosec-endpoint:${TAG:-latest}
reranking-langchain-mosec:
build:
dockerfile: comps/reranks/mosec/langchain/Dockerfile
dockerfile: comps/reranks/src/Dockerfile
image: ${REGISTRY:-opea}/reranking-langchain-mosec:${TAG:-latest}
4 changes: 4 additions & 0 deletions .github/workflows/docker/compose/retrievers-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

# this file should be run in the root of the repo
services:
retriever:
build:
dockerfile: comps/retrievers/src/Dockerfile
image: ${REGISTRY:-opea}/retriever:${TAG:-latest}
retriever-redis:
build:
dockerfile: comps/retrievers/redis/langchain/Dockerfile
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/pr-examples-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
name: Example-test

on:
pull_request_target:
pull_request:
branches: [main]
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
paths:
- .github/workflows/pr-examples-test.yml
- comps/cores/**
- comps/embeddings/langchain/**
- comps/retrievers/langchain/redis/**
- comps/reranks/tei/**
- comps/llms/text-generation/tgi/**
- comps/dataprep/redis/langchain/**
- comps/dataprep/src/redis/langchain/**
- comps/retrievers/src/redis/langchain/**
- requirements.txt
- "!**.md"

Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/pr-microservice-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
name: MicroService-test

on:
pull_request_target:
branches: ["main", "*rc"]
pull_request:
branches: ["main", "*rc", "refactor_comps"]
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
paths:
- comps/**
Expand Down Expand Up @@ -52,9 +52,8 @@ jobs:
hardware: ${{ matrix.hardware }}
run: |
cd tests
echo "log_name=${service}_${hardware}" >> $GITHUB_ENV
if [ ${hardware} = "intel_cpu" ]; then on_hw=""; else on_hw="_on_${hardware}"; fi
timeout 60m bash $(find . -type f -name test_${service}${on_hw}.sh)
echo "log_name=${service}" >> $GITHUB_ENV
timeout 60m bash $(find . -type f -name test_${service}.sh)

- name: Clean up container
if: cancelled() || failure()
Expand Down
108 changes: 78 additions & 30 deletions .github/workflows/scripts/get_test_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,127 @@
# service: service path name, like 'agent_langchain', 'asr_whisper'
# hardware: 'intel_cpu', 'intel_hpu', ...

set -xe
set -e
cd $WORKSPACE
changed_files_full=$changed_files_full
run_matrix="{\"include\":["

# add test services when comps code change
function find_test_1() {
local pre_service=$1
local pre_service_path=$1
local n=$2
local all_service=$3

common_file_change=$(printf '%s\n' "${changed_files[@]}"| grep ${pre_service} | cut -d'/' -f$n | grep -E '*.py' | grep -vE '__init__.py|version.py' | sort -u) || true
common_file_change=$(printf '%s\n' "${changed_files[@]}"| grep ${pre_service_path} | cut -d'/' -f$n | grep -E '*.py' | grep -vE '__init__.py|version.py' | sort -u) || true
if [ "$common_file_change" ] || [ "$all_service" = "true" ]; then
# if common files changed, run all services
services=$(ls ${pre_service} | cut -d'/' -f$n | grep -vE '*.md|*.py|*.sh|*.yaml|*.yml|*.pdf' | sort -u) || true
services=$(ls ${pre_service_path} | cut -d'/' -f$n | grep -vE '*.md|*.py|*.sh|*.yaml|*.yml|*.pdf' | sort -u) || true
all_service="true"
else
# if specific service files changed, only run the specific service
services=$(printf '%s\n' "${changed_files[@]}"| grep ${pre_service} | cut -d'/' -f$n | grep -vE '*.py|*.sh|*.yaml|*.yml|*.pdf' | sort -u) || true
services=$(printf '%s\n' "${changed_files[@]}"| grep ${pre_service_path} | cut -d'/' -f$n | grep -vE '*.py|*.sh|*.yaml|*.yml|*.pdf' | sort -u) || true
fi

for service in ${services}; do
service=$pre_service/$service
if [[ $(ls ${service} | grep -E "Dockerfile*") ]]; then
service_name=$(echo $service | tr '/' '_' | cut -c7-) # comps/dataprep/redis/langchain -> dataprep_redis_langchain
default_service_script_path=$(find ./tests -type f -name test_${service_name}.sh) || true
if [ "$default_service_script_path" ]; then
run_matrix="${run_matrix}{\"service\":\"${service_name}\",\"hardware\":\"intel_cpu\"},"
service_path=$pre_service_path/$service
if [[ $(ls ${service_path} | grep -E "Dockerfile*") ]]; then
if [[ $(ls ${service_path} | grep "integrations") ]]; then
# new org with `src` and `integrations` folder
set -x # Print commands and their arguments as they are executed
run_all_interation="false"
service_name=$(echo $service_path | sed 's:/src::' | tr '/' '_' | cut -c7-) # comps/retrievers/src/redis/langchain -> retrievers_redis_langchain
common_file_change_insight=$(printf '%s\n' "${changed_files[@]}"| grep ${service_path} | grep -vE 'integrations' | sort -u) || true
if [ "$common_file_change_insight" ]; then
# if common file changed, run all integrations
run_all_interation="true"
fi
if [ "$run_all_interation" = "false" ]; then
changed_integrations=$(printf '%s\n' "${changed_files[@]}"| grep ${service_path} | grep -E 'integrations' | grep -E '*.py' | cut -d'/' -f$((n+2)) | cut -d'.' -f1 | sort -u) || true
for integration in ${changed_integrations}; do
find_test=$(find ./tests -type f -name test_${service_name}_${integration}*.sh) || true
if [ "$find_test" ]; then
fill_in_matrix "$find_test"
else
run_all_interation="true"
break
fi
done
fi
if [ "$run_all_interation" = "true" ]; then
find_test=$(find ./tests -type f -name test_${service_name}*.sh) || true
if [ "$find_test" ]; then
fill_in_matrix "$find_test"
fi
fi
set +x
else
# old org without 'src' folder
service_name=$(echo $service_path | tr '/' '_' | cut -c7-) # comps/retrievers/redis/langchain -> retrievers_redis_langchain
find_test=$(find ./tests -type f -name test_${service_name}*.sh) || true
if [ "$find_test" ]; then
fill_in_matrix "$find_test"
fi
fi
other_service_script_path=$(find ./tests -type f -name test_${service_name}_on_*.sh) || true
for script in ${other_service_script_path}; do
_service=$(echo $script | cut -d'/' -f4 | cut -d'.' -f1 | cut -c6-)
hardware=${_service#*_on_}
run_matrix="${run_matrix}{\"service\":\"${service_name}\",\"hardware\":\"${hardware}\"},"
done
else
find_test_1 $service $((n+1)) $all_service
find_test_1 $service_path $((n+1)) $all_service
fi
done
}

function fill_in_matrix() {
find_test=$1
for test in ${find_test}; do
_service=$(echo $test | cut -d'/' -f4 | cut -d'.' -f1 | cut -c6-)
_fill_in_matrix $_service
done
}

function _fill_in_matrix() {
_service=$1
if [ $(echo ${_service} | grep -c "_on_") == 0 ]; then
service=${_service}
hardware="intel_cpu"
else
hardware=${_service#*_on_}
fi
echo "service=${_service}, hardware=${hardware}"
if [[ $(echo ${run_matrix} | grep -c "{\"service\":\"${_service}\",\"hardware\":\"${hardware}\"},") == 0 ]]; then
run_matrix="${run_matrix}{\"service\":\"${_service}\",\"hardware\":\"${hardware}\"},"
echo "------------------ add one service ------------------"
fi
sleep 1s
}

# add test case when test scripts code change
function find_test_2() {
test_files=$(printf '%s\n' "${changed_files[@]}" | grep -E "*.sh") || true
for test_file in ${test_files}; do
_service=$(echo $test_file | cut -d'/' -f3 | cut -d'.' -f1 | cut -c6-)
if [ $(echo ${_service} | grep -c "_on_") == 0 ]; then
service=${_service}
hardware="intel_cpu"
else
service=${_service%_on_*}
hardware=${_service#*_on_}
fi
if [[ $(echo ${run_matrix} | grep -c "{\"service\":\"${service}\",\"hardware\":\"${hardware}\"},") == 0 ]]; then
run_matrix="${run_matrix}{\"service\":\"${service}\",\"hardware\":\"${hardware}\"},"
if [ -f $test_file ]; then
_service=$(echo $test_file | cut -d'/' -f3 | cut -d'.' -f1 | cut -c6-)
_fill_in_matrix $_service
fi
done
}

function main() {

changed_files=$(printf '%s\n' "${changed_files_full[@]}" | grep 'comps/' | grep -vE '*.md|comps/cores') || true
changed_files=$(printf '%s\n' "${changed_files_full[@]}" | grep 'comps/' | grep -vE '*.md|comps/cores|comps/3rd_parties|deployment|*.yaml') || true
echo "===========start find_test_1============"
echo "changed_files=${changed_files}"
find_test_1 "comps" 2 false
sleep 1s
echo "run_matrix=${run_matrix}"
echo "===========finish find_test_1============"

changed_files=$(printf '%s\n' "${changed_files_full[@]}" | grep 'tests/' | grep -vE '*.md|*.txt|tests/cores') || true
echo "===========start find_test_2============"
echo "changed_files=${changed_files}"
find_test_2
sleep 1s
echo "run_matrix=${run_matrix}"
echo "===========finish find_test_2============"

run_matrix=$run_matrix"]}"
echo "run_matrix=${run_matrix}"
echo "run_matrix=${run_matrix}" >> $GITHUB_OUTPUT
}

Expand Down
Loading
Loading