Skip to content

Commit

Permalink
Merge branch 'main' into ctao/flowchart
Browse files Browse the repository at this point in the history
  • Loading branch information
yinghu5 authored Sep 11, 2024
2 parents 6290b4d + 5c67204 commit 2da2179
Show file tree
Hide file tree
Showing 1,022 changed files with 17,883 additions and 10,630 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/_example-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,25 @@ jobs:
- name: Clean Up Working Directory
run: sudo rm -rf ${{github.workspace}}/*

- name: Get checkout ref
run: |
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
echo "CHECKOUT_REF=refs/pull/${{ github.event.number }}/merge" >> $GITHUB_ENV
else
echo "CHECKOUT_REF=${{ github.ref }}" >> $GITHUB_ENV
fi
echo "checkout ref ${{ env.CHECKOUT_REF }}"
- name: Checkout out Repo
uses: actions/checkout@v4
with:
ref: ${{ env.CHECKOUT_REF }}
fetch-depth: 0

- name: Clone required Repo
run: |
cd ${{ github.workspace }}/${{ inputs.example }}/docker
docker_compose_path=${{ github.workspace }}/${{ inputs.example }}/docker/docker_build_compose.yaml
cd ${{ github.workspace }}/${{ inputs.example }}/docker_image_build
docker_compose_path=${{ github.workspace }}/${{ inputs.example }}/docker_image_build/build.yaml
if [[ $(grep -c "tei-gaudi:" ${docker_compose_path}) != 0 ]]; then
git clone https://github.com/huggingface/tei-gaudi.git
fi
Expand All @@ -66,8 +78,8 @@ jobs:
if: ${{ fromJSON(inputs.build) }}
uses: opea-project/validation/actions/image-build@main
with:
work_dir: ${{ github.workspace }}/${{ inputs.example }}/docker
docker_compose_path: ${{ github.workspace }}/${{ inputs.example }}/docker/docker_build_compose.yaml
work_dir: ${{ github.workspace }}/${{ inputs.example }}/docker_image_build
docker_compose_path: ${{ github.workspace }}/${{ inputs.example }}/docker_image_build/build.yaml
registry: ${OPEA_IMAGE_REPO}opea
tag: ${{ inputs.tag }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_get-image-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
examples=($(echo ${{ inputs.examples }} | tr ',' ' '))
for example in ${examples[@]}
do
images=$(cat ${{ github.workspace }}/${example}/docker/docker_build_compose.yaml | yq -r '.[]' | jq 'keys' | jq -c '.')
images=$(cat ${{ github.workspace }}/${example}/docker_image_build/build.yaml | yq -r '.[]' | jq 'keys' | jq -c '.')
image_list=$(echo ${image_list} | jq -s '.[0] + .[1] | unique' - <(echo ${images}))
done
fi
Expand Down
33 changes: 8 additions & 25 deletions .github/workflows/_get-test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@ on:
required: false
type: string
default: '.github|README.md|*.txt'
xeon_server_label:
test_mode:
required: false
type: string
default: 'xeon'
gaudi_server_label:
required: false
type: string
default: 'gaudi'
default: 'docker_compose'
outputs:
run_matrix:
description: "The matrix string"
Expand Down Expand Up @@ -49,10 +45,9 @@ jobs:
- name: Get test matrix
id: get-test-matrix
run: |
set -xe
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
LATEST_COMMIT_SHA=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/opea-project/GenAIExamples/commits?sha=main" | jq -r '.[0].sha')
"https://api.github.com/repos/opea-project/GenAIExamples/commits?sha=${{ github.event.pull_request.base.ref }}" | jq -r '.[0].sha')
echo "Latest commit SHA is $LATEST_COMMIT_SHA"
base_commit=$LATEST_COMMIT_SHA
else
Expand All @@ -61,20 +56,8 @@ jobs:
merged_commit=$(git log -1 --format='%H')
changed_files="$(git diff --name-only ${base_commit} ${merged_commit} | \
grep -vE '${{ inputs.diff_excluded_files }}')" || true
examples=$(printf '%s\n' "${changed_files[@]}" | grep '/' | cut -d'/' -f1 | sort -u)
run_matrix="{\"include\":["
for example in ${examples}; do
run_hardware=""
if [ $(printf '%s\n' "${changed_files[@]}" | grep ${example} | grep -c gaudi) != 0 ]; then run_hardware="gaudi"; fi
if [ $(printf '%s\n' "${changed_files[@]}" | grep ${example} | grep -c xeon) != 0 ]; then run_hardware="xeon ${run_hardware}"; fi
if [ "$run_hardware" == "" ]; then run_hardware="gaudi"; fi
for hw in ${run_hardware}; do
if [ "$hw" == "gaudi" ] && [ "${{ inputs.gaudi_server_label }}" != "" ]; then
run_matrix="${run_matrix}{\"example\":\"${example}\",\"hardware\":\"${{ inputs.gaudi_server_label }}\"},"
elif [ "${{ inputs.xeon_server_label }}" != "" ]; then
run_matrix="${run_matrix}{\"example\":\"${example}\",\"hardware\":\"${{ inputs.xeon_server_label }}\"},"
fi
done
done
run_matrix=$run_matrix"]}"
echo "run_matrix=${run_matrix}" >> $GITHUB_OUTPUT
echo "changed_files=$changed_files"
export changed_files=$changed_files
export test_mode=${{ inputs.test_mode }}
export WORKSPACE=${{ github.workspace }}
bash .github/workflows/scripts/get_test_matrix.sh
69 changes: 0 additions & 69 deletions .github/workflows/_image-build.yml

This file was deleted.

8 changes: 7 additions & 1 deletion .github/workflows/_manifest-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
echo "skip_validate=false" >> $GITHUB_ENV
else
echo "Timeout waiting for pods in namespace $NAMESPACE to be ready!"
.github/workflows/scripts/k8s-utils.sh dump_pods_status $NAMESPACE
exit 1
fi
sleep 60
Expand All @@ -91,7 +92,12 @@ jobs:
if $skip_validate; then
echo "Skip validate"
else
${{ github.workspace }}/${{ inputs.example }}/tests/test_manifest_on_${{ inputs.hardware }}.sh validate_${{ inputs.example }} $NAMESPACE
if ${{ github.workspace }}/${{ inputs.example }}/tests/test_manifest_on_${{ inputs.hardware }}.sh validate_${{ inputs.example }} $NAMESPACE ; then
echo "Validate ${{ inputs.example }} successful!"
else
echo "Validate ${{ inputs.example }} failure!!!"
.github/workflows/scripts/k8s-utils.sh dump_all_pod_logs $NAMESPACE
fi
fi
- name: Kubectl uninstall
Expand Down
49 changes: 41 additions & 8 deletions .github/workflows/_run-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
description: Hardware to run the test on
required: true
type: string
diff_excluded_files:
required: false
type: string
default: ""
jobs:
get-test-case:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,10 +56,37 @@ jobs:
shell: bash
id: test-case-matrix
run: |
set -x
example_l=$(echo ${{ inputs.example }} | tr '[:upper:]' '[:lower:]')
cd ${{ github.workspace }}/${{ inputs.example }}/tests
test_cases=$(find . -type f -name "test_${example_l}*on_${{ inputs.hardware }}.sh" -print | cut -d/ -f2 | jq -R '.' | jq -sc '.')
run_test_cases=""
default_test_case=$(find . -type f -name "test_compose_on_${{ inputs.hardware }}.sh" | cut -d/ -f2)
if [ "$default_test_case" ]; then run_test_cases="$default_test_case"; fi
other_test_cases=$(find . -type f -name "test_compose_*_on_${{ inputs.hardware }}.sh" | cut -d/ -f2)
echo "default_test_case=$default_test_case"
echo "other_test_cases=$other_test_cases"
if [ "${{ inputs.tag }}" == "ci" ]; then
base_commit=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/opea-project/GenAIExamples/commits?sha=${{ github.event.pull_request.base.ref }}" | jq -r '.[0].sha')
merged_commit=$(git log -1 --format='%H')
changed_files="$(git diff --name-only ${base_commit} ${merged_commit} | grep -vE '${{ inputs.diff_excluded_files }}')" || true
fi
for test_case in $other_test_cases; do
if [ "${{ inputs.tag }}" == "ci" ]; then
flag=${test_case%_on_*}
flag=${flag#test_compose_}
if [[ $(printf '%s\n' "${changed_files[@]}" | grep ${{ inputs.example }} | grep ${flag}) ]]; then
run_test_cases="$run_test_cases $test_case"
fi
else
run_test_cases="$run_test_cases $test_case"
fi
done
test_cases=$(echo $run_test_cases | tr ' ' '\n' | sort -u | jq -R '.' | jq -sc '.')
echo "test_cases=$test_cases"
echo "test_cases=$test_cases" >> $GITHUB_OUTPUT
run-test:
Expand Down Expand Up @@ -101,17 +132,19 @@ jobs:
shell: bash
if: cancelled() || failure()
run: |
cd ${{ github.workspace }}/${{ inputs.example }}/docker/${{ inputs.hardware }}
yaml_files=$(find . -type f -name "*compose*yaml")
for file in $yaml_files; do
docker compose -f ${file} stop && docker compose -f ${file} rm -f || true
done
cd ${{ github.workspace }}/${{ inputs.example }}/docker_compose
test_case=${{ matrix.test_case }}
flag=${test_case%_on_*}
flag=${flag#test_}
yaml_file=$(find . -type f -wholename "*${{ inputs.hardware }}/${flag}.yaml")
echo $yaml_file
docker compose -f $yaml_file stop && docker compose -f $yaml_file rm -f || true
docker system prune -f
docker rmi $(docker images --filter reference="*:5000/*/*" -q) || true
- name: Publish pipeline artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.test_case }}
name: ${{ inputs.example }}_${{ matrix.test_case }}
path: ${{ github.workspace }}/${{ inputs.example }}/tests/*.log
78 changes: 0 additions & 78 deletions .github/workflows/chatqna_benchmark.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .github/workflows/docker/compose/AudioQnA-compose.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/docker/compose/ChatQnA-compose.yaml

This file was deleted.

Loading

0 comments on commit 2da2179

Please sign in to comment.