Unverified Commit 3704a432 authored by Yuting Jiang's avatar Yuting Jiang Committed by GitHub
Browse files

CI/CD - Support DirectX test pipeline (#545)

**Description**
Support DirectX test pipeline.
parent 86547217
...@@ -44,3 +44,27 @@ jobs: ...@@ -44,3 +44,27 @@ jobs:
TAG: superbench/main:win2004 TAG: superbench/main:win2004
USER: ${{ secrets.DOCKERHUB_USERNAME }} USER: ${{ secrets.DOCKERHUB_USERNAME }}
PASS: ${{ secrets.DOCKERHUB_TOKEN }} PASS: ${{ secrets.DOCKERHUB_TOKEN }}
directx-unit-test:
name: DirectX unit test
needs: docker
runs-on: [self-hosted, windows, x64, win2004]
steps:
- name: Add bash to PATH
shell: pwsh
run: |
echo "$env:PATH;C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
- name: Bash to get codecov env
run: |
ci_env=`bash <(curl -s https://codecov.io/env)`
echo "ci_env=$ci_env" >> $GITHUB_ENV
shell: bash
- name: Run unit tests inside docker
run: |
$command="curl -s -L https://uploader.codecov.io/latest/windows/codecov.exe -o codecov.exe && python -m pip install .[test] && python -m pytest -v --cov=superbench --cov-report=xml --cov-report=term-missing tests/ -k test_directx && codecov -t ${CODECOV_TOKEN} -cF directx-unit-test"
docker run --rm `
--isolation process `
--device class/5B45201D-F2F2-4F3B-85BB-30FF1F953599 `
-e CI=true $ci_env -e SB_TEST_CUDA="0" -e SB_TEST_ROCM="0" -e SB_TEST_PYTORCH="0" -e SB_TEST_DIRECTX="1" -e CODECOV_TOKEN superbench/main:win2004 cmd /c $command
shell: pwsh
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
...@@ -12,7 +12,7 @@ for /r %%F in (*.vcxproj) do ( ...@@ -12,7 +12,7 @@ for /r %%F in (*.vcxproj) do (
REM Download dependencies REM Download dependencies
"!MSBUILD!" "!PROJ_PATH!" -t:restore -p:RestorePackagesConfig=true "!MSBUILD!" "!PROJ_PATH!" -t:restore -p:RestorePackagesConfig=true
REM Build project REM Build project
"!MSBUILD!" "!PROJ_PATH!" /p:Configuration=Release /p:AdditionalLibraryDirectories="%WindowsSDKDir%\Lib" /p:AdditionalIncludeDirectories="%WindowsSDKDir%\Include" /p:OutDir="%SB_MICRO_PATH%\bin" "!MSBUILD!" "!PROJ_PATH!" /p:Configuration=Release /p:Platform=x64 /p:AdditionalLibraryDirectories="%WindowsSDKDir%\Lib" /p:AdditionalIncludeDirectories="%WindowsSDKDir%\Include" /p:OutDir="%SB_MICRO_PATH%\bin"
) )
endlocal endlocal
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Tests for directx gpu device module."""
from superbench.common.devices.gpu import GPU
from tests.helper import decorator
@decorator.directx_test
def test_directx_gpu():
"""Test DirectX GPU device."""
gpu = GPU()
gpu.get_vendor()
assert (gpu.vendor == 'nvidia-graphics' or gpu.vendor == 'amd-graphics')
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Helper module for tests."""
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
rocm_test = unittest.skipIf(os.environ.get('SB_TEST_ROCM', '0') == '0', 'Skip ROCm tests.') rocm_test = unittest.skipIf(os.environ.get('SB_TEST_ROCM', '0') == '0', 'Skip ROCm tests.')
pytorch_test = unittest.skipIf(os.environ.get('SB_TEST_PYTORCH', '1') == '0', 'Skip PyTorch tests.') pytorch_test = unittest.skipIf(os.environ.get('SB_TEST_PYTORCH', '1') == '0', 'Skip PyTorch tests.')
directx_test = unittest.skipIf(os.environ.get('SB_TEST_DIRECTX', '0') == '0', 'Skip DirectX tests.')
def load_data(filepath): def load_data(filepath):
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
from omegaconf import OmegaConf from omegaconf import OmegaConf
from superbench.runner.ansible import AnsibleClient from superbench.common.utils import LazyImport
AnsibleClient = LazyImport('superbench.runner.ansible', 'AnsibleClient')
class AnsibleClientTestCase(unittest.TestCase): class AnsibleClientTestCase(unittest.TestCase):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment