@@ -20,47 +20,7 @@ concurrency:
2020
2121jobs :
2222 job1 :
23- name : Get-test-matrix
24- runs-on : ubuntu-latest
25- outputs :
26- run_matrix : ${{ steps.get-test-matrix.outputs.run_matrix }}
27- steps :
28- - name : Checkout out Repo
29- uses : actions/checkout@v4
30- with :
31- ref : " refs/pull/${{ github.event.number }}/merge"
32- fetch-depth : 0
33- - name : Get test matrix
34- id : get-test-matrix
35- run : |
36- set -xe
37- merged_commit=$(git log -1 --format='%H')
38- changed_files="$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${merged_commit} \
39- | grep 'comps/' | grep -vE '*.md|*.txt|comps/cores')" || true
40- services=$(printf '%s\n' "${changed_files[@]}" | cut -d'/' -f2 | grep -vE '*.py' | sort -u)
41- path_level_1=("asr" "tts")
42- path_level_3=("llms_summarization" "llms_text-generation" "dataprep_redis")
43- run_matrix="{\"include\":["
44- for service in ${services}; do
45- hardware="gaudi" # default hardware, set based on the changed files
46- if [[ "${path_level_1[@]}" =~ "${service}" ]]; then
47- run_matrix="${run_matrix}{\"service\":\"${service}\",\"hardware\":\"${hardware}\"},"
48- else
49- vendors=$(printf '%s\n' "${changed_files[@]}" | grep ${service} | cut -d'/' -f3 | grep -vE '*.py|Dockerfile' | sort -u)
50- for vendor in ${vendors}; do
51- if [[ "${path_level_3[@]}" =~ "${service}_${vendor}" ]]; then
52- sub_vendors=$(printf '%s\n' "${changed_files[@]}" | grep ${service} | grep ${vendor} | cut -d'/' -f4 | grep -vE '*.py' | sort -u)
53- for sub_vendor in ${sub_vendors}; do
54- run_matrix="${run_matrix}{\"service\":\"${service}_${vendor}_${sub_vendor}\",\"hardware\":\"${hardware}\"},"
55- done
56- else
57- run_matrix="${run_matrix}{\"service\":\"${service}_${vendor}\",\"hardware\":\"${hardware}\"},"
58- fi
59- done
60- fi
61- done
62- run_matrix=$run_matrix"]}"
63- echo "run_matrix=${run_matrix}" >> $GITHUB_OUTPUT
23+ uses : ./.github/workflows/reuse-get-test-matrix.yml
6424
6525 Microservice-test :
6626 needs : job1
@@ -80,16 +40,15 @@ jobs:
8040 - name : Run microservice test
8141 env :
8242 HF_TOKEN : ${{ secrets.HF_TOKEN }}
83- service : ${{ matrix.service }}
43+ service_path : ${{ matrix.service }}
8444 hardware : ${{ matrix.hardware }}
8545 run : |
8646 cd tests
87- if [ -f test_${service}.sh ]; then timeout 30m bash test_${service}.sh; else echo "Test script not found, skip test!"; fi
47+ service=$(echo $service_path | tr '/' '_')
48+ echo "service=${service}" >> $GITHUB_ENV
49+ if [ -f test_${service}.sh ]; then timeout 10m bash test_${service}.sh; else echo "Test script not found, skip test!"; fi
8850
8951 - name : Clean up container
90- env :
91- service : ${{ matrix.service }}
92- hardware : ${{ matrix.hardware }}
9352 if : cancelled() || failure()
9453 run : |
9554 cid=$(docker ps -aq --filter "name=test-comps-*")
10059 if : ${{ !cancelled() }}
10160 uses : actions/upload-artifact@v4
10261 with :
103- name : ${{ matrix .service }}-${{ matrix.hardware }}
62+ name : ${{ env .service }}
10463 path : ${{ github.workspace }}/tests/*.log
0 commit comments