This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
152 lines (135 loc) · 6.02 KB
/
unit-test-neuralchat.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
name: NeuralChat Unit Test
on:
pull_request:
branches: [main]
paths:
- '.github/workflows/unit-test-neuralchat.yml'
- '.github/workflows/script/unitTest/run_unit_test_neuralchat.sh'
- 'intel_extension_for_transformers/neural_chat/**'
- 'requirements.txt'
- 'setup.py'
- 'intel_extension_for_transformers/transformers/llm/finetuning/**'
- 'intel_extension_for_transformers/transformers/llm/quantization/**'
- 'intel_extension_for_transformers/transformers/llm/runtime/neural_speed/**'
- 'intel_extension_for_transformers/transformers/**'
- 'intel_extension_for_transformers/langchain/**'
- '!intel_extension_for_transformers/neural_chat/docs/**'
- '!intel_extension_for_transformers/neural_chat/examples/**'
- '!intel_extension_for_transformers/neural_chat/assets/**'
- '!intel_extension_for_transformers/neural_chat/README.md'
- '!intel_extension_for_transformers/transformers/llm/runtime/neural_speed/*.md'
workflow_dispatch:
# If there is a new commit, the previous jobs will be canceled
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DOCKER_CONFIG_NAME: "commonDockerConfig"
REPO_NAME: "intel-extension-for-transformers"
REPO_TAG: "py38"
DOCKER_FILE_NAME: "devel"
CONTAINER_NAME: "utTest"
EXTRA_CONTAINER_NAME: "modelTest"
CONTAINER_SCAN: "codeScan"
GOOGLE_API_KEY: ${{ vars.GOOGLE_API_KEY }}
jobs:
neuralchat-unit-test:
runs-on: [self-hosted, Linux, X64, itrex-node]
strategy:
matrix:
include:
- test_branch: ${{ github.ref }}
test_name: "PR-test"
- test_branch: "main"
test_name: "baseline"
name: neuralchat-unit-test-${{ matrix.test_name }}
steps:
- name: docker Clean Up
run: |
docker ps -a
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_NAME }}'$) ]]; then
docker start ${{ env.CONTAINER_NAME }}
echo "remove left files through container ..."
docker exec ${{ env.CONTAINER_NAME }} bash -c "ls -a /intel-extension-for-transformers && rm -fr /intel-extension-for-transformers/* && rm -fr /intel-extension-for-transformers/.* || true"
fi
if [[ $(docker ps -a | grep -i '${{ env.EXTRA_CONTAINER_NAME }}'$) ]]; then
docker start ${{ env.EXTRA_CONTAINER_NAME }}
echo "remove left files through container ..."
docker exec ${{ env.EXTRA_CONTAINER_NAME }} bash -c "ls -a /intel-extension-for-transformers && rm -fr /intel-extension-for-transformers/* && rm -fr /intel-extension-for-transformers/.* || true"
fi
- name: Checkout out Repo
uses: actions/checkout@v4
with:
submodules: "recursive"
ref: ${{ matrix.test_branch }}
fetch-tags: true
- name: docker Build
run: |
docker build -f ${{ github.workspace }}/.github/workflows/docker/${{ env.DOCKER_FILE_NAME }}.dockerfile -t ${{ env.REPO_NAME }}:${{ env.REPO_TAG }} .
- name: docker Run
run: |
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_NAME }}'$) ]]; then
docker stop ${{ env.CONTAINER_NAME }}
docker rm -vf ${{ env.CONTAINER_NAME }} || true
fi
docker run -dit --disable-content-trust --privileged --name=${{ env.CONTAINER_NAME }} -v /dev/shm:/dev/shm \
-v ${{ github.workspace }}:/intel-extension-for-transformers \
-v ~/.cache/oneAPI:/cache \
-v /home/itrex-docker/models:/models \
-v /dataset/media:/media \
-v /dataset/tf_dataset2:/tf_dataset2 \
-e "GOOGLE_API_KEY=${{ vars.GOOGLE_API_KEY }}" \
${{ env.REPO_NAME }}:${{ env.REPO_TAG }}
- name: Binary build
run: |
docker exec ${{ env.CONTAINER_NAME }} \
bash -c "cd /intel-extension-for-transformers/.github/workflows/script \
&& bash install_binary.sh"
- name: Run UT
run: |
docker exec ${{ env.CONTAINER_NAME }} \
bash -c "cd /intel-extension-for-transformers/.github/workflows/script/unitTest \
&& bash run_unit_test_neuralchat.sh --test_name=${{ matrix.test_name }}"
- name: Collect log
if: ${{ !cancelled() }}
run: |
docker exec ${{ env.CONTAINER_NAME }} \
bash -c "cd /intel-extension-for-transformers && \
mv /log_dir . "
- name: Publish pipeline artifact
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: "UnitTest${{ matrix.test_name }}"
path: ${{ github.workspace }}/log_dir
Generate-NeuralChat-Report:
runs-on: itrex-node-spell
needs: [neuralchat-unit-test]
steps:
- name: Docker Clean Up
run: |
docker ps -a
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_SCAN }}-${{ runner.name }}'$) ]]; then
docker start ${{ env.CONTAINER_SCAN }}-${{ runner.name }}
echo "remove left files through container ..."
docker exec ${{ env.CONTAINER_SCAN }}-${{ runner.name }} bash -c "ls -a /intel-extension-for-transformers && rm -fr /intel-extension-for-transformers/* && rm -fr /intel-extension-for-transformers/.* || true"
fi
- name: Checkout out Repo
uses: actions/checkout@v4
- name: Download UT PR Log
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/log_dir
- name: Display structure of downloaded files
run: cd ${{ github.workspace }}/log_dir && ls -R
- name: Calculate coverage
run: |
cd ${{ github.workspace }}/.github/workflows/script/unitTest/coverage
/usr/bin/bash calc_coverage.sh ${{ github.workspace }}/log_dir
- name: Publish pipeline artifact
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: Neural Chat Unit Test
path: ${{ github.workspace }}/log_dir
retention-days: 5