Add Support For Two String Inputs (#422) #2194
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: macOS (13, 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 }}-mac | |
cancel-in-progress: true | |
env: | |
PYTHON_VERSION: '3.11' | |
MACOSX_DEPLOYMENT_TARGET: '11.0' | |
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 | |
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-2-cores-8gb | |
container: | |
image: 'openvinogithubactions.azurecr.io/openvino_provider:0.1.0' | |
volumes: | |
- /mount:/mount | |
- ${{ github.workspace }}:${{ github.workspace }} | |
steps: | |
- uses: openvinotoolkit/openvino/.github/actions/openvino_provider@master | |
id: openvino_download | |
with: | |
platform: 'macos_12_6' | |
commit_packages_to_provide: 'wheels' | |
revision: latest_nightly | |
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 ] | |
timeout-minutes: 45 | |
defaults: | |
run: | |
shell: bash | |
runs-on: macos-13 | |
env: | |
CMAKE_GENERATOR: 'Ninja' | |
OPENVINO_REPO: ${{ github.workspace }}/openvino | |
INSTALL_DIR: ${{ github.workspace }}/openvino/install | |
OV_TOKENIZERS_INSTALL_DIR: ${{ github.workspace }}/openvino_tokenizers/install | |
OPENVINO_TOKENIZERS_REPO: ${{ github.workspace }}/openvino_tokenizers | |
BUILD_DIR: ${{ github.workspace }}/openvino_tokenizers/build | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
steps: | |
- name: Clone Openvino tokenizers | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
path: ${{ env.OPENVINO_TOKENIZERS_REPO }} | |
- name: Download OpenVINO package | |
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 | |
with: | |
name: ${{ needs.openvino_download.outputs.ov_artifact_name }} | |
path: ${{ env.INSTALL_DIR }} | |
merge-multiple: true | |
# | |
# Build | |
# | |
- name: Install build dependencies | |
run: brew install coreutils ninja ccache | |
- name: Setup ccache | |
id: ccache-restore | |
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
with: | |
key: ${{ runner.os }}-${{ runner.arch }}-ccache-${{ env.TARGET_BRANCH }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ runner.arch }}-ccache-${{ env.TARGET_BRANCH }} | |
path: ${{ env.CCACHE_DIR }} | |
- name: Clean ccache stats | |
run: ccache --zero-stats --show-config | |
- name: CMake configure - tokenizers | |
run: | | |
source ${INSTALL_DIR}/setupvars.sh | |
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 --config ${{ matrix.build_type }} --verbose | |
- 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: tar -czvf ${{ env.BUILD_DIR }}/ov_tokenizers.tar.gz * | |
working-directory: ${{ env.OV_TOKENIZERS_INSTALL_DIR }} | |
# | |
# Upload build artifacts | |
# | |
- name: Save ccache | |
if: always() && steps.ccache-restore.outputs.cache-hit != 'true' && github.event_name == 'push' | |
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
with: | |
key: ${{ steps.ccache-restore.outputs.cache-primary-key }} | |
path: ${{ env.CCACHE_DIR }} | |
- name: Upload openvino tokenizers package | |
if: ${{ always() }} | |
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 | |
with: | |
name: openvino_tokenizers_cpack_${{ matrix.build_type }} | |
path: ${{ env.BUILD_DIR }}/*.tar.gz | |
if-no-files-found: 'error' | |
openvino_tokenizers_wheel: | |
name: OpenVINO tokenizers extension | |
needs: [ openvino_download ] | |
timeout-minutes: 25 | |
defaults: | |
run: | |
shell: bash | |
runs-on: macos-13 | |
env: | |
OPENVINO_REPO: ${{ github.workspace }}/openvino | |
INSTALL_DIR: ${{ github.workspace }}/openvino/install | |
OPENVINO_TOKENIZERS_REPO: ${{ github.workspace }}/openvino_tokenizers | |
BUILD_DIR: ${{ github.workspace }}/openvino_tokenizers/build | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
steps: | |
- name: Clone Openvino tokenizers | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
path: ${{ env.OPENVINO_TOKENIZERS_REPO }} | |
- name: Clone Openvino | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
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@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
- name: Download OpenVINO package | |
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 | |
with: | |
name: ${{ needs.openvino_download.outputs.ov_artifact_name }} | |
path: ${{ env.INSTALL_DIR }} | |
merge-multiple: true | |
# | |
# Dependencies | |
# | |
- name: Install build dependencies | |
run: brew install coreutils ninja ccache | |
- name: Setup ccache | |
id: ccache-restore | |
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
with: | |
key: ${{ runner.os }}-${{ runner.arch }}-ccache-${{ env.TARGET_BRANCH }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ runner.arch }}-ccache-${{ env.TARGET_BRANCH }} | |
path: ${{ env.CCACHE_DIR }} | |
# | |
# Build | |
# | |
- name: Clean ccache stats | |
run: ccache --zero-stats --show-config | |
- name: Build tokenizers wheel | |
run: | | |
python3 -m pip wheel -v \ | |
--no-deps --wheel-dir ${BUILD_DIR} \ | |
--config-settings=override=cross.arch="macosx_10_12_x86_64" \ | |
${{ needs.openvino_download.outputs.ov_wheel_source }} \ | |
${OPENVINO_TOKENIZERS_REPO} | |
working-directory: ${{ env.INSTALL_DIR }} | |
- 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@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
with: | |
key: ${{ steps.ccache-restore.outputs.cache-primary-key }} | |
path: ${{ env.CCACHE_DIR }} | |
- name: Upload openvino tokenizers wheel | |
if: ${{ always() }} | |
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 | |
with: | |
name: openvino_tokenizers_wheel | |
path: ${{ env.BUILD_DIR }}/*.whl | |
if-no-files-found: 'error' | |
openvino_tokenizers_tests: | |
name: OpenVINO tokenizers tests | |
needs: [ openvino_download, openvino_tokenizers_wheel] | |
timeout-minutes: 40 | |
defaults: | |
run: | |
shell: bash | |
runs-on: macos-13 | |
env: | |
OPENVINO_REPO: ${{ github.workspace }}/openvino | |
INSTALL_DIR: ${{ github.workspace }}/openvino/install | |
OPENVINO_TOKENIZERS_REPO: ${{ github.workspace }}/openvino_tokenizers | |
BUILD_DIR: ${{ github.workspace }}/openvino_tokenizers/build | |
steps: | |
- name: Clone Openvino tokenizers sources and tests | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
path: ${{ env.OPENVINO_TOKENIZERS_REPO }} | |
- name: Setup Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
- name: Download tokenizers package | |
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 | |
with: | |
name: openvino_tokenizers_wheel | |
path: ${{ env.INSTALL_DIR }}/ov_tokenizers | |
- name: Download OpenVINO package | |
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 | |
with: | |
name: ${{ needs.openvino_download.outputs.ov_artifact_name }} | |
path: ${{ env.INSTALL_DIR }} | |
merge-multiple: true | |
- name: Install OpenVINO Python wheel from pre-built artifacts | |
run: | | |
python3 -m pip install openvino==${{ needs.openvino_download.outputs.ov_version }} ${{ needs.openvino_download.outputs.ov_wheel_source }} | |
working-directory: ${{ env.INSTALL_DIR }} | |
- name: Install OpenVINO tokenizers wheel | |
run: | | |
# Find and install wheel | |
wheel_name=$(find . -name 'openvino_tokenizers*.whl') | |
python3 -m pip install $wheel_name[dev] | |
working-directory: ${{ env.INSTALL_DIR }}/ov_tokenizers | |
env: | |
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" | |
- name: Tokenizers regression tests (using openvino python wheel) | |
run: python3 -m pytest tokenizers_test.py | |
working-directory: ${{ env.OPENVINO_TOKENIZERS_REPO }}/tests | |
Overall_Status: | |
name: ci/gha_overall_status_macos | |
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 |