136 lines
4.3 KiB
YAML
136 lines
4.3 KiB
YAML
name: OpenVINO tokenizers extension
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
runner:
|
|
description: 'Machine on which the tests would run'
|
|
type: string
|
|
required: true
|
|
shell:
|
|
description: "shell to override the default shell settings in the runner's operating system."
|
|
type: string
|
|
required: true
|
|
container:
|
|
description: 'JSON to be converted to the value of the "container" configuration for the job'
|
|
type: string
|
|
required: false
|
|
default: '{"image": null}'
|
|
affected-components:
|
|
description: 'Components that are affected by changes in the commit defined by the Smart CI Action'
|
|
type: string
|
|
required: true
|
|
|
|
env:
|
|
PIP_CACHE_PATH: /mount/caches/pip/linux
|
|
PYTHON_VERSION: '3.11'
|
|
|
|
jobs:
|
|
Openvino_tokenizers:
|
|
name: OpenVINO tokenizers extension
|
|
timeout-minutes: 25
|
|
defaults:
|
|
run:
|
|
shell: ${{ inputs.shell }}
|
|
runs-on: ${{ inputs.runner }}
|
|
container: ${{ fromJSON(inputs.container) }}
|
|
env:
|
|
INSTALL_DIR: ${{ github.workspace }}/install
|
|
OPENVINO_TOKENIZERS_REPO: ${{ github.workspace }}/openvino_tokenizers
|
|
EXTENSION_BUILD_DIR: ${{ github.workspace }}/build
|
|
|
|
steps:
|
|
# Needed as ${{ github.workspace }} is not working correctly when using Docker
|
|
- name: Setup Variables
|
|
run: |
|
|
echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV"
|
|
echo "OPENVINO_TOKENIZERS_REPO=$GITHUB_WORKSPACE/openvino_tokenizers" >> "$GITHUB_ENV"
|
|
echo "EXTENSION_BUILD_DIR=$GITHUB_WORKSPACE/build" >> "$GITHUB_ENV"
|
|
|
|
- name: checkout action
|
|
uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: |
|
|
.github/actions/setup_python
|
|
.github/actions/cache
|
|
install_build_dependencies.sh
|
|
|
|
- name: Setup Python ${{ env.PYTHON_VERSION }}
|
|
uses: ./.github/actions/setup_python
|
|
with:
|
|
version: ${{ env.PYTHON_VERSION }}
|
|
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH || '' }}
|
|
should-setup-pip-paths: ${{ runner.os == 'Linux' }}
|
|
self-hosted-runner: ${{ runner.os == 'Linux' }}
|
|
|
|
- name: Clone OpenVINO Tokenizers
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: 'openvinotoolkit/openvino_tokenizers'
|
|
path: ${{ env.OPENVINO_TOKENIZERS_REPO }}
|
|
ref: 'master'
|
|
|
|
- name: Download OpenVINO package
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: openvino_package
|
|
path: ${{ env.INSTALL_DIR }}
|
|
|
|
- name: Extract OpenVINO packages (Linux and macOS)
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
pushd ${INSTALL_DIR}
|
|
tar -xzf openvino_package.tar.gz -C ${INSTALL_DIR}
|
|
popd
|
|
|
|
- name: Extract OpenVINO packages (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
pushd ${{ env.INSTALL_DIR }}
|
|
Expand-Archive openvino_package.zip -DestinationPath "${{ env.INSTALL_DIR }}"
|
|
popd
|
|
|
|
#
|
|
# Dependencies
|
|
#
|
|
|
|
- name: Install python dependencies
|
|
run: |
|
|
# wheel packaging
|
|
python3 -m pip install -r ${{ env.OPENVINO_TOKENIZERS_REPO }}/requirements-build.txt
|
|
|
|
#
|
|
# Build
|
|
#
|
|
|
|
- name: Build tokenizers wheel (Linux and macOS)
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
source ${INSTALL_DIR}/setupvars.sh
|
|
python -m build --wheel --outdir ${EXTENSION_BUILD_DIR} ${OPENVINO_TOKENIZERS_REPO}
|
|
env:
|
|
CMAKE_ARGS: '-DBUILD_FAST_TOKENIZERS=OFF'
|
|
CMAKE_BUILD_PARALLEL_LEVEL: '4'
|
|
CMAKE_GENERATOR: 'Unix Makefiles'
|
|
|
|
- name: Build tokenizers wheel (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
. "${{ env.INSTALL_DIR }}/setupvars.ps1"
|
|
python3 -m build --wheel --outdir ${env:EXTENSION_BUILD_DIR} ${env:OPENVINO_TOKENIZERS_REPO}
|
|
env:
|
|
CMAKE_ARGS: '-DBUILD_FAST_TOKENIZERS=OFF'
|
|
CMAKE_BUILD_PARALLEL_LEVEL: '4'
|
|
|
|
#
|
|
# Upload build artifacts
|
|
#
|
|
|
|
- name: Upload openvino tokenizers wheel
|
|
if: ${{ always() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: openvino_tokenizers_wheel
|
|
path: ${{ env.EXTENSION_BUILD_DIR }}/*.whl
|
|
if-no-files-found: 'error'
|