Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[CI] [GHA] Add Ubuntu 22 x86_64 -> ARM64 workflow (#31335)

Andrei Kashchikhin786f53d93c8b
diff --git a/.github/actions/common/constants.py b/.github/actions/common/constants.py
index e3d2e68b245..01997f78bfb 100644
--- a/.github/actions/common/constants.py
+++ b/.github/actions/common/constants.py
@@ -11,6 +11,7 @@ productTypes = (
'public_linux_fedora_29_x86_64_release',
'public_linux_ubuntu_20_04_x86_64_release',
'public_linux_ubuntu_22_04_arm64_release',
+ 'public_linux_ubuntu_22_04_arm64_cross_compile_release',
'public_linux_ubuntu_22_04_x86_64_release',
'public_linux_ubuntu_22_04_dpcpp_x86_64_release',
'public_linux_ubuntu_24_04_x86_64_release',
@@ -31,6 +32,7 @@ platformKeys = (
'debian10_armhf',
'rhel8_x86_64',
'ubuntu22_arm64',
+ 'ubuntu22_arm64_cross_compile',
'ubuntu20_x86_64',
'ubuntu22_x86_64',
'ubuntu24_x86_64',
@@ -44,6 +46,7 @@ PlatformMapping = {
PlatformKey.DEBIAN10_ARMHF: ProductType.PUBLIC_LINUX_DEBIAN_10_ARM_RELEASE,
PlatformKey.UBUNTU20_X86_64: ProductType.PUBLIC_LINUX_UBUNTU_20_04_X86_64_RELEASE,
PlatformKey.UBUNTU22_ARM64: ProductType.PUBLIC_LINUX_UBUNTU_22_04_ARM64_RELEASE,
+ PlatformKey.UBUNTU22_ARM64_CROSS_COMPILE: ProductType.PUBLIC_LINUX_UBUNTU_22_04_ARM64_CROSS_COMPILE_RELEASE,
PlatformKey.UBUNTU22_X86_64: ProductType.PUBLIC_LINUX_UBUNTU_22_04_X86_64_RELEASE,
PlatformKey.UBUNTU24_X86_64: ProductType.PUBLIC_LINUX_UBUNTU_24_04_X86_64_RELEASE,
PlatformKey.WINDOWS_X86_64: ProductType.PUBLIC_WINDOWS_VS2022_RELEASE,
diff --git a/.github/dockerfiles/docker_tag b/.github/dockerfiles/docker_tag
index 7d306927234..86ac40243fa 100644
--- a/.github/dockerfiles/docker_tag
+++ b/.github/dockerfiles/docker_tag
@@ -1 +1 @@
-pr-31514
+pr-31335
\ No newline at end of file
diff --git a/.github/dockerfiles/ov_build/ubuntu_22_04_arm64_cross_compilation/Dockerfile b/.github/dockerfiles/ov_build/ubuntu_22_04_arm64_cross_compilation/Dockerfile
new file mode 100644
index 00000000000..524de9fc22a
--- /dev/null
+++ b/.github/dockerfiles/ov_build/ubuntu_22_04_arm64_cross_compilation/Dockerfile
@@ -0,0 +1,144 @@
+ARG REGISTRY="docker.io"
+FROM ${REGISTRY}/library/ubuntu:22.04
+
+USER root
+
+SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
+
+# APT configuration
+RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf && \
+ echo 'APT::Get::Assume-Yes "true";' >> /etc/apt/apt.conf && \
+ echo 'APT::Get::Fix-Broken "true";' >> /etc/apt/apt.conf && \
+ echo 'APT::Get::no-install-recommends "true";' >> /etc/apt/apt.conf
+
+# Arm libraries are now in ports.ubuntu.com
+RUN sed -i 's/^deb /deb [arch=amd64] /g' /etc/apt/sources.list
+RUN echo -e "\ndeb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy main universe\ndeb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main universe" >> /etc/apt/sources.list
+
+ENV DEBIAN_FRONTEND="noninteractive" \
+ TZ="Europe/London"
+
+RUN dpkg --add-architecture arm64 && \
+ apt-get update && \
+ apt-get install software-properties-common && \
+ apt-get update && \
+ apt-get install \
+ pciutils \
+ dmidecode \
+ clinfo \
+ lshw \
+ procps \
+ g++ \
+ ninja-build \
+ smbclient \
+ software-properties-common \
+ crossbuild-essential-arm64 \
+ libpython3-dev:arm64 \
+ python3-pip \
+ libsqlite3-dev \
+ libsqlite3-dev:arm64 \
+ zlib1g-dev:arm64 \
+ libgflags2.2:arm64 \
+ libgflags-dev:arm64 \
+ libpugixml1v5:arm64 \
+ libtbb2:arm64 \
+ nlohmann-json3-dev \
+ libpugixml-dev:arm64 \
+ libtbb-dev:arm64 \
+ shellcheck \
+ lintian \
+ libffi-dev \
+ libssl-dev \
+ chrpath \
+ libssl-dev \
+ libprotobuf-dev \
+ libprotoc-dev \
+ protobuf-compiler \
+ lcov \
+ # parallel gzip
+ pigz \
+ # For ARM CPU plugin
+ scons \
+ # To extract OpenCV .xz archives
+ liblzma-dev \
+ # For wheel packaging
+ patchelf \
+ # check python wheel for duplicated files
+ fdupes \
+ # Need to curl from pypa without warnings
+ openssl \
+ # For Java API
+ default-jdk \
+ # To build documentation
+ graphviz \
+ texlive \
+ liblua5.2-0 \
+ # JS API
+ libgtk-3-0 \
+ libgbm1 \
+ && \
+ rm -rf /var/lib/apt/lists/*
+
+# Install build dependencies
+ADD install_build_dependencies.sh /install_build_dependencies.sh
+RUN chmod +x /install_build_dependencies.sh && \
+ bash -e /install_build_dependencies.sh && \
+ rm -rf /var/lib/apt/lists/*
+
+# For cross-compilation for ARM64. If installed in the first `apt-get install` command, it will be removed by the install_build_dependencies.sh script
+RUN apt-get update && \
+ apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
+
+# Install sscache
+ARG SCCACHE_VERSION="v0.7.5"
+ENV SCCACHE_HOME="/opt/sccache" \
+ SCCACHE_PATH="/opt/sccache/sccache"
+
+RUN mkdir ${SCCACHE_HOME} && cd ${SCCACHE_HOME} && \
+ SCCACHE_ARCHIVE="sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" && \
+ curl -SLO https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/${SCCACHE_ARCHIVE} && \
+ tar -xzf ${SCCACHE_ARCHIVE} --strip-components=1 && rm ${SCCACHE_ARCHIVE}
+
+ENV PIP_VERSION="24.0"
+# To cross-compile Python 3.11 we need to first compile it for the host
+RUN curl -O https://www.python.org/ftp/python/3.11.3/Python-3.11.3.tar.xz && \
+ tar -xf Python-3.11.3.tar.xz && \
+ cd Python-3.11.3 && ./configure && make -j4 && make altinstall && \
+ curl https://bootstrap.pypa.io/get-pip.py | python3.11 - --no-cache-dir pip==${PIP_VERSION} numpy cython crossenv
+
+# Cross-compile Python 3.11 for ARM64
+RUN cd Python-3.11.3 && make distclean && \
+ ./configure \
+ --host=aarch64-linux-gnu \
+ --build=x86_64-linux-gnu \
+ --disable-ipv6 \
+ --enable-shared \
+ --prefix=/opt/python3.11_arm \
+ --with-build-python \
+ ac_cv_file__dev_ptmx=no \
+ ac_cv_file__dev_ptc=no && \
+ make -j4 && make altinstall
+
+ENV PATH="$SCCACHE_HOME:$PATH"
+ENV PIP_CACHE_DIR=/mount/caches/pip/linux/${PIP_VERSION}
+
+# Use Python 3.11 as default
+# Using venv here because other methods to switch the default Python break both system and wheels build
+RUN python3.11 -m venv venv
+ENV PATH="/venv/bin:$PATH"
+
+# Install Node
+ENV NODE_VERSION=21.7.3
+ENV NVM_DIR=/.nvm
+RUN mkdir -p $NVM_DIR
+RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
+RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
+ENV PATH="$NVM_DIR/versions/node/v${NODE_VERSION}/bin/:${PATH}"
+
+# Install doxygen
+ENV DOXYGEN_HOME="/opt/doxygen"
+ENV DOXYGEN_VERSION='1.9.6'
+RUN mkdir -p ${DOXYGEN_HOME} && cd ${DOXYGEN_HOME} && wget https://www.doxygen.nl/files/doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz && \
+ tar -I pigz -xf doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz && \
+ rm -f doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz
+ENV PATH="${DOXYGEN_HOME}/doxygen-$DOXYGEN_VERSION/bin:$PATH"
diff --git a/.github/workflows/ubuntu_22_arm64_cross_compilation.yml b/.github/workflows/ubuntu_22_arm64_cross_compilation.yml
new file mode 100644
index 00000000000..11f527b3495
--- /dev/null
+++ b/.github/workflows/ubuntu_22_arm64_cross_compilation.yml
@@ -0,0 +1,190 @@
+name: Linux (Ubuntu 22.04, ARM64 cross-compilation, Python 3.11)
+on:
+ workflow_dispatch:
+ inputs:
+ target-branch:
+ description: 'Target branch for the build; taken from event context by default'
+ type: string
+ required: false
+ 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 }}-ubuntu-22-arm64-cross-compilation
+ cancel-in-progress: true
+
+permissions: read-all
+
+env:
+ PIP_CACHE_PATH: /mount/caches/pip/linux
+ PYTHON_VERSION: '3.11'
+ TARGET_BRANCH: ${{ inputs.target-branch || github.base_ref || github.event.merge_group.base_ref || github.ref }}
+
+jobs:
+ Smart_CI:
+ runs-on: ubuntu-latest
+ outputs:
+ affected_components: "${{ steps.smart_ci.outputs.affected_components }}"
+ changed_components: "${{ steps.smart_ci.outputs.changed_components }}"
+ skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}"
+ steps:
+ - name: checkout action
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ timeout-minutes: 15
+ with:
+ sparse-checkout: .github/actions/smart-ci
+
+ - name: Get affected components
+ id: smart_ci
+ uses: ./.github/actions/smart-ci
+ with:
+ repository: ${{ github.repository }}
+ pr: ${{ github.event.number }}
+ commit_sha: ${{ github.sha }}
+ ref_name: ${{ github.ref_name }}
+ component_pattern: "category: (.*)"
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
+ skip_when_only_listed_labels_set: 'docs'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg'
+
+ - name: Show affected components
+ run: |
+ echo "${{ toJSON(steps.smart_ci.outputs.affected_components) }}"
+ shell: bash
+
+ Docker:
+ needs: Smart_CI
+ runs-on: aks-linux-4-cores-16gb-docker-build
+ container:
+ image: openvinogithubactions.azurecr.io/docker_build:0.2
+ volumes:
+ - /mount:/mount
+ outputs:
+ images: "${{ steps.handle_docker.outputs.images && steps.handle_docker.outputs.images || steps.mock_image.outputs.images }}"
+ steps:
+ - name: Set mock output images if pipeline should be skipped
+ if: ${{ needs.smart_ci.outputs.skip_workflow == 'True' }}
+ id: mock_image
+ run: echo "images={\"ov_test\":{\"ubuntu_22_04_x64\":\"mock\"},\"ov_build\":{\"ubuntu_22_04_arm64_cross_compilation\":\"mock\"}}" >> "$GITHUB_OUTPUT"
+
+ - name: Checkout
+ if: ${{ needs.smart_ci.outputs.skip_workflow != 'True' }}
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ timeout-minutes: 15
+
+ - uses: ./.github/actions/handle_docker
+ if: ${{ needs.smart_ci.outputs.skip_workflow != 'True' }}
+ id: handle_docker
+ with:
+ images: |
+ ov_build/ubuntu_22_04_arm64_cross_compilation
+ ov_test/ubuntu_22_04_x64
+ registry: 'openvinogithubactions.azurecr.io'
+ dockerfiles_root_dir: '.github/dockerfiles'
+ changed_components: ${{ needs.smart_ci.outputs.changed_components }}
+
+ Docker_arm64:
+ needs: Smart_CI
+ runs-on: aks-linux-4-cores-8gb-arm-docker-build
+ container:
+ image: openvinogithubactions.azurecr.io/docker_build:0.2
+ volumes:
+ - /mount:/mount
+ outputs:
+ images: "${{ steps.handle_docker.outputs.images && steps.handle_docker.outputs.images || steps.mock_image.outputs.images }}"
+ steps:
+ - name: Set mock output images if pipeline should be skipped
+ if: ${{ needs.smart_ci.outputs.skip_workflow == 'True' }}
+ id: mock_image
+ run: echo "images={\"ov_test\":{\"ubuntu_22_04_arm64\":\"mock\"},\"ov_build\":{\"ubuntu_22_04_arm64_cross_compilation\":\"mock\"}}" >> "$GITHUB_OUTPUT"
+
+ - name: Checkout
+ if: ${{ needs.smart_ci.outputs.skip_workflow != 'True' }}
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ timeout-minutes: 15
+
+ - uses: ./.github/actions/handle_docker
+ if: ${{ needs.smart_ci.outputs.skip_workflow != 'True' }}
+ id: handle_docker
+ with:
+ images: |
+ ov_test/ubuntu_22_04_arm64
+ registry: 'openvinogithubactions.azurecr.io'
+ dockerfiles_root_dir: '.github/dockerfiles'
+ changed_components: ${{ needs.smart_ci.outputs.changed_components }}
+
+ Build:
+ needs: [Docker, Smart_CI]
+ if: "!needs.smart_ci.outputs.skip_workflow"
+ uses: ./.github/workflows/job_build_linux.yml
+ with:
+ runner: 'aks-linux-16-cores-32gb'
+ image: ${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_22_04_arm64_cross_compilation }}
+ affected-components: ${{ needs.smart_ci.outputs.affected_components }}
+ event-name: ${{ github.event_name }}
+ os: 'ubuntu_22_04'
+ arch: 'arm64_cross_compile'
+ build-js: true
+ build-contrib: false
+ build-debian-packages: false
+ build-rpm-packages: false
+ build-additional-python-packages: false
+ target-branch: ${{ inputs.target-branch }}
+ cmake-options: >-
+ -G 'Ninja'
+ -DENABLE_CPPLINT=OFF
+ -DOV_CPU_ARM_TARGET_ARCH=arm64-v8a
+ -DTHREADS_PTHREAD_ARG=-pthread
+ -DPYTHON_MODULE_EXTENSION=.cpython-311-aarch64-linux-gnu.so
+ -DPython3_INCLUDE_DIR=/opt/python3.11_arm/include/python3.11
+ -DCMAKE_TOOLCHAIN_FILE=cmake/arm64.toolchain.cmake
+ -DENABLE_NCC_STYLE=OFF
+ -DENABLE_TESTS=ON
+ -DENABLE_STRICT_DEPENDENCIES=OFF
+ -DENABLE_SYSTEM_OPENCL=ON
+ -DCMAKE_VERBOSE_MAKEFILE=ON
+ -DCPACK_GENERATOR=TGZ
+ -DENABLE_WHEEL=ON
+ -DENABLE_PYTHON=ON
+ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
+ -DENABLE_FASTER_BUILD=ON
+
+ Python_API_Tests:
+ name: Python API tests
+ needs: [ Build, Smart_CI, Docker_arm64 ]
+ uses: ./.github/workflows/job_python_api_tests.yml
+ with:
+ runner: 'aks-linux-8-cores-16gb-arm'
+ image: ${{ fromJSON(needs.docker_arm64.outputs.images).ov_test.ubuntu_22_04_arm64 }}
+ affected-components: ${{ needs.smart_ci.outputs.affected_components }}
+ python-version: '3.11'
+
+ CPU_Functional_Tests:
+ name: CPU functional tests
+ if: fromJSON(needs.smart_ci.outputs.affected_components).CPU.test
+ needs: [ Build, Smart_CI, Docker_arm64 ]
+ uses: ./.github/workflows/job_cpu_functional_tests.yml
+ with:
+ runner: 'aks-linux-16-cores-arm'
+ image: ${{ fromJSON(needs.docker_arm64.outputs.images).ov_test.ubuntu_22_04_arm64 }}
+ python-version: '3.11'
+ scope: 'smoke'
+
+ Overall_Status:
+ name: ci/gha_overall_status_ubuntu_22_arm64_cross_compilation
+ needs: [Smart_CI, Build, Python_API_Tests, CPU_Functional_Tests, Docker]
+ 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
diff --git a/.github/workflows/workflow_rerunner.yml b/.github/workflows/workflow_rerunner.yml
index e1d04f16982..05687c7b64c 100644
--- a/.github/workflows/workflow_rerunner.yml
+++ b/.github/workflows/workflow_rerunner.yml
@@ -9,6 +9,7 @@ on:
- "Android ARM64 with vcpkg"
- "Android x64"
- "Linux ARM64 (Ubuntu 22.04, Python 3.11)"
+ - "Linux (Ubuntu 22.04, ARM64 cross-compilation, Python 3.11)"
- "Linux Static CC (Ubuntu 22.04, Python 3.11, Clang)"
- "Linux RISC-V with Conan (Ubuntu 22.04, Python 3.10)"
- "Linux (Ubuntu 22.04, Python 3.11, Intel DPC\\+\\+ Compiler)"