Speed up tests (#1028) #7
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 (VS 2019, Python 3.11) | |
on: | |
workflow_dispatch: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- master | |
- 'releases/**' | |
concurrency: | |
# github.ref is not unique in post-commit | |
group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-windows | |
cancel-in-progress: true | |
env: | |
PYTHON_VERSION: '3.11' | |
OV_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref }} | |
OV_TARBALL: '' | |
permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions | |
jobs: | |
openvino_download: | |
name: Download OpenVINO package | |
outputs: | |
status: ${{ steps.openvino_download.outcome }} | |
timeout-minutes: 10 | |
defaults: | |
run: | |
shell: bash | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Download OpenVINO build | |
id: openvino_download | |
run: | | |
wget ${{ env.OV_TARBALL}} --progress=bar:force:noscroll -O openvino_package.zip | |
unzip -l openvino_package.zip | |
continue-on-error: true | |
# | |
# Upload to artifacts | |
# | |
- name: Upload openvino package | |
if: steps.openvino_download.outcome == 'success' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openvino_package | |
path: openvino_package.zip | |
if-no-files-found: 'error' | |
openvino_build: | |
name: Build OpenVINO package | |
needs: [openvino_download] | |
if: needs.openvino_download.outputs.status != 'success' | |
timeout-minutes: 150 | |
defaults: | |
run: | |
shell: pwsh | |
runs-on: windows-2019-16-core | |
env: | |
CMAKE_BUILD_TYPE: 'Release' | |
CMAKE_GENERATOR: 'Ninja Multi-Config' | |
CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
CMAKE_C_COMPILER_LAUNCHER: ccache | |
OPENVINO_REPO: ${{ github.workspace }}\\openvino | |
INSTALL_DIR: ${{ github.workspace }}\\openvino\\install | |
BUILD_DIR: ${{ github.workspace }}\\openvino\\build | |
steps: | |
- name: git configuration | |
run: git config --system core.longpaths true | |
- name: Clone OpenVINO | |
uses: actions/checkout@v4 | |
with: | |
repository: 'openvinotoolkit/openvino' | |
path: ${{ env.OPENVINO_REPO }} | |
submodules: 'true' | |
ref: ${{ env.OV_BRANCH }} | |
# | |
# Dependencies | |
# | |
- name: Setup Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
- name: Install python dependencies | |
run: | | |
# For Python API: build and wheel packaging | |
python3 -m pip install -r ${env:OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt | |
- name: Install build dependencies | |
run: | | |
Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip -OutFile ninja-win.zip -MaximumRetryCount 10 | |
Expand-Archive -Force ninja-win.zip | |
# Add it to the GitHub Path so it would be available in the subsequent steps | |
Add-Content -Path $env:GITHUB_PATH -Value "${{ github.workspace }}/ninja-win" | |
# | |
# Build | |
# | |
- name: Setup ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
max-size: "2000M" | |
# Should save cache only if run in the master branch of the base repo | |
# github.ref_name is 'ref/PR_#' in case of the PR, and 'branch_name' when executed on push | |
save: ${{ github.ref_name == 'master' && 'true' || 'false' }} | |
verbose: 2 | |
key: ccache-windows | |
restore-keys: | | |
ccache-windows | |
- name: Configure Developer Command Prompt for Microsoft Visual C++ | |
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
- name: CMake configure - OpenVINO | |
run: | | |
cmake -G "${{ env.CMAKE_GENERATOR }}" ` | |
-DENABLE_CPPLINT=OFF ` | |
-DBUILD_nvidia_plugin=OFF ` | |
-DBUILD_SHARED_LIBS=ON ` | |
-DENABLE_TESTS=OFF ` | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=OFF ` | |
-DENABLE_STRICT_DEPENDENCIES=OFF ` | |
-DENABLE_PYTHON=ON ` | |
-DENABLE_WHEEL=ON ` | |
-DENABLE_JS=OFF ` | |
-DENABLE_SAMPLES=ON ` | |
-DENABLE_INTEL_NPU=OFF ` | |
-DENABLE_OV_ONNX_FRONTEND=OFF ` | |
-DENABLE_OV_PADDLE_FRONTEND=OFF ` | |
-DENABLE_OV_PYTORCH_FRONTEND=ON ` | |
-DENABLE_OV_TF_FRONTEND=ON ` | |
-DENABLE_OV_TF_LITE_FRONTEND=OFF ` | |
-DENABLE_INTEL_GPU=OFF ` | |
-DENABLE_INTEL_NPU=OFF ` | |
-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON ` | |
-S ${{ env.OPENVINO_REPO }} ` | |
-B ${{ env.BUILD_DIR }} | |
- name: Clean ccache stats | |
run: ccache --zero-stats --show-config | |
- name: Cmake build - OpenVINO | |
run: cmake --build ${{ env.BUILD_DIR }} --parallel --config ${{ env.CMAKE_BUILD_TYPE }} --verbose | |
- name: Show ccache stats | |
run: ccache --show-stats | |
- name: Cmake install - OpenVINO | |
run: | | |
cmake -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }}/ov_package -P ${{ env.BUILD_DIR }}/cmake_install.cmake | |
cmake -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }}/ov_package -DCOMPONENT=python_wheels -P ${{ env.BUILD_DIR }}/cmake_install.cmake | |
- name: Pack Artifacts | |
run: | | |
$file=Get-ChildItem -Path "${{ env.INSTALL_DIR }}" | |
$compress = @{ | |
Path = $file | |
CompressionLevel = "Optimal" | |
DestinationPath = "${{ env.BUILD_DIR }}/openvino_package.zip" | |
} | |
Compress-Archive @compress | |
# | |
# Upload build artifacts and logs | |
# | |
- name: Upload openvino package | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openvino_package | |
path: ${{ env.BUILD_DIR }}/openvino_package.zip | |
if-no-files-found: 'error' | |
genai_python_lib: | |
name: OpenVINO genai extension (cmake + wheel) | |
needs: [ openvino_download, openvino_build ] | |
if: | | |
always() && | |
(needs.openvino_download.outputs.status == 'success' || needs.openvino_build.result == 'success') | |
timeout-minutes: 90 | |
defaults: | |
run: | |
shell: pwsh | |
runs-on: windows-2019 | |
env: | |
OV_INSTALL_DIR: ${{ github.workspace }}\\ov | |
CMAKE_BUILD_PARALLEL_LEVEL: null | |
steps: | |
- name: Clone openvino.genai | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
- name: Download OpenVINO package | |
uses: actions/download-artifact@v4 | |
with: | |
name: openvino_package | |
path: ${{ env.OV_INSTALL_DIR }} | |
- name: Extract OpenVINO packages | |
run: | | |
pushd ${{ env.OV_INSTALL_DIR }} | |
Expand-Archive openvino_package.zip -DestinationPath ./tmp | |
mv ./tmp/*/* . | |
popd | |
- name: Configure Developer Command Prompt for Microsoft Visual C++ | |
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
- name: Build genai libs | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ | |
cmake --build ./build/ --config Release -j | |
- name: Test bindings | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
python -m pip install ./thirdparty/openvino_tokenizers/[transformers] -r ./tests/python_tests/requirements.txt --find-links ${env:OV_INSTALL_DIR}/wheels --upgrade-strategy eager | |
python -m pytest ./tests/python_tests/test_chat_generate_api.py::test_set_chat_template | |
env: | |
PYTHONPATH: "./build/" # cmd evaluates variables in a different way. Setting PYTHONPATH before setupvars.bat instead of doing that after solves that. | |
- name: Test bindings (wheel) | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
python -m pip install . --verbose | |
python -m pytest ./tests/python_tests/ --ignore ./tests/python_tests/test_whisper_generate_api.py --ignore ./tests/python_tests/test_vlm_api.py -k "not test_set_chat_template" | |
genai_python_lib_whisper: | |
name: OpenVINO genai extension whisper tests (cmake + wheel) | |
needs: [ openvino_download, openvino_build ] | |
if: | | |
always() && | |
(needs.openvino_download.outputs.status == 'success' || needs.openvino_build.result == 'success') | |
timeout-minutes: 90 | |
defaults: | |
run: | |
shell: pwsh | |
runs-on: windows-2019 | |
env: | |
OV_INSTALL_DIR: ${{ github.workspace }}\\ov | |
CMAKE_BUILD_PARALLEL_LEVEL: null | |
steps: | |
- name: Clone openvino.genai | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
- name: Download OpenVINO package | |
uses: actions/download-artifact@v4 | |
with: | |
name: openvino_package | |
path: ${{ env.OV_INSTALL_DIR }} | |
- name: Extract OpenVINO packages | |
run: | | |
pushd ${{ env.OV_INSTALL_DIR }} | |
Expand-Archive openvino_package.zip -DestinationPath ./tmp | |
mv ./tmp/*/* . | |
popd | |
- name: Configure Developer Command Prompt for Microsoft Visual C++ | |
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
- name: Build genai libs | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ | |
cmake --build ./build/ --config Release --target py_generate_pipeline -j | |
- name: Test bindings | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
python -m pip install ./thirdparty/openvino_tokenizers/[transformers] -r ./tests/python_tests/requirements.txt --find-links ${env:OV_INSTALL_DIR}/wheels --upgrade-strategy eager | |
python -m pytest ./tests/python_tests/test_whisper_generate_api.py -k test_smoke | |
env: | |
PYTHONPATH: "./build/" # cmd evaluates variables in a different way. Setting PYTHONPATH before setupvars.bat instead of doing that after solves that. | |
- name: Test bindings (wheel) | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
python -m pip install . --verbose | |
python -m pytest ./tests/python_tests/test_whisper_generate_api.py -k "not test_smoke" | |
genai_python_lib_vlm: | |
name: OpenVINO genai VLM tests (cmake + wheel) | |
needs: [ openvino_download, openvino_build ] | |
if: | | |
always() && | |
(needs.openvino_download.outputs.status == 'success' || needs.openvino_build.result == 'success') | |
timeout-minutes: 90 | |
defaults: | |
run: | |
shell: pwsh | |
runs-on: windows-2019-16-core | |
env: | |
OV_INSTALL_DIR: ${{ github.workspace }}\\ov | |
CMAKE_BUILD_PARALLEL_LEVEL: null | |
steps: | |
- name: Clone openvino.genai | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
- name: Download OpenVINO package | |
uses: actions/download-artifact@v4 | |
with: | |
name: openvino_package | |
path: ${{ env.OV_INSTALL_DIR }} | |
- name: Extract OpenVINO packages | |
run: | | |
pushd ${{ env.OV_INSTALL_DIR }} | |
Expand-Archive openvino_package.zip -DestinationPath ./tmp | |
mv ./tmp/*/* . | |
popd | |
- name: Configure Developer Command Prompt for Microsoft Visual C++ | |
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
- name: Build genai libs | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ | |
cmake --build ./build/ --config Release --target py_generate_pipeline -j | |
- name: Test bindings | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
python -m pip install ./thirdparty/openvino_tokenizers/[transformers] -r ./tests/python_tests/requirements.txt --find-links ${env:OV_INSTALL_DIR}/wheels --upgrade-strategy eager | |
python -m pip install git+https://github.com/eaidova/optimum-intel.git@ea/minicpmv | |
python -m pip install -U "optimum<1.23" --no-dependencies | |
python -m pytest ./tests/python_tests/test_vlm_api.py | |
env: | |
PYTHONPATH: "./build/" # cmd evaluates variables in a different way. Setting PYTHONPATH before setupvars.bat instead of doing that after solves that. | |
genai_package: | |
name: OpenVINO genai extension (install to OpenVINO package) | |
strategy: | |
matrix: | |
build-type: [Release, Debug] | |
needs: [ openvino_download, openvino_build ] | |
if: | | |
always() && | |
(needs.openvino_download.outputs.status == 'success' || needs.openvino_build.result == 'success') | |
timeout-minutes: 60 | |
defaults: | |
run: | |
shell: pwsh | |
runs-on: windows-2019 | |
env: | |
OV_INSTALL_DIR: ${{ github.workspace }}\\ov | |
CMAKE_BUILD_PARALLEL_LEVEL: null | |
steps: | |
- name: Clone openvino.genai | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
- name: Download OpenVINO package | |
uses: actions/download-artifact@v4 | |
with: | |
name: openvino_package | |
path: ${{ env.OV_INSTALL_DIR }} | |
- name: Extract OpenVINO packages | |
run: | | |
pushd ${{ env.OV_INSTALL_DIR }} | |
Expand-Archive openvino_package.zip -DestinationPath ./tmp | |
mv ./tmp/*/* . | |
popd | |
- name: Configure Developer Command Prompt for Microsoft Visual C++ | |
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
- name: Build genai libs | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -S ./ -B ./build/ | |
cmake --build ./build/ --config ${{ matrix.build-type }} --target package -j | |
- name: Build and Install dependencies | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --find-links ${env:OV_INSTALL_DIR}/wheels | |
python -m pip install --upgrade-strategy eager -r ./samples/requirements.txt --find-links ${env:OV_INSTALL_DIR}/wheels | |
optimum-cli export openvino --trust-remote-code --weight-format fp16 --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0 | |
- name: Install samples | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
cmake --install ./build/ --config ${{ matrix.build-type }} --prefix ${{ env.OV_INSTALL_DIR }} | |
- name: Build samples (Release) | |
if: ${{ 'Release' == matrix.build-type }} # build_samples enforces Release build | |
run: | | |
& ${{ env.OV_INSTALL_DIR }}\samples\cpp\build_samples.ps1 -i ${{ github.workspace }}/samples_install | |
- name: Build samples (Debug) | |
if: ${{ 'Release' != matrix.build-type }} | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
cmake -DCMAKE_BUILD_TYPE= -S ./ov/samples/cpp/ -B "samples build" | |
cmake --build "samples build" --config ${{ matrix.build-type }} -j | |
cmake --install "samples build" --config ${{ matrix.build-type }} --component samples_bin --prefix samples_install | |
- name: Test C++ samples (greedy_causal_lm) | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
Start-Process -FilePath "${{ github.workspace }}/samples_install/samples_bin/greedy_causal_lm.exe" -ArgumentList "TinyLlama-1.1B-Chat-v1.0 ''" | |
- name: Test python samples (multinomial_causal_lm) | |
if: ${{ 'Release' == matrix.build-type }} # Python bindings can be built in Release only | |
run: | | |
. "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" | |
python ${{ env.OV_INSTALL_DIR }}\samples\python\multinomial_causal_lm\multinomial_causal_lm.py TinyLlama-1.1B-Chat-v1.0 0 | |
Overall_Status: | |
name: ci/gha_overall_status_windows | |
needs: [openvino_download, openvino_build, genai_python_lib, genai_package, genai_python_lib_vlm, genai_python_lib_whisper] | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check status of all jobs | |
if: >- | |
${{ | |
contains(needs.*.result, 'failure') || | |
contains(needs.*.result, 'cancelled') | |
}} | |
run: exit 1 |