HADOOP-17816. Run optional CI for changes in C (#3238)
* HADOOP-17816. Run optional CI for changes in C * We need to ensure that we run the CI for all the platforms when there are changes in C files. * Trigger CI * Revert "Trigger CI" This reverts commit ecb88350b91c692cac128fc6f72dcd8971932041.
This commit is contained in:
parent
8d6a686953
commit
e80b5a08e2
@ -21,17 +21,17 @@
|
|||||||
# We use Ubuntu Focal as the main platform for building Hadoop, thus
|
# We use Ubuntu Focal as the main platform for building Hadoop, thus
|
||||||
# it runs for all the PRs. Additionally, we also ensure that
|
# it runs for all the PRs. Additionally, we also ensure that
|
||||||
# Hadoop builds across the supported platforms whenever there's a change
|
# Hadoop builds across the supported platforms whenever there's a change
|
||||||
# in any of the C++ files, C++ build files or platform changes.
|
# in any of the C/C++ files, C/C++ build files or platform changes.
|
||||||
|
|
||||||
## @description Check if the given extension is related to C++
|
## @description Check if the given extension is related to C/C++
|
||||||
## @param seeking
|
## @param seeking
|
||||||
## @return 0 if yes
|
## @return 0 if yes
|
||||||
## @return 1 if no
|
## @return 1 if no
|
||||||
is_cpp_extension() {
|
is_c_cpp_extension() {
|
||||||
local cpp_extensions=("cc" "cpp" "h" "hpp")
|
local c_cpp_extension=("c" "cc" "cpp" "h" "hpp")
|
||||||
local seeking=$1
|
local seeking=$1
|
||||||
|
|
||||||
for element in "${cpp_extensions[@]}"; do
|
for element in "${c_cpp_extension[@]}"; do
|
||||||
if [[ $element == "$seeking" ]]; then
|
if [[ $element == "$seeking" ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -50,7 +50,7 @@ is_platform_change() {
|
|||||||
|
|
||||||
for path in "${SOURCEDIR}"/dev-support/docker/Dockerfile* "${SOURCEDIR}"/dev-support/docker/pkg-resolver/*.json; do
|
for path in "${SOURCEDIR}"/dev-support/docker/Dockerfile* "${SOURCEDIR}"/dev-support/docker/pkg-resolver/*.json; do
|
||||||
if [ "${in_path}" == "${path}" ]; then
|
if [ "${in_path}" == "${path}" ]; then
|
||||||
echo "Found C++ platform related changes in ${in_path}"
|
echo "Found C/C++ platform related changes in ${in_path}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -58,11 +58,11 @@ is_platform_change() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
## @description Checks if the given path corresponds to a change
|
## @description Checks if the given path corresponds to a change
|
||||||
## in C++ files or related to C++ build system
|
## in C/C++ files or related to C/C++ build system
|
||||||
## @param path
|
## @param path
|
||||||
## @return 0 if yes
|
## @return 0 if yes
|
||||||
## @return 1 if no
|
## @return 1 if no
|
||||||
is_cpp_change() {
|
is_c_cpp_change() {
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch
|
||||||
|
|
||||||
local path=$1
|
local path=$1
|
||||||
@ -70,13 +70,13 @@ is_cpp_change() {
|
|||||||
filename=$(basename -- "${path}")
|
filename=$(basename -- "${path}")
|
||||||
extension=${filename##*.}
|
extension=${filename##*.}
|
||||||
|
|
||||||
if is_cpp_extension "${extension}"; then
|
if is_c_cpp_extension "${extension}"; then
|
||||||
echo "Found C++ changes in ${path}"
|
echo "Found C/C++ changes in ${path}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $filename =~ CMakeLists\.txt ]]; then
|
if [[ $filename =~ CMakeLists\.txt ]]; then
|
||||||
echo "Found C++ build related changes in ${path}"
|
echo "Found C/C++ build related changes in ${path}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
@ -84,7 +84,7 @@ is_cpp_change() {
|
|||||||
|
|
||||||
## @description Check if the CI needs to be run - CI will always run if
|
## @description Check if the CI needs to be run - CI will always run if
|
||||||
## IS_OPTIONAL is 0, or if there's any change in
|
## IS_OPTIONAL is 0, or if there's any change in
|
||||||
## C++/C++ build/platform
|
## C/C++ files or C/C++ build or platform
|
||||||
## @return 0 if yes
|
## @return 0 if yes
|
||||||
## @return 1 if no
|
## @return 1 if no
|
||||||
function check_ci_run() {
|
function check_ci_run() {
|
||||||
@ -94,7 +94,7 @@ function check_ci_run() {
|
|||||||
# Loop over the paths of all the changed files and check if the criteria
|
# Loop over the paths of all the changed files and check if the criteria
|
||||||
# to run the CI has been satisfied
|
# to run the CI has been satisfied
|
||||||
for path in $(git --git-dir "${SOURCEDIR}/.git" diff --name-only "${firstCommitOfThisPr}" HEAD); do
|
for path in $(git --git-dir "${SOURCEDIR}/.git" diff --name-only "${firstCommitOfThisPr}" HEAD); do
|
||||||
if is_cpp_change "${path}"; then
|
if is_c_cpp_change "${path}"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ if [ "$1" == "run_ci" ]; then
|
|||||||
if check_ci_run; then
|
if check_ci_run; then
|
||||||
run_ci
|
run_ci
|
||||||
else
|
else
|
||||||
echo "No C++ file/C++ build/platform changes found, will not run CI"
|
echo "No C/C++ file or C/C++ build or platform changes found, will not run CI for this platform"
|
||||||
fi
|
fi
|
||||||
elif [ "$1" == "cleanup_ci_proc" ]; then
|
elif [ "$1" == "cleanup_ci_proc" ]; then
|
||||||
cleanup_ci_proc
|
cleanup_ci_proc
|
||||||
|
Loading…
Reference in New Issue
Block a user