[GHA] Common apt configuration #2
Workflow file for this run
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: ONNX Runtime Integration | |
on: | |
workflow_call: | |
inputs: | |
runner: | |
description: 'Machine on which the tests would run' | |
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}' | |
sccache-azure-key-prefix: | |
description: 'Key prefix for the cache folder on the Azure' | |
type: string | |
required: true | |
jobs: | |
ONNX_Runtime: | |
name: ONNX Runtime Integration | |
timeout-minutes: 60 | |
runs-on: ${{ inputs.runner }} | |
container: ${{ fromJSON(inputs.container) }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input | |
OPENVINO_REPO: ${{ github.workspace }}/openvino | |
INSTALL_DIR: ${{ github.workspace }}/install | |
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_AZURE_KEY_PREFIX: ${{ inputs.sccache-azure-key-prefix }} | |
ONNX_RUNTIME_REPO: ${{ github.workspace }}/onnxruntime | |
ONNX_RUNTIME_UTILS: ${{ github.workspace }}/install/onnxruntime | |
ONNX_RUNTIME_BUILD_DIR: ${{ github.workspace }}/onnxruntime/build | |
steps: | |
- name: checkout action | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
.github/actions/setup_apt | |
- name: Setup apt | |
if: runner.os == 'Linux' | |
uses: ./.github/actions/setup_apt | |
- name: Setup apt cache | |
if: runner.os == 'Linux' | |
- name: Download OpenVINO package | |
uses: actions/download-artifact@v4 | |
with: | |
name: openvino_package | |
path: ${{ env.INSTALL_DIR }} | |
# Needed as ${{ github.workspace }} is not working correctly when using Docker | |
- name: Setup Variables | |
run: | | |
echo "OPENVINO_REPO=$GITHUB_WORKSPACE/openvino" >> "$GITHUB_ENV" | |
echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV" | |
echo "ONNX_RUNTIME_REPO=$GITHUB_WORKSPACE/onnxruntime" >> "$GITHUB_ENV" | |
echo "ONNX_RUNTIME_UTILS=$GITHUB_WORKSPACE/install/onnxruntime" >> "$GITHUB_ENV" | |
echo "ONNX_RUNTIME_BUILD_DIR=$GITHUB_WORKSPACE/onnxruntime/build" >> "$GITHUB_ENV" | |
- name: Fetch install_build_dependencies.sh and setup_python action | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
install_build_dependencies.sh | |
.github/actions/setup_python/action.yml | |
sparse-checkout-cone-mode: false | |
path: 'openvino' | |
- name: Install git | |
run: | | |
apt-get update | |
apt-get install --assume-yes --no-install-recommends git ca-certificates | |
- name: Setup Python ${{ env.PYTHON_VERSION }} | |
uses: ./openvino/.github/actions/setup_python | |
with: | |
version: '3.11' | |
should-setup-pip-paths: 'false' | |
- name: Extract OpenVINO package | |
run: | | |
pushd ${INSTALL_DIR} | |
tar -xzf openvino_package.tar.gz -C ${INSTALL_DIR} | |
popd | |
- name: Install OpenVINO dependencies | |
run: | | |
${INSTALL_DIR}/install_dependencies/install_openvino_dependencies.sh -c=core -c=dev -y | |
# since we are on Ubuntu 22.04, but compiled OpenVINO on Ubuntu 20.04, we need to install `libtbb2` | |
apt-get install --assume-yes --no-install-recommends libtbb2 | |
- name: Clone ONNX Runtime | |
run: | | |
hash=`tr -s '\n ' < ${ONNX_RUNTIME_UTILS}/version` | |
git clone --recursive https://github.com/microsoft/onnxruntime.git ${ONNX_RUNTIME_REPO} | |
cd ${ONNX_RUNTIME_REPO} | |
git checkout $hash | |
# | |
# Tests | |
# | |
- 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: Build Lin ONNX Runtime | |
run: | | |
source ${INSTALL_DIR}/setupvars.sh | |
${ONNX_RUNTIME_REPO}/build.sh \ | |
--config RelWithDebInfo \ | |
--use_openvino CPU \ | |
--build_shared_lib \ | |
--parallel \ | |
--skip_tests \ | |
--compile_no_warning_as_error \ | |
--allow_running_as_root \ | |
--build_dir ${ONNX_RUNTIME_BUILD_DIR} | |
env: | |
CXXFLAGS: "-Wno-error=deprecated-declarations" | |
- name: Show sccache stats | |
run: ${SCCACHE_PATH} --show-stats | |
- name: Run onnxruntime_test_all | |
if: ${{ runner.arch != 'ARM64' }} # Ticket: 126277 | |
run: | | |
# see https://github.com/microsoft/onnxruntime/issues/13197#issuecomment-1264542497 | |
apt-get install --assume-yes --no-install-recommends language-pack-en | |
locale-gen en_US.UTF-8 | |
update-locale LANG=en_US.UTF-8 | |
source ${INSTALL_DIR}/setupvars.sh | |
skip_tests=$(tr -s '\n ' ':' < ${ONNX_RUNTIME_UTILS}/skip_tests) | |
./onnxruntime_test_all --gtest_filter=-$skip_tests | |
working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo | |
- name: Run onnxruntime_shared_lib_test | |
run: | | |
source ${INSTALL_DIR}/setupvars.sh | |
./onnxruntime_shared_lib_test --gtest_filter=-CApiTest.test_custom_op_openvino_wrapper_library | |
working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo | |
- name: Run onnxruntime_global_thread_pools_test | |
run: | | |
source ${INSTALL_DIR}/setupvars.sh | |
./onnxruntime_global_thread_pools_test | |
working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo | |
- name: Run pytorch-converted tests | |
run: | | |
source ${INSTALL_DIR}/setupvars.sh | |
./onnx_test_runner "${ONNX_RUNTIME_REPO}/cmake/external/onnx/onnx/backend/test/data/pytorch-converted" | |
working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo | |
- name: Run pytorch-operator tests | |
run: | | |
source ${INSTALL_DIR}/setupvars.sh | |
./onnx_test_runner "${ONNX_RUNTIME_REPO}/cmake/external/onnx/onnx/backend/test/data/pytorch-operator" | |
working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo |