Skip to content

Generate Charsmaps During Build #3002

Generate Charsmaps During Build

Generate Charsmaps During Build #3002

Workflow file for this run

name: Windows (VS 2022, 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'
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref }}
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CMAKE_C_COMPILER_LAUNCHER: ccache
CCACHE_MAXSIZE: 100Mi
ARTIFACTS_SHARE: '/mount/build-artifacts'
BASE_PRODUCT_TYPE: public_windows_vs2022
permissions: read-all
jobs:
openvino_download:
name: Download prebuilt OpenVINO
outputs:
status: ${{ steps.openvino_download.outcome }}
ov_wheel_source: ${{ steps.openvino_download.outputs.ov_wheel_source }}
ov_version: ${{ steps.openvino_download.outputs.ov_version }}
timeout-minutes: 10
defaults:
run:
shell: bash
runs-on: aks-linux-medium
container:
image: 'openvinogithubactions.azurecr.io/openvino_provider:0.1.0'
volumes:
- /mount:/mount
- ${{ github.workspace }}:${{ github.workspace }}
continue-on-error: true
steps:
- uses: openvinotoolkit/openvino/.github/actions/openvino_provider@master
id: openvino_download
with:
platform: 'windows'
commit_packages_to_provide: 'wheels,developer_package.zip'
revision: latest_available_commit
openvino_tokenizers_cpack:
name: OpenVINO tokenizers cpack (BUILD_TYPE=${{ matrix.build_type }})
strategy:
matrix:
build_type: [Release] # TODO: Add Debug build when OV provider is ready or use OV package
needs: [ openvino_download ]
if: |
always() &&
(needs.openvino_download.outputs.status == 'success')
timeout-minutes: 45
defaults:
run:
shell: pwsh
runs-on: windows-2022
env:
CMAKE_GENERATOR: 'Ninja'
OPENVINO_REPO: ${{ github.workspace }}\src\ov
OV_INSTALL_DIR: ${{ github.workspace }}\b\ov
OV_TOKENIZERS_INSTALL_DIR: ${{ github.workspace }}\b\ov_tk
OPENVINO_TOKENIZERS_REPO: ${{ github.workspace }}\src\tk
BUILD_DIR: ${{ github.workspace }}\b\tk
CCACHE_DIR: ${{ github.workspace }}\ccache
MANIFEST_PATH: ${{ github.workspace }}\manifest.yml
steps:
- name: Clone Openvino tokenizers
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: ${{ env.OPENVINO_TOKENIZERS_REPO }}
- name: Clone Openvino
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'openvinotoolkit/openvino'
path: ${{ env.OPENVINO_REPO }}
ref: ${{ env.TARGET_BRANCH }}
sparse-checkout: |
install_build_dependencies.sh
- name: Setup Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Generate product manifest
id: create_manifest
uses: openvinotoolkit/openvino/.github/actions/create_manifest@master
with:
repos: ${{ env.OPENVINO_TOKENIZERS_REPO }}
product_type: ${{ env.BASE_PRODUCT_TYPE }}_${{ matrix.build_type }}
target_arch: 'x86_64'
build_type: ${{ matrix.build_type }}
save_to: ${{ env.MANIFEST_PATH }}
- name: Download OpenVINO package
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: ${{ needs.openvino_download.outputs.ov_artifact_name }}
path: ${{ env.OV_INSTALL_DIR }}
merge-multiple: true
#
# Build
#
- name: Download and install ninja
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"
- name: Download and install ccache
run: |
Invoke-WebRequest -Uri 'https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-windows-x86_64.zip' -OutFile 'ccache.zip'
Expand-Archive -Path 'ccache.zip' -DestinationPath 'C:\temp\ccache'
Move-Item -Path 'C:\temp\ccache\*' -Destination 'C:\ccache'
Add-Content -Path $env:GITHUB_PATH -Value "C:\ccache"
- name: Setup ccache
id: ccache-restore
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
key: ${{ runner.os }}-${{ runner.arch }}-ccache-${{ env.TARGET_BRANCH }}-cpack-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-ccache-${{ env.TARGET_BRANCH }}-cpack
path: ${{ env.CCACHE_DIR }}
- name: Clean ccache stats
run: ccache --zero-stats --show-config
- name: Configure Developer Command Prompt for Microsoft Visual C++
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
toolset: 14.40 # v2022
- name: CMake configure - tokenizers
shell: pwsh
run: |
${{ env.OV_INSTALL_DIR }}/setupvars.ps1
cmake -DOpenVINODeveloperPackage_DIR=${{ env.OV_INSTALL_DIR }}/developer_package/cmake `
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
-S ${{ env.OPENVINO_TOKENIZERS_REPO }} `
-B ${{ env.BUILD_DIR }}
- name: Cmake build - tokenizers
run: cmake --build ${{ env.BUILD_DIR }} --parallel $ENV:NUMBER_OF_PROCESSORS --config ${{ matrix.build_type }} --verbose
env:
ICU_DATA_FILTER_FILE: ${{ env.OPENVINO_TOKENIZERS_REPO }}\\src\\icu_filter_en.json
- name: Show ccache stats
run: ccache --show-stats
- name: Cmake install - tokenizers
run: |
cmake --install ${{ env.BUILD_DIR }} --config=${{ matrix.build_type }} --prefix=${{ env.OV_TOKENIZERS_INSTALL_DIR }}/ov_tokenizers
- name: Pack Artifacts
run: |
$file=Get-ChildItem -Path "${{ env.OV_TOKENIZERS_INSTALL_DIR }}"
$compress = @{
Path = $file
CompressionLevel = "Optimal"
DestinationPath = "${{ env.BUILD_DIR }}/ov_tokenizers.zip"
}
Compress-Archive @compress
#
# Upload build artifacts
#
- name: Save ccache
if: always() && steps.ccache-restore.outputs.cache-hit != 'true' && github.event_name == 'push'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}
path: ${{ env.CCACHE_DIR }}
- name: Upload openvino tokenizers package
if: ${{ always() }}
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: openvino_tokenizers_cpack_${{ matrix.build_type }}
path: ${{ env.BUILD_DIR }}/*.zip
if-no-files-found: 'error'
- name: Upload manifest
if: ${{ always() }}
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: manifest_${{ matrix.build_type }}
path: ${{ env.MANIFEST_PATH }}
if-no-files-found: 'error'
openvino_tokenizers_wheel:
name: OpenVINO tokenizers wheel
needs: [ openvino_download ]
if: |
always() &&
(needs.openvino_download.outputs.status == 'success')
timeout-minutes: 30
defaults:
run:
shell: pwsh
runs-on: aks-win-8-cores-16gb
env:
CMAKE_GENERATOR: 'Ninja'
OPENVINO_REPO: ${{ github.workspace }}\src\ov
INSTALL_DIR: ${{ github.workspace }}\b\ov
OPENVINO_TOKENIZERS_REPO: ${{ github.workspace }}\src\tk
BUILD_DIR: ${{ github.workspace }}\b\tk
WHEELS_DIR: ${{ github.workspace }}\tk\wheels
CCACHE_DIR: ${{ github.workspace }}\\ccache
steps:
- name: Clone Openvino tokenizers
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: ${{ env.OPENVINO_TOKENIZERS_REPO }}
- name: Clone Openvino
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'openvinotoolkit/openvino'
path: ${{ env.OPENVINO_REPO }}
ref: ${{ env.TARGET_BRANCH }}
sparse-checkout: |
install_build_dependencies.sh
- name: Setup Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: Set CI environment
id: create_manifest
uses: openvinotoolkit/openvino/.github/actions/create_manifest@master
with:
repos: ${{ env.OPENVINO_TOKENIZERS_REPO }}
product_type: ${{ env.BASE_PRODUCT_TYPE }}_Release
target_arch: 'x86_64'
build_type: Release
save_to: ${{ env.MANIFEST_PATH }}
- name: Download OpenVINO package
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: ${{ needs.openvino_download.outputs.ov_artifact_name }}
path: ${{ env.INSTALL_DIR }}
merge-multiple: true
- name: Download and install ninja
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"
- name: Download and install ccache
run: |
Invoke-WebRequest -Uri 'https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-windows-x86_64.zip' -OutFile 'ccache.zip'
Expand-Archive -Path 'ccache.zip' -DestinationPath 'C:\temp\ccache'
Move-Item -Path 'C:\temp\ccache\*' -Destination 'C:\ccache'
Add-Content -Path $env:GITHUB_PATH -Value "C:\ccache"
- name: Setup ccache
id: ccache-restore
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
key: ${{ runner.os }}-${{ runner.arch }}-ccache-${{ env.TARGET_BRANCH }}-wheel-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-ccache-${{ env.TARGET_BRANCH }}-wheel
path: ${{ env.CCACHE_DIR }}
- name: Configure Developer Command Prompt for Microsoft Visual C++
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
toolset: 14.40 # v2022
#
# Build
#
- name: Clean ccache stats
run: ccache --zero-stats --show-config
- name: Build tokenizers wheel
run: |
python -m pip wheel -v --no-deps --wheel-dir ${{ env.WHEELS_DIR }} `
--config-settings='override=wheel.build_tag="${{ github.run_number }}"' `
--config-settings=override=cmake.build_path='${{ env.BUILD_DIR }}' `
${{ needs.openvino_download.outputs.ov_wheel_source }} `
${{ env.OPENVINO_TOKENIZERS_REPO }}
working-directory: ${{ env.INSTALL_DIR }}
env:
OpenVINODeveloperPackage_DIR: ${{ env.INSTALL_DIR }}/developer_package/cmake
- name: Show ccache stats
run: ccache --show-stats
#
# Upload build artifacts
#
- name: Save ccache
if: always() && steps.ccache-restore.outputs.cache-hit != 'true' && github.event_name == 'push'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}
path: ${{ env.CCACHE_DIR }}
- name: Upload openvino tokenizers wheel
if: ${{ always() }}
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: openvino_tokenizers_wheel
path: ${{ env.WHEELS_DIR }}/*.whl
if-no-files-found: 'error'
openvino_tokenizers_tests:
name: OpenVINO tokenizers tests
needs: [ openvino_download, openvino_tokenizers_wheel]
if: always() && needs.openvino_tokenizers_wheel.result == 'success'
timeout-minutes: 45
defaults:
run:
shell: pwsh
runs-on: windows-latest
env:
INSTALL_DIR: ${{ github.workspace }}\\openvino\\install
steps:
- name: Clone Openvino tokenizers sources
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: Download tokenizers package
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: openvino_tokenizers_wheel
path: ${{ env.INSTALL_DIR }}\\ov_tokenizers
- name: Download OpenVINO package
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: ${{ needs.openvino_download.outputs.ov_artifact_name }}
path: ${{ env.INSTALL_DIR }}
merge-multiple: true
- name: Configure poetry
uses: ./.github/actions/install_poetry
- name: Find OpenVINO wheel
uses: ./.github/actions/find_wheel
id: ov_wheel
with:
wheels_dir: '${{ env.INSTALL_DIR }}\\wheels'
package_name: 'openvino'
- name: Install OpenVINO wheel
run: poetry add ${{ steps.ov_wheel.outputs.wheel_path }}
- name: Find Tokenizers wheel
uses: ./.github/actions/find_wheel
id: tokenizers_wheel
with:
wheels_dir: '${{ env.INSTALL_DIR }}\\ov_tokenizers'
package_name: 'openvino_tokenizers'
- name: Install OpenVINO tokenizers wheel
run: poetry run pip install --no-deps ${{ steps.tokenizers_wheel.outputs.wheel_path }}
- name: Install Test dependencies
run: poetry install --extras=transformers --with dev,benchmark
- name: Tokenizers regression tests (using openvino python modules)
run: |
. "${{ env.INSTALL_DIR }}/setupvars.ps1"
poetry run pytest tests
store_artifacts:
name: Store build artifacts
strategy:
matrix:
build_type: [Release] # TODO: Add Debug build when OV provider is ready or use OV package
needs: [openvino_download, openvino_tokenizers_wheel, openvino_tokenizers_cpack]
timeout-minutes: 10
defaults:
run:
shell: bash
runs-on: aks-linux-medium
container:
image: openvinogithubactions.azurecr.io/library/python:3.12-slim
volumes:
- /mount:/mount
- ${{ github.workspace }}:${{ github.workspace }}
env:
CPACK_PACKAGE: ${{ github.workspace }}/ov_tokenizers.zip
WHEEL_PACKAGE: ${{ github.workspace }}/wheels
MANIFEST_PATH: ${{ github.workspace }}/manifest.yml
steps:
- name: Download tokenizers package & manifest
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
pattern: "{openvino_tokenizers_cpack_${{ matrix.build_type }},manifest_${{ matrix.build_type }}}"
path: ${{ github.workspace }}
merge-multiple: true
- name: Download tokenizers wheels
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: openvino_tokenizers_wheel
path: ${{ env.WHEEL_PACKAGE }}
- name: Store ${{ matrix.build_type }} artifacts to a shared drive
id: store_artifacts
if: ${{ always() }}
uses: openvinotoolkit/openvino/.github/actions/store_artifacts@master
with:
artifacts: |
${{ env.CPACK_PACKAGE }}
${{ env.WHEEL_PACKAGE }}
${{ env.MANIFEST_PATH }}
storage_dir: ${{ env.BASE_PRODUCT_TYPE }}_${{ matrix.build_type }}
storage_root: ${{ env.ARTIFACTS_SHARE }}
product_name: ${{ github.event.repository.name }}
Overall_Status:
name: ci/gha_overall_status_windows
needs: [openvino_download, openvino_tokenizers_cpack, openvino_tokenizers_wheel, openvino_tokenizers_tests]
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