Skip to content

Commit

Permalink
U22 adoption in github actions (#12550)
Browse files Browse the repository at this point in the history
* Supported newer versions of shellcheck

* Don't use excluded sources

* Improved NCC process of clang search

* Fixes
  • Loading branch information
ilya-lavrenov authored Aug 14, 2022
1 parent cbbac12 commit aecab4d
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 57 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]
jobs:
Build_Doc:
if: github.repository == 'openvinotoolkit/openvino'
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Clone OpenVINO
uses: actions/checkout@v2
Expand All @@ -17,11 +17,11 @@ jobs:
set -e
# install doc dependencies
sudo apt update
sudo apt --assume-yes install libusb-1.0-0-dev graphviz texlive
sudo apt --assume-yes install libusb-1.0-0-dev graphviz texlive liblua5.2-0
cd docs
python -m pip install -r requirements.txt --user
python3 -m pip install -r requirements.txt --user
cd openvino_sphinx_theme
python setup.py install --user
python3 setup.py install --user
cd ../..
# install doxyrest
wget https://github.com/vovkos/doxyrest/releases/download/doxyrest-2.1.3/doxyrest-2.1.3-linux-amd64.tar.xz
Expand All @@ -43,7 +43,7 @@ jobs:
run: |
mkdir build
cd build
cmake -DENABLE_DOCS=ON -DENABLE_PYTHON=ON -DNGRAPH_PYTHON_BUILD_ENABLE=ON -DCMAKE_BUILD_TYPE=Release ..
cmake -DENABLE_DOCS=ON -DENABLE_PYTHON=ON -DCMAKE_BUILD_TYPE=Release ..
- name: Build doc
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_pr_commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [pull_request]

jobs:
Checks:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Clone OpenVINO
uses: actions/checkout@v2
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/code_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
path: build/code_style_diff.diff

ShellCheck:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -73,7 +73,7 @@ jobs:
working-directory: build

NamingConventionCheck:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -82,8 +82,8 @@ jobs:
- name: Install Clang dependency
run: |
sudo apt update
sudo apt --assume-yes remove clang-7 clang-8 clang-9 clang-10 clang-11
sudo apt --assume-yes install libclang-12-dev
sudo apt --assume-yes remove clang-7 clang-8 clang-9 clang-10 clang-11 clang-12 clang-13
sudo apt --assume-yes install libclang-14-dev
- name: Install Python-based dependencies
run: python3 -m pip install -r cmake/developer_package/ncc_naming_style/requirements_dev.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/files_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

jobs:
Check_Files_Size:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
Pylint-UT:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/py_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- 'samples/python/**'
jobs:
linters:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Code checkout
uses: actions/checkout@v2
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.6'
python-version: '3.10'
- name: Install dependencies
run: python -m pip install -r src/bindings/python/requirements_test.txt
# samples code-style
Expand Down
11 changes: 3 additions & 8 deletions cmake/developer_package/clang_format/clang_format.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ if(ENABLE_CLANG_FORMAT AND NOT TARGET clang_format_check_all)
add_custom_target(clang_format_fix_all)
set_target_properties(clang_format_check_all clang_format_fix_all
PROPERTIES FOLDER clang_format)
set(CLANG_FORMAT_ALL_OUTPUT_FILES "" CACHE INTERNAL "All clang-format output files")
endif()

function(add_clang_format_target TARGET_NAME)
Expand Down Expand Up @@ -88,14 +87,10 @@ function(add_clang_format_target TARGET_NAME)
"[clang-format] ${source_file}"
VERBATIM)

list(APPEND all_input_sources "${source_file}")
list(APPEND all_output_files "${output_file}")
endforeach()

set(CLANG_FORMAT_ALL_OUTPUT_FILES
${CLANG_FORMAT_ALL_OUTPUT_FILES} ${all_output_files}
CACHE INTERNAL
"All clang-format output files")

add_custom_target(${TARGET_NAME}
DEPENDS ${all_output_files}
COMMENT "[clang-format] ${TARGET_NAME}")
Expand All @@ -104,11 +99,11 @@ function(add_clang_format_target TARGET_NAME)
COMMAND
"${CMAKE_COMMAND}"
-D "CLANG_FORMAT=${CLANG_FORMAT}"
-D "INPUT_FILES=${CLANG_FORMAT_FOR_SOURCES}"
-D "INPUT_FILES=${all_input_sources}"
-D "EXCLUDE_PATTERNS=${CLANG_FORMAT_EXCLUDE_PATTERNS}"
-P "${IEDevScripts_DIR}/clang_format/clang_format_fix.cmake"
DEPENDS
"${CLANG_FORMAT_FOR_SOURCES}"
"${all_input_sources}"
"${IEDevScripts_DIR}/clang_format/clang_format_fix.cmake"
COMMENT
"[clang-format] ${TARGET_NAME}_fix"
Expand Down
40 changes: 25 additions & 15 deletions cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,42 @@ endif()
set(ncc_style_dir "${IEDevScripts_DIR}/ncc_naming_style")
set(ncc_style_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/ncc_naming_style")

# find python3

find_package(PythonInterp 3 QUIET)
if(NOT PYTHONINTERP_FOUND)
message(WARNING "Python3 interpreter was not found (required for ncc naming style check)")
set(ENABLE_NCC_STYLE OFF)
endif()

if(PYTHON_VERSION_MINOR EQUAL 6)
set(clang_version 10)
elseif(PYTHON_VERSION_MINOR EQUAL 8)
set(clang_version 12)
elseif(PYTHON_VERSION_MINOR EQUAL 9)
set(clang_version 12)
elseif(PYTHON_VERSION_MINOR EQUAL 10)
set(clang_version 14)
endif()


if(ENABLE_NCC_STYLE)
# try to find_package(Clang QUIET)
# ClangConfig.cmake contains bug that if libclang-XX-dev is not
# installed, then find_package fails with errors even in QUIET mode
configure_file("${ncc_style_dir}/try_find_clang.cmake"
"${ncc_style_bin_dir}/source/CMakeLists.txt" COPYONLY)
execute_process(
COMMAND
"${CMAKE_COMMAND}" -S "${ncc_style_bin_dir}/source"
-B "${ncc_style_bin_dir}/build"
COMMAND "${CMAKE_COMMAND}" -S "${ncc_style_bin_dir}/source"
-B "${ncc_style_bin_dir}/build"
RESULT_VARIABLE clang_find_result
OUTPUT_VARIABLE output_var
ERROR_VARIABLE error_var)

if(NOT clang_find_result EQUAL "0")
message(WARNING "Please, install clang-[N] libclang-[N]-dev package (required for ncc naming style check)")
message(WARNING "find_package(Clang) output: ${output_var}")
message(WARNING "find_package(Clang) error: ${error_var}")
message(WARNING "Please, install `apt-get install clang-${clang_version} libclang-${clang_version}-dev` package (required for ncc naming style check)")
message(TRACE "find_package(Clang) output: ${output_var}")
message(TRACE "find_package(Clang) error: ${error_var}")
set(ENABLE_NCC_STYLE OFF)
endif()
endif()
Expand All @@ -39,19 +57,11 @@ if(ENABLE_NCC_STYLE)
get_target_property(libclang_location libclang LOCATION)
message(STATUS "Found libclang: ${libclang_location}")
else()
message(WARNING "libclang is not found (required for ncc naming style check)")
message(WARNING "libclang-${clang_version} is not found (required for ncc naming style check)")
set(ENABLE_NCC_STYLE OFF)
endif()
endif()

# find python3

find_package(PythonInterp 3 QUIET)
if(NOT PYTHONINTERP_FOUND)
message(WARNING "Python3 interpreter was not found (required for ncc naming style check)")
set(ENABLE_NCC_STYLE OFF)
endif()

# check python requirements_dev.txt

set(ncc_script_py "${ncc_style_dir}/ncc/ncc.py")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
clang==11.0
clang==10.0.1; python_version == '3.6'
clang==12.0.1; python_version == '3.8'
clang==12.0.1; python_version == '3.9'
clang==14.0; python_version == '3.10'
pyyaml
13 changes: 12 additions & 1 deletion cmake/developer_package/shellcheck/shellcheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ include(CMakeParseArguments)

find_host_program(shellcheck_PROGRAM NAMES shellcheck DOC "Path to shellcheck tool")

if(shellcheck_PROGRAM)
execute_process(COMMAND "${shellcheck_PROGRAM}" --version
RESULT_VARIABLE shellcheck_EXIT_CODE
OUTPUT_VARIABLE shellcheck_VERSION_STRING)
if(shellcheck_EXIT_CODE EQUAL 0)
if(shellcheck_VERSION_STRING MATCHES "version: ([0-9]+)\.([0-9]+).([0-9]+)")
set(shellcheck_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}" CACHE STRING "shellcheck version")
endif()
endif()
endif()

function(ie_shellcheck_process)
if(NOT shellcheck_PROGRAM)
message(WARNING "shellcheck tool is not found")
Expand Down Expand Up @@ -33,7 +44,7 @@ function(ie_shellcheck_process)
set(output_file "${output_file}.txt")
get_filename_component(script_name "${script}" NAME)

add_custom_command(OUTPUT ${output_file}
add_custom_command(OUTPUT ${output_file}
COMMAND ${CMAKE_COMMAND}
-D IE_SHELLCHECK_PROGRAM=${shellcheck_PROGRAM}
-D IE_SHELL_SCRIPT=${script}
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ py==1.10.0
pydata-sphinx-theme==0.7.2
Pygments==2.8.1
pyparsing==2.4.7
pytest==6.2.3
pytest==6.2.5
pytest-html==3.1.1
pytest-metadata==1.11.0
pytz==2021.1
Expand Down
6 changes: 3 additions & 3 deletions install_build_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ if [ -f /etc/lsb-release ]; then
# Ubuntu
host_cpu=$(uname -m)
if [ "$host_cpu" = "x86_64" ]; then
x86_64_specific_packages="gcc-multilib g++-multilib"
x86_64_specific_packages=(gcc-multilib g++-multilib)
else
x86_64_specific_packages=""
x86_64_specific_packages=()
fi

sudo -E apt update
Expand All @@ -40,7 +40,7 @@ if [ -f /etc/lsb-release ]; then
ca-certificates \
git \
git-lfs \
$x86_64_specific_packages \
"${x86_64_specific_packages[@]}" \
libgtk2.0-dev \
unzip \
shellcheck \
Expand Down
37 changes: 23 additions & 14 deletions scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,30 @@
# Shellcheck
#

set(shellcheck_skip_list
"${OpenVINO_SOURCE_DIR}/bin"
"${OpenVINO_SOURCE_DIR}/build"
"${OpenVINO_SOURCE_DIR}/thirdparty"
"${OpenVINO_SOURCE_DIR}/src/plugins/intel_cpu/thirdparty"
"${OpenVINO_SOURCE_DIR}/src/plugins/intel_gpu/thirdparty"
"${OpenVINO_SOURCE_DIR}/src/bindings/python/thirdparty/pybind11"
"${OpenVINO_SOURCE_DIR}/tools/pot/thirdparty"
"${TEMP}")

# TODO fix and enable back
list(APPEND shellcheck_skip_list
"${OpenVINO_SOURCE_DIR}/scripts/install_dependencies/install_NEO_OCL_driver.sh"
"${OpenVINO_SOURCE_DIR}/scripts/install_dependencies/install_openvino_dependencies.sh"
"${OpenVINO_SOURCE_DIR}/src/bindings/python/tests/test_onnx/model_zoo_preprocess.sh"
"${OpenVINO_SOURCE_DIR}/src/bindings/python/tests_compatibility/test_onnx/model_zoo_preprocess.sh")

if(shellcheck_VERSION VERSION_GREATER_EQUAL 0.7.0)
list(APPEND shellcheck_skip_list
"${OpenVINO_SOURCE_DIR}/scripts/setupvars/setupvars.sh")
endif()

ie_shellcheck_process(DIRECTORY "${OpenVINO_SOURCE_DIR}"
SKIP "${OpenVINO_SOURCE_DIR}/bin"
"${OpenVINO_SOURCE_DIR}/build"
"${OpenVINO_SOURCE_DIR}/thirdparty"
"${OpenVINO_SOURCE_DIR}/src/plugins/intel_cpu/thirdparty"
"${OpenVINO_SOURCE_DIR}/src/plugins/intel_gpu/thirdparty"
"${OpenVINO_SOURCE_DIR}/src/bindings/python/thirdparty/pybind11"
"${OpenVINO_SOURCE_DIR}/tools/pot/thirdparty"
"${TEMP}"
# TODO fix and enable back:
"${OpenVINO_SOURCE_DIR}/scripts/install_dependencies/install_NEO_OCL_driver.sh"
"${OpenVINO_SOURCE_DIR}/scripts/install_dependencies/install_openvino_dependencies.sh"
"${OpenVINO_SOURCE_DIR}/src/bindings/python/tests/test_onnx/model_zoo_preprocess.sh"
"${OpenVINO_SOURCE_DIR}/src/bindings/python/tests_compatibility/test_onnx/model_zoo_preprocess.sh"
)
SKIP ${shellcheck_skip_list})

#
# cpack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if [[ -n "$2" ]]; then
else
# Windows default
if [[ -f "${TEST_DIR}/${APP_NAME}" ]]; then
# shellcheck disable=SC2269
TEST_DIR=${TEST_DIR}
# Search for Release or Debug config
elif [[ -f "${TEST_DIR}/Release/${APP_NAME}" ]]; then
Expand Down

0 comments on commit aecab4d

Please sign in to comment.