Skip to content

Commit 95e3096

Browse files
Added build on RedHat system to build & test RPM packages (openvinotoolkit#20134)
* Added GHA workflow for RPM packages * Avoid rebuild for RPM / Debian packages * Removed conditional include headers * try only post-build * Beautification * Fixed testdata generation for mulit-config generators
1 parent 86bf038 commit 95e3096

File tree

17 files changed

+296
-84
lines changed

17 files changed

+296
-84
lines changed

.github/workflows/fedora.yml

+224
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
name: Fedora (RHEL), Python 3.9
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
paths-ignore:
6+
- '**/docs/**'
7+
- 'docs/**'
8+
- '**/**.md'
9+
- '**.md'
10+
- '**/layer_tests_summary/**'
11+
- '**/conformance/**'
12+
push:
13+
paths-ignore:
14+
- '**/docs/**'
15+
- 'docs/**'
16+
- '**/**.md'
17+
- '**.md'
18+
- '**/layer_tests_summary/**'
19+
- '**/conformance/**'
20+
branches:
21+
- master
22+
- 'releases/**'
23+
24+
concurrency:
25+
# github.ref is not unique in post-commit
26+
group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-fedora33
27+
cancel-in-progress: true
28+
29+
jobs:
30+
Build:
31+
defaults:
32+
run:
33+
shell: bash
34+
runs-on: aks-linux-16-cores
35+
container:
36+
image: fedora:33
37+
volumes:
38+
- /mount/caches:/mount/caches
39+
env:
40+
CMAKE_BUILD_TYPE: 'Release'
41+
CMAKE_GENERATOR: 'Ninja'
42+
CMAKE_CXX_COMPILER_LAUNCHER: ccache
43+
CMAKE_C_COMPILER_LAUNCHER: ccache
44+
GITHUB_WORKSPACE: '/__w/openvino/openvino'
45+
OPENVINO_REPO: /__w/openvino/openvino/openvino
46+
INSTALL_DIR: /__w/openvino/openvino/openvino_install
47+
INSTALL_TEST_DIR: /__w/openvino/openvino/tests_install
48+
BUILD_DIR: /__w/openvino/openvino/openvino_build
49+
CCACHE_DIR: /mount/caches/ccache/fedora33_x86_64_Release
50+
CCACHE_TEMPDIR: /__w/openvino/openvino/ccache_temp
51+
CCACHE_MAXSIZE: 50G
52+
steps:
53+
- name: Install git
54+
run: yum update -y && yum install -y git
55+
56+
- name: Clone OpenVINO
57+
uses: actions/checkout@v4
58+
with:
59+
path: ${{ env.OPENVINO_REPO }}
60+
submodules: 'true'
61+
62+
#
63+
# Dependencies
64+
#
65+
66+
- name: Install build dependencies
67+
run: bash ${OPENVINO_REPO}/install_build_dependencies.sh
68+
69+
- name: Install python dependencies
70+
run: |
71+
python3 -m pip install -U pip
72+
# For Python API: build and wheel packaging
73+
python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt
74+
python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
75+
76+
# For running ONNX frontend unit tests
77+
python3 -m pip install --force-reinstall -r ${OPENVINO_REPO}/src/frontends/onnx/tests/requirements.txt
78+
79+
# For running TensorFlow frontend unit tests
80+
python3 -m pip install -r ${OPENVINO_REPO}/src/frontends/tensorflow/tests/requirements.txt
81+
82+
# For running TensorFlow Lite frontend unit tests
83+
python3 -m pip install -r ${OPENVINO_REPO}/src/frontends/tensorflow_lite/tests/requirements.txt
84+
85+
# For running Paddle frontend unit tests
86+
python3 -m pip install -r ${OPENVINO_REPO}/src/frontends/paddle/tests/requirements.txt
87+
88+
#
89+
# Build
90+
#
91+
92+
- name: CMake configure - OpenVINO
93+
run: |
94+
cmake \
95+
-G "${{ env.CMAKE_GENERATOR }}" \
96+
-DENABLE_CPPLINT=OFF \
97+
-DENABLE_NCC_STYLE=OFF \
98+
-DENABLE_TESTS=ON \
99+
-DENABLE_STRICT_DEPENDENCIES=OFF \
100+
-DENABLE_SYSTEM_TBB=ON \
101+
-DENABLE_SYSTEM_OPENCL=ON \
102+
-DENABLE_SYSTEM_PUGIXML=ON \
103+
-DENABLE_PYTHON_PACKAGING=ON \
104+
-DCPACK_GENERATOR=TGZ \
105+
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON \
106+
-DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} \
107+
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CMAKE_CXX_COMPILER_LAUNCHER }} \
108+
-DCMAKE_C_COMPILER_LAUNCHER=${{ env.CMAKE_C_COMPILER_LAUNCHER }} \
109+
-S ${OPENVINO_REPO} \
110+
-B ${BUILD_DIR}
111+
112+
- name: Cmake build - OpenVINO
113+
run: cmake --build ${BUILD_DIR} --parallel --verbose
114+
115+
- name: Show ccache stats
116+
run: ccache --show-stats
117+
118+
- name: Cmake install - OpenVINO
119+
run: |
120+
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -P ${BUILD_DIR}/cmake_install.cmake
121+
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_TEST_DIR} -DCOMPONENT=tests -P ${BUILD_DIR}/cmake_install.cmake
122+
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCOMPONENT=python_wheels -P ${BUILD_DIR}/cmake_install.cmake
123+
124+
- name: Pack Artifacts
125+
run: |
126+
pushd ${INSTALL_DIR}
127+
tar -czvf ${BUILD_DIR}/openvino_package.tar.gz *
128+
popd
129+
130+
pushd ${INSTALL_TEST_DIR}
131+
tar -czvf ${BUILD_DIR}/openvino_tests.tar.gz *
132+
popd
133+
134+
- name: Build RPM packages
135+
run: |
136+
cmake -DCPACK_GENERATOR=RPM \
137+
-DENABLE_TESTS=OFF \
138+
${BUILD_DIR}
139+
cmake --build ${BUILD_DIR} --parallel --target package --verbose
140+
141+
#
142+
# Upload build artifacts
143+
#
144+
145+
- name: Upload openvino package
146+
if: ${{ always() }}
147+
uses: actions/upload-artifact@v3
148+
with:
149+
name: openvino_package
150+
path: ${{ env.BUILD_DIR }}/openvino_package.tar.gz
151+
if-no-files-found: 'error'
152+
153+
- name: Upload openvino RPM packages
154+
if: ${{ always() }}
155+
uses: actions/upload-artifact@v3
156+
with:
157+
name: openvino_rpm_packages
158+
path: ${{ env.BUILD_DIR }}/*.rpm
159+
if-no-files-found: 'error'
160+
161+
- name: Upload openvino tests package
162+
if: ${{ always() }}
163+
uses: actions/upload-artifact@v3
164+
with:
165+
name: openvino_tests
166+
path: ${{ env.BUILD_DIR }}/openvino_tests.tar.gz
167+
if-no-files-found: 'error'
168+
169+
RPM_Packages:
170+
needs: Build
171+
defaults:
172+
run:
173+
shell: bash
174+
runs-on: ubuntu-20.04
175+
container:
176+
image: fedora:33
177+
env:
178+
RPM_PACKAGES_DIR: /__w/openvino/packages/
179+
180+
steps:
181+
- name: Create Directories
182+
run: mkdir -p ${RPM_PACKAGES_DIR}
183+
184+
- name: Download OpenVINO RPM packages
185+
uses: actions/download-artifact@v3
186+
with:
187+
name: openvino_rpm_packages
188+
path: ${{ env.RPM_PACKAGES_DIR }}
189+
190+
- name: Install RPM packages & check conflicts
191+
run: |
192+
tee > /tmp/openvino-2023.repo << EOF
193+
[OpenVINO]
194+
name=Intel(R) Distribution of OpenVINO 2023
195+
baseurl=https://yum.repos.intel.com/openvino/2023
196+
enabled=1
197+
gpgcheck=1
198+
repo_gpgcheck=1
199+
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
200+
EOF
201+
202+
# install previous release version
203+
mv /tmp/openvino-2023.repo /etc/yum.repos.d
204+
yum install -y openvino
205+
206+
# install current version
207+
yum install --allowerasing -y *.rpm
208+
working-directory: ${{ env.RPM_PACKAGES_DIR }}
209+
210+
- name: Test RPM packages
211+
run: |
212+
/usr/share/openvino/samples/cpp/build_samples.sh
213+
/usr/share/openvino/samples/c/build_samples.sh
214+
~/openvino_cpp_samples_build/intel64/Release/hello_query_device
215+
python3 /usr/share/openvino/samples/python/hello_query_device/hello_query_device.py
216+
python3 -c 'from openvino import Core; Core().get_property("CPU", "AVAILABLE_DEVICES")'
217+
python3 -c 'from openvino import Core; Core().get_property("GPU", "AVAILABLE_DEVICES")'
218+
python3 -c 'from openvino import Core; Core().get_property("AUTO", "SUPPORTED_METRICS")'
219+
python3 -c 'from openvino import Core; Core().get_property("MULTI", "SUPPORTED_METRICS")'
220+
python3 -c 'from openvino import Core; Core().get_property("HETERO", "SUPPORTED_METRICS")'
221+
python3 -c 'from openvino import Core; Core().get_property("BATCH", "SUPPORTED_METRICS")'
222+
python3 -c 'from openvino.frontend import FrontEndManager; assert len(FrontEndManager().get_available_front_ends()) == 6'
223+
benchmark_app --help
224+
ovc --help

.github/workflows/linux.yml

+4-14
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,7 @@ jobs:
8888
bash ${OPENVINO_REPO}/install_build_dependencies.sh
8989
# default-jdk - Java API
9090
# libssl1.1 - 'python3 -m pip' in self-hosted runner
91-
# unzip - to download ninja
92-
apt install --assume-yes --no-install-recommends default-jdk libssl1.1 unzip
93-
94-
wget https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-linux.zip
95-
unzip ninja-linux.zip
96-
cp -v ninja /usr/local/bin/
91+
apt install --assume-yes --no-install-recommends default-jdk libssl1.1
9792
9893
- uses: actions/setup-python@v4
9994
with:
@@ -126,9 +121,6 @@ jobs:
126121
# Build
127122
#
128123

129-
- name: Setup ccache dir
130-
run: mkdir -p ${CCACHE_DIR}
131-
132124
- name: CMake configure - OpenVINO
133125
run: |
134126
cmake \
@@ -145,7 +137,6 @@ jobs:
145137
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON \
146138
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CMAKE_CXX_COMPILER_LAUNCHER }} \
147139
-DCMAKE_C_COMPILER_LAUNCHER=${{ env.CMAKE_C_COMPILER_LAUNCHER }} \
148-
-DCMAKE_MINIMUM_REQUIRED_VERSION=3.20 \
149140
-S ${OPENVINO_REPO} \
150141
-B ${BUILD_DIR}
151142
@@ -180,12 +171,11 @@ jobs:
180171
/usr/bin/python3.8 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt
181172
/usr/bin/python3.8 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
182173
cmake -UPYTHON* \
183-
-DCPACK_GENERATOR=DEB \
184174
-DENABLE_PYTHON_PACKAGING=ON \
185-
-DPython3_EXECUTABLE=/usr/bin/python3.8 \
186175
-DENABLE_TESTS=OFF \
187-
-S ${OPENVINO_REPO} \
188-
-B ${BUILD_DIR}
176+
-DPython3_EXECUTABLE=/usr/bin/python3.8 \
177+
-DCPACK_GENERATOR=DEB \
178+
${BUILD_DIR}
189179
cmake --build ${BUILD_DIR} --parallel --config ${{ env.CMAKE_BUILD_TYPE }} --target package
190180
191181
- name: Cmake & Build - OpenVINO Contrib

CMakeLists.txt

+16-20
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,28 @@
22
# SPDX-License-Identifier: Apache-2.0
33
#
44

5-
if(NOT DEFINED CMAKE_MINIMUM_REQUIRED_VERSION)
6-
if(DEFINED BUILD_SHARED_LIBS AND NOT BUILD_SHARED_LIBS)
7-
# 3.17: 'target_link_libraries' does not work correctly when called from
8-
# different directory where 'add_library' is called: CMake generates
9-
# incorrect OpenVINOConfig.cmake in this case
10-
# 3.18: add_library cannot create ALIAS for non-GLOBAL targets
11-
set(CMAKE_MINIMUM_REQUIRED_VERSION 3.18)
5+
if(DEFINED BUILD_SHARED_LIBS AND NOT BUILD_SHARED_LIBS)
6+
# 3.17: 'target_link_libraries' does not work correctly when called from
7+
# different directory where 'add_library' is called: CMake generates
8+
# incorrect OpenVINOConfig.cmake in this case
9+
# 3.18: add_library cannot create ALIAS for non-GLOBAL targets
10+
cmake_minimum_required(VERSION 3.18)
11+
else()
12+
if(CPACK_GENERATOR STREQUAL "DEB")
13+
# we have to use CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS variable
14+
cmake_minimum_required(VERSION 3.20)
1215
else()
13-
if(CPACK_GENERATOR STREQUAL "DEB")
14-
# we have to use CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS variable
15-
set(CMAKE_MINIMUM_REQUIRED_VERSION 3.20)
16+
if(WIN32)
17+
# 3.16: FindPython3.cmake can find Python via -DPython3_EXECUTABLE
18+
# 3.18: FindPython3.cmake can find Python automatically from virtualenv
19+
cmake_minimum_required(VERSION 3.16)
1620
else()
17-
if(WIN32)
18-
# 3.16: FindPython3.cmake can find Python via -DPython3_EXECUTABLE
19-
# 3.18: FindPython3.cmake can find Python automatically from virtualenv
20-
set(CMAKE_MINIMUM_REQUIRED_VERSION 3.16)
21-
else()
22-
# 3.13: default choice
23-
set(CMAKE_MINIMUM_REQUIRED_VERSION 3.13)
24-
endif()
21+
# 3.13: default choice
22+
cmake_minimum_required(VERSION 3.13)
2523
endif()
2624
endif()
2725
endif()
2826

29-
cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
30-
3127
if(POLICY CMP0091)
3228
cmake_policy(SET CMP0091 NEW) # Enables use of MSVC_RUNTIME_LIBRARY
3329
endif()

cmake/developer_package/compile_flags/os_flags.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,13 @@ if(NOT DEFINED CMAKE_CXX_STANDARD)
299299
else()
300300
set(CMAKE_CXX_STANDARD 11)
301301
endif()
302+
endif()
303+
304+
if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
302305
set(CMAKE_CXX_EXTENSIONS OFF)
306+
endif()
307+
308+
if(NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
303309
set(CMAKE_CXX_STANDARD_REQUIRED ON)
304310
endif()
305311

cmake/developer_package/cpplint/cpplint.cmake

+2-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ endif()
1414
if(ENABLE_CPPLINT AND NOT TARGET cpplint_all)
1515
add_custom_target(cpplint_all ALL)
1616
set_target_properties(cpplint_all PROPERTIES FOLDER cpplint)
17-
set(CPPLINT_ALL_OUTPUT_FILES "" CACHE INTERNAL "All cpplint output files")
1817
endif()
1918

2019
function(add_cpplint_target TARGET_NAME)
@@ -58,6 +57,7 @@ function(add_cpplint_target TARGET_NAME)
5857
endif()
5958

6059
file(RELATIVE_PATH source_file_relative "${CMAKE_CURRENT_SOURCE_DIR}" "${source_file}")
60+
file(RELATIVE_PATH source_file_relative_root "${CMAKE_SOURCE_DIR}" "${source_file}")
6161
set(output_file "${CMAKE_CURRENT_BINARY_DIR}/cpplint/${source_file_relative}.cpplint")
6262
string(REPLACE ".." "__" output_file "${output_file}")
6363
get_filename_component(output_dir "${output_file}" DIRECTORY)
@@ -81,17 +81,12 @@ function(add_cpplint_target TARGET_NAME)
8181
"${IEDevScripts_DIR}/cpplint/cpplint.py"
8282
"${IEDevScripts_DIR}/cpplint/cpplint_run.cmake"
8383
COMMENT
84-
"[cpplint] ${source_file}"
84+
"[cpplint] ${source_file_relative_root}"
8585
VERBATIM)
8686

8787
list(APPEND all_output_files "${output_file}")
8888
endforeach()
8989

90-
set(CPPLINT_ALL_OUTPUT_FILES
91-
${CPPLINT_ALL_OUTPUT_FILES} ${all_output_files}
92-
CACHE INTERNAL
93-
"All cpplint output files")
94-
9590
add_custom_target(${TARGET_NAME} ALL
9691
DEPENDS ${all_output_files}
9792
COMMENT "[cpplint] ${TARGET_NAME}")

0 commit comments

Comments
 (0)