Refinee before-submit script.
diff --git a/.github/bin/before-submit.sh b/.github/bin/before-submit.sh index e8ba9dd..4a707f0 100755 --- a/.github/bin/before-submit.sh +++ b/.github/bin/before-submit.sh
@@ -6,9 +6,11 @@ cd ${PROJECT_ROOT} RUN_CLANG_TIDY=1 +RUN_ALL_CPP_STD=1 while [ $# -ne 0 ]; do case $1 in --skip-clang-tidy) RUN_CLANG_TIDY=0;; + --skip-cpp-std) RUN_ALL_CPP_STD=0;; *) echo "Unknown option $1" exit 1 @@ -18,11 +20,12 @@ done if [ -t 1 ]; then - BOLD=$'\033[7m' - RED=$'\033[1;30;41m' + BOLD=$'\033[1m' + INVERSE=$'\033[7m' + RED=$'\033[1;37;41m' NORM=$'\033[0m' else - BOLD="" + INVERSE="" NORM="" fi @@ -35,31 +38,34 @@ fi } -echo "${BOLD}-- Build bant if not already (comp-db, build-cleaner) --${NORM}" +echo "${INVERSE}-- Build bant if not already (comp-db, build-cleaner) --${NORM}" BANT=$($(dirname $0)/get-bant-path.sh) # Compilation DB is needed for clang-tidy, but also # makes sure all external dependencies have been fetched so that # bant build cleaner can do a good job. -echo "${BOLD}-- Refresh compilation db --${NORM}" +echo "${INVERSE}-- Refresh compilation db --${NORM}" .github/bin/make-compilation-db.sh check_exit -echo "${BOLD}-- Run build cleaner --${NORM}" +echo "${INVERSE}-- Run build cleaner --${NORM}" . <(${BANT} dwyu ...) -echo "${BOLD}-- Run all tests --${NORM}" +echo "${INVERSE}-- Run all tests --${NORM}" bazel test -c opt --test_summary=terse ... check_exit -for cpp_standard in c++20 c++23 ; do - echo "${BOLD}-- Run tests wtih -std=${cpp_standard} --${NORM}" - bazel test -c opt --cxxopt=-std=${cpp_standard} --test_summary=terse ... - check_exit -done +if [ "${RUN_ALL_CPP_STD}" -eq 1 ]; then + echo "${BOLD}Running other c++ standards. Skip with --skip-cpp-std${NORM}" + for cpp_standard in c++20 c++23 ; do + echo "${INVERSE}-- Run tests wtih -std=${cpp_standard} --${NORM}" + bazel test -c opt --cxxopt=-std=${cpp_standard} --test_summary=terse ... + check_exit + done +fi if [ "${RUN_CLANG_TIDY}" -eq 1 ]; then - echo "${BOLD}-- Running clang-tidy and cache results --${NORM}" + echo "${INVERSE}-- Running clang-tidy and cache results --${NORM}" echo "This will take a while if run the first time and no cache has" echo "been created yet. Can't wait ? Skip with " echo " $0 --skip-clang-tidy" @@ -67,10 +73,10 @@ check_exit fi -echo "${BOLD}-- Format code and BUILD files --${NORM}" +echo "${INVERSE}-- Format code and BUILD files --${NORM}" .github/bin/run-format.sh -echo "${BOLD}-- Check for other potential problems --${NORM}" +echo "${INVERSE}-- Check for other potential problems --${NORM}" .github/bin/check-potential-problems.sh check_exit