diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 000000000..9812170bf --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,241 @@ +name: Linux (Ubuntu 20.04, Python 3.11) +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + - 'releases/**' + +concurrency: + # github.ref is not unique in post-commit + group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-linux + cancel-in-progress: true + +env: + PYTHON_VERSION: '3.11' + +jobs: + openvino_build: + timeout-minutes: 150 + defaults: + run: + shell: bash + runs-on: aks-linux-16-cores-32gb + container: + image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04 + volumes: + - /mount:/mount + options: -e SCCACHE_AZURE_BLOB_CONTAINER -e SCCACHE_AZURE_CONNECTION_STRING + env: + DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input + CMAKE_BUILD_TYPE: 'Release' + CMAKE_GENERATOR: 'Ninja Multi-Config' + CMAKE_CXX_COMPILER_LAUNCHER: sccache + CMAKE_C_COMPILER_LAUNCHER: sccache + SCCACHE_IGNORE_SERVER_IO_ERROR: 1 + SCCACHE_SERVER_PORT: 35555 + SCCACHE_ERROR_LOG: /__w/openvino/sccache_log.txt + SCCACHE_LOG: warn + SCCACHE_AZURE_KEY_PREFIX: ubuntu20_x86_64_Release + GITHUB_WORKSPACE: '/__w/openvino/openvino' + OPENVINO_REPO: /__w/openvino/openvino/openvino + INSTALL_DIR: /__w/openvino/openvino/openvino_install + BUILD_DIR: /__w/openvino/openvino/openvino_build + + steps: + - name: Set apt retries + run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries + + - name: Install git + run: | + apt-get update + apt-get install --assume-yes --no-install-recommends git ca-certificates + + - name: Clone OpenVINO + uses: actions/checkout@v4 + with: + repository: 'openvinotoolkit/openvino' + path: ${{ env.OPENVINO_REPO }} + submodules: 'true' + ref: master + + # + # Dependencies + # + + - name: Install build dependencies + run: | + bash ${OPENVINO_REPO}/install_build_dependencies.sh + + - name: Install sccache + uses: mozilla-actions/sccache-action@v0.0.4 + with: + version: "v0.7.5" + + - name: Setup Python ${{ env.PYTHON_VERSION }} + uses: ./openvino/.github/actions/setup_python + with: + version: ${{ env.PYTHON_VERSION }} + pip-cache-path: ${{ env.PIP_CACHE_PATH }} + should-setup-pip-paths: 'true' + self-hosted-runner: 'true' + show-cache-info: 'true' + + - name: Install python dependencies + run: | + # For Python API: build and wheel packaging + python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt + + # + # Build + # + + - name: CMake configure - OpenVINO + run: | + cmake \ + -G "${{ env.CMAKE_GENERATOR }}" \ + -DENABLE_CPPLINT=OFF \ + -DENABLE_NCC_STYLE=OFF \ + -DENABLE_TESTS=ON \ + -DENABLE_STRICT_DEPENDENCIES=OFF \ + -DENABLE_SYSTEM_TBB=ON \ + -DENABLE_SYSTEM_OPENCL=ON \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DCPACK_GENERATOR=TGZ \ + -DCMAKE_COMPILE_WARNING_AS_ERROR=ON \ + -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CMAKE_CXX_COMPILER_LAUNCHER }} \ + -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CMAKE_C_COMPILER_LAUNCHER }} \ + -S ${OPENVINO_REPO} \ + -B ${BUILD_DIR} + + - name: Clean sccache stats + run: ${SCCACHE_PATH} --zero-stats + + - name: Cmake build - OpenVINO + run: cmake --build ${BUILD_DIR} --parallel --config ${{ env.CMAKE_BUILD_TYPE }} + + - name: Show sccache stats + run: ${SCCACHE_PATH} --show-stats + + - name: Cmake install - OpenVINO + run: | + cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -P ${BUILD_DIR}/cmake_install.cmake + cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCOMPONENT=python_wheels -P ${BUILD_DIR}/cmake_install.cmake + + - name: Pack Artifacts + run: | + pushd ${INSTALL_DIR} + tar -czvf ${BUILD_DIR}/openvino_package.tar.gz * + popd + + # + # Upload build artifacts and logs + # + - name: Upload build logs + uses: actions/upload-artifact@v3 + if: always() + with: + name: build_logs + path: ${{ env.SCCACHE_ERROR_LOG }} + if-no-files-found: 'ignore' + + - name: Upload openvino package + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: openvino_package + path: ${{ env.BUILD_DIR }}/openvino_package.tar.gz + if-no-files-found: 'error' + + Openvino_tokenizers: + name: OpenVINO tokenizers extension + needs: [ Build ] + timeout-minutes: 25 + defaults: + run: + shell: bash + runs-on: aks-linux-4-cores-16gb + container: + image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04 + volumes: + - /mount:/mount + + env: + INSTALL_DIR: /__w/openvino/openvino/install + OPENVINO_REPO: /__w/openvino/openvino/openvino + OPENVINO_TOKENIZERS_REPO: /__w/openvino/openvino/openvino_tokenizers + BUILD_DIR: /__w/openvino/openvino/openvino_tokenizers + + steps: + - name: checkout action + uses: actions/checkout@v4 + with: + repository: 'openvinotoolkit/openvino' + sparse-checkout: | + .github/actions/setup_python + install_build_dependencies.sh + + - name: Setup Python ${{ env.PYTHON_VERSION }} + uses: ./.github/actions/setup_python + with: + version: ${{ env.PYTHON_VERSION }} + pip-cache-path: ${{ env.PIP_CACHE_PATH }} + should-setup-pip-paths: 'true' + self-hosted-runner: 'true' + show-cache-info: 'false' + + - name: Clone Openvino tokenizers + uses: actions/checkout@v4 + with: + path: ${{ env.OPENVINO_TOKENIZERS_REPO }} + submodules: 'true' + + - name: Download OpenVINO package + uses: actions/download-artifact@v3 + with: + name: openvino_package + path: ${{ env.INSTALL_DIR }} + + - name: Extract OpenVINO packages + run: | + pushd ${INSTALL_DIR} + tar -xzf openvino_package.tar.gz -C ${INSTALL_DIR} + popd + + # + # Dependencies + # + + - name: Install build dependencies + run: ./install_build_dependencies.sh + + - name: Install python dependencies + run: | + # wheel packaging + python3 -m pip install -r ${OPENVINO_TOKENIZERS_REPO}/requirements-build.txt + + # + # Build + # + + - name: Build tokenizers wheel + 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' + + # + # Upload build artifacts + # + + - name: Upload openvino tokenizers wheel + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: openvino_tokenizers_wheel + path: ${{ env.EXTENSION_BUILD_DIR }}/*.whl + if-no-files-found: 'error' \ No newline at end of file