Skip to content

Commit

Permalink
Fix Python Installation version in Github CI. Address failing system …
Browse files Browse the repository at this point in the history
…tests environment issues (#4759)

* Refs #20965: Install a fix python version in ubuntu and windows cis

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #20965: Decide Python environment depending on the version

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #20965: Prevent Qt installation from setting up python in Ubuntu CI

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #20965: Add some comments

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

---------

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
(cherry picked from commit 3b2e781)

# Conflicts:
#	test/system/tools/fastdds/CMakeLists.txt
  • Loading branch information
Mario-DL authored and MiguelCompany committed May 17, 2024
1 parent ee71f07 commit 53a87f2
Show file tree
Hide file tree
Showing 5 changed files with 237 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/reusable-ubuntu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ jobs:
path: src/fastrtps
ref: ${{ inputs.fastdds-branch }}

- name: Install Fix Python version
uses: eProsima/eProsima-CI/external/setup-python@v0
with:
python-version: '3.11'

- name: Get minimum supported version of CMake
uses: eProsima/eProsima-CI/external/get-cmake@v0
with:
Expand Down Expand Up @@ -114,12 +119,15 @@ jobs:
ref: ${{ steps.get_shapes_demo_branch.outputs.deduced_branch }}

# Required for Shapes Demo
# Do not setup python as it will internally modify the pythonLocation env variable
# and we want to use a fix version
- name: Install Qt
uses: jurplel/install-qt-action@v2.13.0
with:
version: '5.15.2'
dir: '${{ github.workspace }}/qt_installation/'
modules: 'qtcharts'
setup-python: 'false'

- name: Colcon build
continue-on-error: false
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/reusable-windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ jobs:
submodules: true
ref: ${{ inputs.fastdds_branch }}

- name: Install Fix Python version
uses: eProsima/eProsima-CI/external/setup-python@v0
with:
python-version: '3.11'

- name: Get minimum supported version of CMake
uses: eProsima/eProsima-CI/external/get-cmake@v0
with:
Expand Down
204 changes: 204 additions & 0 deletions test/system/tools/fastdds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ find_package(PythonInterp 3 REQUIRED)

if(PYTHONINTERP_FOUND)

# Set environment for tests
set(TEST_ENVIRONMENT
"PYTHON_VERSION=${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")

set(TESTS
test_fastdds_installed
test_fastdds_discovery
Expand All @@ -43,6 +47,7 @@ if(PYTHONINTERP_FOUND)
PROPERTY LABELS "NoMemoryCheck"
)

<<<<<<< HEAD
endforeach()

endif()
Expand Down Expand Up @@ -169,3 +174,202 @@ endif()

# Define test
add_test(NAME xml.validate COMMAND ${env_fast_command} xml validate xmldocuments)
=======
# Set environment
set_property(
TEST system.tools.fastdds.${TEST}
PROPERTY ENVIRONMENT ${TEST_ENVIRONMENT}
)

endforeach()

###############################################################################
# XML GENERAL validation
###############################################################################
message(STATUS "Configuring CLI xml validation...")

# Configure command based on the OS running
if (MSVC)
set(env_fast_command "fastdds.bat") # WINDOWS
else()
set(env_fast_command "fastdds") # POSIX
endif()

# Copy the examples validation files over to the build directory
file(GLOB_RECURSE XML_EXAMPLE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../examples/*_profile.xml)
# for each xml file detected
foreach(XML_EXAMPLE_FILE_COMPLETE_PATH ${XML_EXAMPLE_FILES})
# obtain the file name
get_filename_component(XML_EXAMPLE_FILE ${XML_EXAMPLE_FILE_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${XML_EXAMPLE_FILE_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xmldocuments/examples/${XML_EXAMPLE_FILE}.xml # to relative build path
COPYONLY)
endforeach()

# Copy the blackbox tests validation files over to the build directory
file(GLOB_RECURSE XML_BLACKBOX_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../blackbox/*_profile.xml)
# for each xml file detected
foreach(XML_BLACKBOX_FILE_COMPLETE_PATH ${XML_BLACKBOX_FILES})
# obtain the file name
get_filename_component(XML_BLACKBOX_FILE ${XML_BLACKBOX_FILE_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${XML_BLACKBOX_FILE_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xmldocuments/test/blackbox/${XML_BLACKBOX_FILE}.xml # to relative build path
COPYONLY)
endforeach()

# Copy the unit tests validation files over to the build directory
file(GLOB_RECURSE XML_UNITTEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../unittest/*_profile.xml)
# for each xml file detected
foreach(XML_UNITTEST_FILE_COMPLETE_PATH ${XML_UNITTEST_FILES})
# obtain the file name
get_filename_component(XML_UNITTEST_FILE ${XML_UNITTEST_FILE_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${XML_UNITTEST_FILE_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xmldocuments/test/unittest/${XML_UNITTEST_FILE}.xml # to relative build path
COPYONLY)
endforeach()

# Copy the system tests validation files over to the build directory
file(GLOB_RECURSE XML_SYSTEM_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../*_profile.xml)
# for each xml file detected
foreach(XML_SYSTEM_FILE_COMPLETE_PATH ${XML_SYSTEM_FILES})
# obtain the file name
get_filename_component(XML_SYSTEM_FILE ${XML_SYSTEM_FILE_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${XML_SYSTEM_FILE_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xmldocuments/test/system/${XML_SYSTEM_FILE}.xml # to relative build path
COPYONLY)
endforeach()

# Copy the comunication tests validation files over to the build directory
file(GLOB_RECURSE XML_COMMUNICATION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../communication/*_profile.xml)
# for each xml file detected
foreach(XML_COMMUNICATION_FILE_COMPLETE_PATH ${XML_COMMUNICATION_FILES})
# obtain the file name
get_filename_component(XML_COMMUNICATION_FILE ${XML_COMMUNICATION_FILE_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${XML_COMMUNICATION_FILE_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xmldocuments/test/communication/${XML_COMMUNICATION_FILE}.xml # to relative build path
COPYONLY)
endforeach()

# Copy the dds tests validation files over to the build directory
file(GLOB_RECURSE XML_DDS_TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../dds/*_profile.xml)
# for each xml file detected
foreach(XML_DDS_TEST_FILE_COMPLETE_PATH ${XML_DDS_TEST_FILES})
# obtain the file name
get_filename_component(XML_DDS_TEST_FILE ${XML_DDS_TEST_FILE_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${XML_DDS_TEST_FILE_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xmldocuments/test/dds/${XML_DDS_TEST_FILE}.xml # to relative build path
COPYONLY)
endforeach()

if(PERFORMANCE_TESTS)
# Copy the performance tests validation files over to the build directory
file(GLOB_RECURSE XML_PERFORMANCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../performance/*_profile.xml)
# for each xml file detected
foreach(XML_PERFORMANCE_FILE_COMPLETE_PATH ${XML_PERFORMANCE_FILES})
# obtain the file name
get_filename_component(XML_PERFORMANCE_FILE ${XML_PERFORMANCE_FILE_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${XML_PERFORMANCE_FILE_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xmldocuments/test/performance/${XML_PERFORMANCE_FILE}.xml # to relative build path
COPYONLY)
endforeach()
endif()

if(PROFILING_TESTS)
# Copy the profiling tests validation files over to the build directory
file(GLOB_RECURSE XML_PROFILING_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../profiling/*_profile.xml)
# for each xml file detected
foreach(XML_PROFILING_FILE_COMPLETE_PATH ${XML_PROFILING_FILES})
# obtain the file name
get_filename_component(XML_PROFILING_FILE ${XML_PROFILING_FILE_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${XML_PROFILING_FILE_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xmldocuments/test/profiling/${XML_PROFILING_FILE}.xml # to relative build path
COPYONLY)
endforeach()
endif()

# Define test
add_test(NAME xml.validate COMMAND ${env_fast_command} xml validate xmldocuments)

set_property(
TEST xml.validate
PROPERTY ENVIRONMENT ${TEST_ENVIRONMENT}
)

###############################################################################
# XML Static discovery validation
###############################################################################

# Copy the examples validation files over to the build directory
file(GLOB_RECURSE STATIC_DISC_XML_EXAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/../../../../examples/*_static_disc.xml)

# for each xml file detected in examples folder
foreach(STATIC_DISC_XML_EXAMPLE_COMPLETE_PATH ${STATIC_DISC_XML_EXAMPLE})
# obtain the file name
get_filename_component(STATIC_DISC_XML_EXAMPLE ${STATIC_DISC_XML_EXAMPLE_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${STATIC_DISC_XML_EXAMPLE_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xml_static_disc_docs/examples/${STATIC_DISC_XML_EXAMPLE}.xml # to relative build path
COPYONLY)
endforeach()

# Copy the test validation files over to the build directory
file(GLOB_RECURSE STATIC_DISC_XML_TEST ${CMAKE_CURRENT_SOURCE_DIR}/../*_static_disc.xml)

# for each xml file detected in test folder
foreach(STATIC_DISC_XML_TEST_COMPLETE_PATH ${STATIC_DISC_XML_TEST})
# obtain the file name
get_filename_component(STATIC_DISC_XML_TEST ${STATIC_DISC_XML_TEST_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${STATIC_DISC_XML_TEST_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xml_static_disc_docs/test/system/${STATIC_DISC_XML_TEST}.xml # to relative build path
COPYONLY)
endforeach()

# Copy the sampled test files over to the build directory
file(GLOB_RECURSE STATIC_DISC_XML_SAMPLED_TEST ${CMAKE_CURRENT_SOURCE_DIR}/../../../blackbox/*_static_disc.xml.in)

# set the expected CMake variables for the samples
set(TOPIC_RANDOM_NUMBER "123")
set(W_UNICAST_PORT_RANDOM_NUMBER "456")
set(R_UNICAST_PORT_RANDOM_NUMBER "654")
set(MULTICAST_PORT_RANDOM_NUMBER "789")

# for each xml file detected in examples folder
foreach(STATIC_DISC_XML_SAMPLED_TEST_COMPLETE_PATH ${STATIC_DISC_XML_SAMPLED_TEST})
# obtain the file name
get_filename_component(STATIC_DISC_XML_SAMPLED_TEST ${STATIC_DISC_XML_SAMPLED_TEST_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${STATIC_DISC_XML_SAMPLED_TEST_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/xml_static_disc_docs/test/blackbox/${STATIC_DISC_XML_SAMPLED_TEST}.xml # to relative build path
)
endforeach()

# Define test
add_test(NAME xml.static_disc_validate COMMAND ${env_fast_command} xml validate xml_static_disc_docs -x ${CMAKE_SOURCE_DIR}/resources/xsd/fastdds_static_discovery.xsd)

set_property(
TEST xml.static_disc_validate
PROPERTY ENVIRONMENT ${TEST_ENVIRONMENT}
)

endif()
>>>>>>> 3b2e781f3 (Fix Python Installation version in Github CI. Address failing system tests environment issues (#4759))
11 changes: 10 additions & 1 deletion tools/fastdds/fastdds.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,14 @@ if not %ERRORLEVEL%==0 (
exit /B 65
)
)

:: Python version in the form "Major.Minor"
if %PYTHON_VERSION%=="" (
echo error retrieving python version. Please, make sure python is installed and accessible.
exit /B 65
)
)

:: Use launcher to profit from shebang hints on fastdds.py
py "%dir%\..\tools\fastdds\fastdds.py" %args%
:: Select the correct python version to source the appropriate paths
py -%PYTHON_VERSION% "%dir%\..\tools\fastdds\fastdds.py" %args%
11 changes: 10 additions & 1 deletion tools/fastdds/ros-discovery.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,14 @@ if not %ERRORLEVEL%==0 (
exit /B 65
)
)

:: Python version in the form "Major.Minor"
if %PYTHON_VERSION%=="" (
echo error retrieving python version. Please, make sure python is installed and accessible.
exit /B 65
)
)

:: Use launcher to profit from shebang hints on fastdds.py
py "%dir%\..\tools\fastdds\fastdds.py" discovery %args%
:: Select the correct python version to source the appropriate paths
py -%PYTHON_VERSION% "%dir%\..\tools\fastdds\fastdds.py" discovery %args%

0 comments on commit 53a87f2

Please sign in to comment.