Skip to content

Commit f7d87a6

Browse files
authored
Enhance One-click workflows (#2127)
Signed-off-by: ZePan110 <ze.pan@intel.com>
1 parent 338bb3c commit f7d87a6

6 files changed

Lines changed: 137 additions & 169 deletions

File tree

.github/workflows/_run-one-click.yml

Lines changed: 60 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,22 @@ on:
2323
description: Example to test
2424
required: true
2525
type: string
26-
test_compose:
27-
default: true
28-
description: 'Test examples with docker compose'
29-
required: false
30-
type: boolean
31-
test_helmchart:
32-
default: true
33-
description: 'Test examples with helm charts'
34-
required: false
35-
type: boolean
26+
deploy_method:
27+
description: 'Test examples with docker compose or k8s charts'
28+
required: true
29+
type: string
3630
hardware:
3731
description: Hardware to run the test on
3832
required: true
3933
type: string
40-
opea_branch:
41-
default: "main"
42-
required: false
43-
type: string
34+
4435
jobs:
45-
docker-test:
46-
if: ${{ inputs.test_compose || inputs.tag == 'ci' }}
47-
runs-on: ${{ inputs.hardware }}
36+
one-click-test:
37+
runs-on: ${{ inputs.deploy_method }}-${{ inputs.hardware }}
4838
continue-on-error: true
4939
steps:
5040
- name: Clean up Working Directory
41+
if: ${{ inputs.deploy_method == 'docker' }}
5142
run: |
5243
sudo rm -rf ${{github.workspace}}/* || true
5344
@@ -64,12 +55,13 @@ jobs:
6455
docker images
6556
6657
- name: Checkout out Repo
58+
if: ${{ inputs.deploy_method == 'docker' }}
6759
uses: actions/checkout@v4
6860
with:
69-
ref: ${{ needs.get-test-case.outputs.CHECKOUT_REF }}
7061
fetch-depth: 0
7162

7263
- name: Clean up container before test
64+
if: ${{ inputs.deploy_method == 'docker' }}
7365
shell: bash
7466
run: |
7567
docker ps
@@ -85,119 +77,44 @@ jobs:
8577
docker ps
8678
8779
- name: Log in DockerHub
80+
if: ${{ inputs.deploy_method == 'docker' }}
8881
uses: docker/login-action@v3.2.0
8982
with:
9083
username: ${{ secrets.DOCKERHUB_USER }}
9184
password: ${{ secrets.DOCKERHUB_TOKEN }}
9285

93-
- name: deploy docker and test
94-
shell: bash
95-
env:
96-
HUGGINGFACEHUB_API_TOKEN: ${{ secrets.HF_TOKEN }}
97-
HF_TOKEN: ${{ secrets.HF_TOKEN }}
98-
GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }}
99-
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
100-
PINECONE_KEY: ${{ secrets.PINECONE_KEY }}
101-
PINECONE_KEY_LANGCHAIN_TEST: ${{ secrets.PINECONE_KEY_LANGCHAIN_TEST }}
102-
SDK_BASE_URL: ${{ secrets.SDK_BASE_URL }}
103-
SERVING_TOKEN: ${{ secrets.SERVING_TOKEN }}
104-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
105-
FINNHUB_API_KEY: ${{ secrets.FINNHUB_API_KEY }}
106-
FINANCIAL_DATASETS_API_KEY: ${{ secrets.FINANCIAL_DATASETS_API_KEY }}
107-
IMAGE_REPO: ${{ inputs.registry }}
108-
IMAGE_TAG: ${{ inputs.tag }}
109-
opea_branch: ${{ inputs.opea_branch }}
110-
example: ${{ inputs.example }}
111-
hardware: ${{ inputs.hardware }}
112-
test_case: ${{ matrix.test_case }}
113-
use_model_cache: ${{ inputs.use_model_cache }}
114-
run: |
115-
set -x
116-
sudo apt update
117-
sudo apt install -y python3-pip
118-
cd ${{ github.workspace }}/one_click_deploy
119-
python3 -m pip install -r requirements.txt
120-
121-
export LLM_model=meta-llama/Meta-Llama-3-8B-Instruct
122-
export Embedding_model=BAAI/bge-base-en-v1.5
123-
export Reranking_model=BAAI/bge-reranker-base
124-
export Mount_dir=./data
125-
export CodeTrans_model=mistralai/Mistral-7B-Instruct-v0.3
126-
export DocSum_model=meta-llama/Meta-Llama-3-8B-Instruct
127-
export CodeGen_model=Qwen/Qwen2.5-Coder-7B-Instruct
128-
export AudioQnA_model=meta-llama/Meta-Llama-3-8B-Instruct
129-
export VisualQnA_model=llava-hf/llava-v1.6-mistral-7b-hf
130-
export FaqGen_model=meta-llama/Meta-Llama-3-8B-Instruct
131-
132-
INPUT_DATA=$(
133-
jq -r --arg type "docker" --arg id "${{ inputs.example }}" \
134-
'.[$type][$id].inputs.deploy[]' ${{ github.workspace }}/.github/workflows/one-click-inputs-nobuild.json | \
135-
sed "s|\$hardware|$hardware|g; \
136-
s|\$HF_TOKEN|$HF_TOKEN|g; \
137-
s|\$LLM_model|$LLM_model|g; \
138-
s|\$Embedding_model|$Embedding_model|g; \
139-
s|\$Reranking_model|$Reranking_model|g; \
140-
s|\$CodeTrans_model|$CodeTrans_model|g; \
141-
s|\$DocSum_model|$DocSum_model|g; \
142-
s|\$CodeGen_model|$CodeGen_model|g; \
143-
s|\$AudioQnA_model|$AudioQnA_model|g; \
144-
s|\$VisualQnA_model|$VisualQnA_model|g; \
145-
s|\$FaqGen_model|$FaqGen_model|g; \
146-
s|\$Mount_dir|$Mount_dir|g"
147-
)
148-
echo "Generated input:"
149-
echo "$INPUT_DATA"
150-
151-
export TEST_RETRY_ATTEMPTS=6
152-
153-
python3 one_click_deploy.py << INPUTS
154-
$INPUT_DATA
155-
INPUTS
156-
157-
- name: Clean up deployment
158-
run: |
159-
cd ${{ github.workspace }}/one_click_deploy
160-
161-
INPUT_DATA=$(
162-
jq -r --arg type "docker" --arg id "${{ inputs.example }}" \
163-
'.[$type][$id].inputs.clear[]' ${{ github.workspace }}/.github/workflows/one-click-inputs.json | \
164-
sed "s/\$hardware/$hardware/g"
165-
)
166-
echo "Generated input:"
167-
echo "$INPUT_DATA"
168-
169-
python3 one_click_deploy.py << INPUTS
170-
$INPUT_DATA
171-
INPUTS
172-
173-
- name: Publish docker pipeline artifact
174-
if: ${{ !cancelled() }}
175-
uses: actions/upload-artifact@v4
176-
with:
177-
name: docker
178-
path: ${{ github.workspace }}/docker-tests/*.log
179-
180-
181-
k8s-test:
182-
if: ${{ inputs.test_helmchart || inputs.tag == 'ci' }}
183-
runs-on: k8s-${{ inputs.hardware }}
184-
continue-on-error: true
185-
steps:
18686
- name: Clean Up Working Directory
87+
if: ${{ inputs.deploy_method == 'k8s' }}
18788
run: |
188-
echo "value_file=${{ matrix.value_file }}"
18989
sudo rm -rf ${{github.workspace}}/*
19090
19191
- name: Checkout out Repo
92+
if: ${{ inputs.deploy_method == 'k8s' }}
19293
uses: actions/checkout@v4
19394
with:
194-
ref: ${{ needs.get-test-case.outputs.CHECKOUT_REF }}
19595
fetch-depth: 0
19696

197-
- name: deploy k8s and test
97+
- name: get-default-params-from-config
98+
id: get-default-params
99+
if: ${{ inputs.deploy_method == 'k8s' }}
100+
run: |
101+
cd ${{ github.workspace }}
102+
PARAMS_JSON=$(python3 .github/workflows/scripts/get-params.py ${{ inputs.example }})
103+
echo "LLM_model=$(echo "$PARAMS_JSON" | jq -r '.llm_model')" >> $GITHUB_ENV
104+
if [ "${{ inputs.example }}" = "ChatQnA" ]; then
105+
echo "LLM_model=$(echo "$PARAMS_JSON" | jq -r '.llm_model')" >> $GITHUB_ENV
106+
echo "Embedding_model=$(echo "$PARAMS_JSON" | jq -r '.embed_model')" >> $GITHUB_ENV
107+
echo "Reranking_model=$(echo "$PARAMS_JSON" | jq -r '.rerank_model')" >> $GITHUB_ENV
108+
echo "Mount_dir=$(echo "$PARAMS_JSON" | jq -r '.mount_dir')" >> $GITHUB_ENV
109+
elif [ "${{ inputs.example }}" = "VisualQnA" ]; then
110+
echo "LVM_model=$(echo "$PARAMS_JSON" | jq -r '.lvm_model')" >> $GITHUB_ENV
111+
elif [ "${{ inputs.example }}" = "AgentQnA" ]; then
112+
echo "LLM_model=$(echo "$PARAMS_JSON" | jq -r '.gaudi.llm_model')" >> $GITHUB_ENV
113+
fi
114+
115+
- name: deploy and test
198116
shell: bash
199117
env:
200-
HUGGINGFACEHUB_API_TOKEN: ${{ secrets.HF_TOKEN }}
201118
HF_TOKEN: ${{ secrets.HF_TOKEN }}
202119
GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }}
203120
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
@@ -208,58 +125,56 @@ jobs:
208125
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
209126
FINNHUB_API_KEY: ${{ secrets.FINNHUB_API_KEY }}
210127
FINANCIAL_DATASETS_API_KEY: ${{ secrets.FINANCIAL_DATASETS_API_KEY }}
211-
IMAGE_REPO: ${{ inputs.registry }}
212-
IMAGE_TAG: ${{ inputs.tag }}
213-
opea_branch: ${{ inputs.opea_branch }}
214-
example: ${{ inputs.example }}
215-
hardware: ${{ inputs.hardware }}
216-
test_case: ${{ matrix.test_case }}
217-
use_model_cache: ${{ inputs.use_model_cache }}
128+
LLM_model: ${{ env.LLM_model }}
129+
Embedding_model: ${{ env.Embedding_model }}
130+
Reranking_model: ${{ env.Reranking_model }}
131+
Mount_dir: ${{ env.Mount_dir }}
132+
LVM_model: ${{ env.LVM_model }}
218133
run: |
134+
sudo apt update
135+
sudo apt install -y python3-pip
136+
219137
cd ${{ github.workspace }}/one_click_deploy
220138
python3 -m pip install -r requirements.txt
221139
222-
export LLM_model=meta-llama/Meta-Llama-3-8B-Instruct
223-
export Embedding_model=BAAI/bge-base-en-v1.5
224-
export Reranking_model=BAAI/bge-reranker-base
225-
export Mount_dir=./data
226-
export CodeTrans_model=mistralai/Mistral-7B-Instruct-v0.3
227-
export DocSum_model=meta-llama/Meta-Llama-3-8B-Instruct
228-
export CodeGen_model=Qwen/Qwen2.5-Coder-7B-Instruct
229-
export AudioQnA_model=meta-llama/Meta-Llama-3-8B-Instruct
230-
export VisualQnA_model=llava-hf/llava-v1.6-mistral-7b-hf
231-
export FaqGen_model=meta-llama/Meta-Llama-3-8B-Instruct
140+
if [ "${{ inputs.deploy_method }}" = "k8s" ]; then
141+
export OPEA_K8S_VLLM_SKIP_WARMUP=TRUE
142+
fi
143+
export TEST_RETRY_ATTEMPTS=6
232144
233145
INPUT_DATA=$(
234-
jq -r --arg type "k8s" --arg id "${{ inputs.example }}" \
146+
jq -r --arg type "${{ inputs.deploy_method }}" --arg id "${{ inputs.example }}" \
235147
'.[$type][$id].inputs.deploy[]' ${{ github.workspace }}/.github/workflows/one-click-inputs-nobuild.json | \
236148
sed "s|\$hardware|$hardware|g; \
237149
s|\$HF_TOKEN|$HF_TOKEN|g; \
238150
s|\$LLM_model|$LLM_model|g; \
239151
s|\$Embedding_model|$Embedding_model|g; \
240152
s|\$Reranking_model|$Reranking_model|g; \
241-
s|\$CodeTrans_model|$CodeTrans_model|g; \
242-
s|\$DocSum_model|$DocSum_model|g; \
243-
s|\$CodeGen_model|$CodeGen_model|g; \
244-
s|\$AudioQnA_model|$AudioQnA_model|g; \
245-
s|\$VisualQnA_model|$VisualQnA_model|g; \
246-
s|\$FaqGen_model|$FaqGen_model|g; \
153+
s|\$CodeTrans_model|$LLM_model|g; \
154+
s|\$DocSum_model|$LLM_model|g; \
155+
s|\$CodeGen_model|$LLM_model|g; \
156+
s|\$AudioQnA_model|$LLM_model|g; \
157+
s|\$VisualQnA_model|$LLM_model|g; \
158+
s|\$FaqGen_model|$LLM_model|g; \
159+
s|\$AgentQnA_model|$LLM_model|g; \
247160
s|\$Mount_dir|$Mount_dir|g"
248161
)
162+
249163
echo "Generated input:"
250164
echo "$INPUT_DATA"
251-
export OPEA_K8S_VLLM_SKIP_WARMUP=TRUE
252-
export TEST_RETRY_ATTEMPTS=6
165+
253166
python3 one_click_deploy.py << INPUTS
254167
$INPUT_DATA
255168
INPUTS
256169
257170
- name: Clean up deployment
258171
run: |
259172
cd ${{ github.workspace }}/one_click_deploy
173+
260174
INPUT_DATA=$(
261-
jq -r --arg type "k8s" --arg id "${{ inputs.example }}" \
262-
'.[$type][$id].inputs.clear[]' ${{ github.workspace }}/.github/workflows/one-click-inputs.json
175+
jq -r --arg type "${{ inputs.deploy_method }}" --arg id "${{ inputs.example }}" \
176+
'.[$type][$id].inputs.clear[]' ${{ github.workspace }}/.github/workflows/one-click-inputs.json | \
177+
sed "s/\$hardware/${{ inputs.hardware }}/g"
263178
)
264179
echo "Generated input:"
265180
echo "$INPUT_DATA"
@@ -272,5 +187,5 @@ jobs:
272187
if: ${{ !cancelled() }}
273188
uses: actions/upload-artifact@v4
274189
with:
275-
name: k8s
276-
path: ${{ github.workspace }}/k8s-tests/*.log
190+
name: ${{ inputs.deploy_method }}
191+
path: ${{ github.workspace }}/${{ inputs.deploy_method }}-tests/test-results.log

.github/workflows/manual-one-click-workflow.yml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,23 @@ on:
3838
description: "Tag to apply to images"
3939
required: true
4040
type: string
41-
build:
42-
default: true
43-
description: 'Build test required images for Examples'
44-
required: false
45-
type: boolean
46-
test_compose:
47-
default: true
48-
description: 'Test examples with docker compose'
49-
required: false
50-
type: boolean
51-
test_helmchart:
52-
default: true
53-
description: 'Test examples with helm charts'
54-
required: false
55-
type: boolean
41+
deploy_methods:
42+
default: "docker,k8s"
43+
description: 'Test examples with docker compose or k8s charts'
44+
type: choice
45+
required: true
46+
options:
47+
- docker
48+
- k8s
49+
- docker,k8s
5650

5751
jobs:
5852
get-test-matrix:
5953
runs-on: ubuntu-latest
6054
outputs:
6155
examples: ${{ steps.get-matrix.outputs.examples }}
6256
nodes: ${{ steps.get-matrix.outputs.nodes }}
57+
deploy_methods: ${{ steps.get-matrix.outputs.deploy_methods }}
6358
steps:
6459
- name: Create Matrix
6560
id: get-matrix
@@ -70,6 +65,12 @@ jobs:
7065
nodes=($(echo ${{ inputs.nodes }} | tr ',' ' '))
7166
nodes_json=$(printf '%s\n' "${nodes[@]}" | sort -u | jq -R '.' | jq -sc '.')
7267
echo "nodes=$nodes_json" >> $GITHUB_OUTPUT
68+
deploy_methods=($(echo ${{ inputs.deploy_methods }} | tr ',' ' '))
69+
deploy_methods_json=$(printf '%s\n' "${deploy_methods[@]}" | sort -u | jq -R '.' | jq -sc '.')
70+
echo "deploy_methods=$deploy_methods_json" >> $GITHUB_OUTPUT
71+
echo "examples=$examples_json"
72+
echo "nodes=$nodes_json"
73+
echo "deploy_methods=$deploy_methods_json"
7374
7475
run-examples:
7576
# permissions:
@@ -92,14 +93,14 @@ jobs:
9293
strategy:
9394
matrix:
9495
example: ${{ fromJson(needs.get-test-matrix.outputs.examples) }}
95-
node: ${{ fromJson(needs.get-test-matrix.outputs.nodes) }}
96+
hardware: ${{ fromJson(needs.get-test-matrix.outputs.nodes) }}
97+
deploy_method: ${{ fromJson(needs.get-test-matrix.outputs.deploy_methods) }}
9698
fail-fast: false
9799
uses: ./.github/workflows/_run-one-click.yml
98100
with:
99-
hardware: ${{ matrix.node }}
101+
hardware: ${{ matrix.hardware }}
100102
example: ${{ matrix.example }}
103+
deploy_method: ${{ matrix.deploy_method }}
101104
tag: ${{ inputs.tag }}
102105
registry: "opea"
103-
test_compose: ${{ fromJSON(inputs.test_compose) }}
104-
test_helmchart: ${{ fromJSON(inputs.test_helmchart) }}
105106
secrets: inherit

.github/workflows/pr-one-click.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ concurrency:
2020

2121
jobs:
2222
one-click-test:
23+
strategy:
24+
matrix:
25+
deploy_method: ["docker", "k8s"]
26+
fail-fast: false
2327
uses: ./.github/workflows/_run-one-click.yml
2428
with:
2529
registry: "opea"
2630
tag: "ci"
2731
example: ChatQnA
2832
hardware: gaudi
29-
test_helmchart: true
30-
test_compose: true
33+
deploy_method: ${ matrix.deploy_method }
3134
secrets: inherit

0 commit comments

Comments
 (0)