-
Notifications
You must be signed in to change notification settings - Fork 2
237 lines (209 loc) · 8.58 KB
/
windows_build_test.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
name: windows build and test
on:
pull_request:
workflow_dispatch:
env:
VAI_RT_PREFIX: ${{ github.workspace }}/gi/
VAI_RT_WORKSPACE: ${{ github.workspace }}/src_dir
VAI_RT_BUILD_DIR: ${{ github.workspace }}/gb/
WITH_XCOMPILER: "ON"
WITH_CPURUNNER: "ON"
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
USE_CPYTHON: "OFF"
BUILD_PYTHON_EXT: "OFF"
EN_LLM_DOD_OPS: "ON"
JENKINS_CI_BUILD: "1"
GITHUB_WORKFLOW: "1"
DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: "0"
GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY: "1"
concurrency:
group: ${{ github.head_ref }}.windows_build_and_test
cancel-in-progress: true
jobs:
windows-build:
runs-on: [ windows-build-machine-new ]
steps:
- name: Download vai-rt Repository
uses: actions/checkout@v3
with:
repository: VitisAI/vai-rt
ref: dev
path: vai-rt
- name: install setuptools
run: python -m pip install setuptools requests numpy==1.26.4 build ninja
- name: clear gb/src dir
shell: python
run: |
import glob
import os
import stat
import shutil
def delete(func, path, execinfo):
os.chmod(path, stat.S_IWUSR)
func(path)
joined_path = os.path.join(r"${{ github.workspace }}", 'src_dir')
if os.path.exists(joined_path) and os.path.isdir(joined_path):
shutil.rmtree(joined_path, onerror=delete)
joined_path = os.path.join(r"${{ github.workspace }}", 'gb')
if os.path.exists(joined_path) and os.path.isdir(joined_path):
shutil.rmtree(joined_path, onerror=delete)
joined_path = os.path.join(r"${{ github.workspace }}", 'gi')
if os.path.exists(joined_path) and os.path.isdir(joined_path):
shutil.rmtree(joined_path, onerror=delete)
- name: Cache dependencies
uses: actions/cache/restore@v3
id: cache
with:
path: |
gi
gb
key: dev-${{ hashFiles('vai-rt/**/latest_dev.txt') }}
restore-keys: |
dev-
- name: clear vaip install path
run: Remove-Item -Path ${{ github.workspace }}/../gi/include/vaip -Recurse -ErrorAction SilentlyContinue
- name: Install XRT
run: |
wget https://xcoartifactory.xilinx.com/artifactory/xrt-mcdm-prod-local/com/amd/mcdm/win24_0805/mcdm_stack_rel-run1402/xrt_package.zip -O xrt.zip
Expand-Archive -Path "xrt.zip" -DestinationPath "xrt" -Force
Remove-Item -Path ${{ github.workspace }}/gi/xrt -Force -Recurse -ErrorAction SilentlyContinue
if (-not (Test-Path -Path ${{ github.workspace }}/gi)) {
New-Item -Path ${{ github.workspace }}/gi -ItemType Directory
}
Move-Item -Path xrt/xrt_package/xrt -Destination ${{ github.workspace }}/gi/xrt -Force -ErrorAction SilentlyContinue
Remove-Item -Path xrt -Force -Recurse -ErrorAction SilentlyContinue
Write-Host "install XRT."
shell: powershell
- name: Download vaip Repository
uses: actions/checkout@v3
with:
path: src_dir/vaip
submodules: true
- name: Compile vaip
env:
ENABLE_UNIT_TEST: ON
run: |
python vai-rt/main.py --type release --release_file vai-rt/release_file/latest_dev.txt --project onnxruntime xir --download-only
python vai-rt/main.py --type release --release_file vai-rt/release_file/latest_dev.txt --project dod
python vai-rt/main.py --type release --dev-mode --project vaip --clean
- name: Compile test_onnx_runner
run: python vai-rt/main.py --type release --release_file vai-rt/release_file/latest_dev.txt --clean --project testcases test_onnx_runner
- name: package
run: python vai-rt/main.py --type release --skip_build --package --release_file vai-rt/release_file/latest_dev.txt
- name: upload to artifacts
uses: actions/upload-artifact@v3
with:
name: voe-package
path: ${{ github.workspace }}/gb/*.zip
- name: clear gb package
shell: python
run: |
import glob
import os
zip_files = glob.glob(os.path.join(r"${{ github.workspace }}/gb", '*.zip'))
for zip_file in zip_files:
os.remove(zip_file)
print(f"Removed {zip_file}")
- name: Run unit test
run: ctest --test-dir ${{ github.workspace }}/gb/vaip/unit-test --verbose -C Release
outputs:
windows_build_status: ${{ job.status }}
windows-run-test:
needs: windows-build
runs-on: [ ipu-laptop-new ]
steps:
- name: clear
shell: python
run: |
import glob
import os
zip_files = glob.glob(os.path.join(r"${{ github.workspace }}/downloaded-artifacts", '*.zip'))
for zip_file in zip_files:
os.remove(zip_file)
print(f"Removed {zip_file}")
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: voe-package
path: ./downloaded-artifacts
- name: extract zip file
shell: python
run: |
import zipfile
import os
# Directory where zip files are located
directory_path = 'downloaded-artifacts'
# Directory where you want to extract the contents
extract_to_parent = 'downloaded-artifacts/'
# Create the extraction parent directory if it doesn't exist
os.makedirs(extract_to_parent, exist_ok=True)
# Iterate through files in the directory
for filename in os.listdir(directory_path):
file_path = os.path.join(directory_path, filename)
if zipfile.is_zipfile(file_path):
# Create a unique extraction directory for each zip file
extraction_dir = os.path.join(extract_to_parent, 'voe')
os.makedirs(extraction_dir, exist_ok=True)
with zipfile.ZipFile(file_path, 'r') as zip_ref:
zip_ref.extractall(extraction_dir)
print(f"Extracted contents of {filename} to {extraction_dir}")
- name: run sim
run: |
cd downloaded-artifacts/voe
bin\resnet50_pt.exe models\resnet50_pt.onnx vitis_ai_ep_cxx_sample\resnet50\resnet50.jpg > ${{ github.workspace }}/output.txt
env:
USE_CPU_RUNNER: 1
VAIP_COMPILE_RESERVE_CONST_DATA: 1
XLNX_ENABLE_CACHE: 0
XLNX_ENABLE_SKIP_FATAL: 0
VITISAI_EP_IMAGE_SHOW: 0
XLNX_VART_FIRMWARE: 4x4.xclbin
- name: check log
shell: python
run: |
import os
found = [line.strip() for line in open("output.txt","r",encoding="UTF-16").readlines() if "score[109] = 0.99" in line]
if len(found):
print(found)
else:
print(open("output.txt","r",encoding="UTF-16").readlines())
exit(1)
outputs:
windows_run_test_status: ${{ job.status }}
overall_status:
runs-on: [ linux_build_runner ]
needs:
- windows-build
- windows-run-test
if: always()
outputs:
overall_status: ${{ steps.set-status.outputs.overall_status }}
notification_message: ${{ steps.set-status.outputs.notification_message }}
steps:
- name: Set Status
id: set-status
run: |
if [[ "${{ needs.windows-build.result }}" == "success" && "${{ needs.windows-run-test.result }}" == "success" ]]; then
overall_status="success"
notification_message="The build and test completed successfully."
else
overall_status="failure"
notification_message="The build and test failed. Please check the logs."
fi
echo "overall_status=$overall_status" >> $GITHUB_OUTPUT
echo "notification_message=$notification_message" >> $GITHUB_OUTPUT
teams-notification:
name: Notification
if: always()
runs-on: [linux_build_runner]
needs: overall_status
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Send Notifications
uses: ./.github/actions/notify_teams # Path to your composite action
with:
action-name: ${{ github.workflow }} # Pass the workflow name
overall-status: ${{ needs.overall_status.outputs.overall_status }} # Pass the overall status
run-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} # Pass the run URL
workflow-status: ${{ needs.overall_status.outputs.overall_status }}