license update #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |