chore: exclude mockstorage from benchmarks

This commit is contained in:
Manuel de la Peña
2024-12-28 10:25:53 +01:00
parent 5a356f7c64
commit 22f2630f8d

View File

@@ -16,12 +16,28 @@
# ROOT_DIR is the root directory of the repository.
readonly ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
# define an array of modules that won't be included in the list
readonly excluded_modules=("mockstorage")
# modules is an array that will store the paths of all the modules in the repository.
modules=()
function is_excluded() {
for excluded_module in "${excluded_modules[@]}"; do
if [[ $1 == $excluded_module ]]; then
return 0
fi
done
return 1
}
# Find all go.mod files in the repository, building a list of all the available modules.
# Do not include the root go.mod file.
for modFile in $(find "${ROOT_DIR}" -name "go.mod" -not -path "${ROOT_DIR}/go.mod" -not -path "${ROOT_DIR}/**/testdata/*"); do
# do not include the excluded modules
if is_excluded "$(basename "$(dirname "${modFile}")")"; then
continue
fi
modules+=("\"$(basename "$(dirname "${modFile}")")\"")
done
@@ -54,6 +70,9 @@ for file in $modified_files; do
module_name=$(echo $file | cut -d'/' -f1)
if [[ ! " ${modified_modules[@]} " =~ " ${module_name} " ]]; then
if is_excluded "$module_name"; then
continue
fi
modified_modules+=("\"$module_name\"")
fi
done
@@ -62,4 +81,4 @@ done
# each module will be enclosed in double quotes
# each module will be separated by a comma
# the entire list will be enclosed in square brackets
echo "["$(IFS=,; echo "${modified_modules[*]}" | sed 's/ /,/g')"]"
echo "["$(IFS=,; echo "${modified_modules[*]}" | sed 's/ /,/g')"]"