diff --git a/.github/workflows/reusable_checks.yml b/.github/workflows/reusable_checks.yml index 3e38bda7c569f..fb7246a4ab25c 100644 --- a/.github/workflows/reusable_checks.yml +++ b/.github/workflows/reusable_checks.yml @@ -340,12 +340,12 @@ jobs: - name: Build and run C++ minimal example shell: bash - run: ./examples/cpp/minimal/build_and_run.sh + run: ./examples/cpp/minimal/build_and_run.sh --werror - name: Build and run rerun_cpp tests shell: bash - run: ./rerun_cpp/build_and_run_tests.sh + run: ./rerun_cpp/build_and_run_tests.sh --werror - name: Build code examples shell: bash - run: ./tests/cpp/build_all_doc_examples.sh + run: ./tests/cpp/build_all_doc_examples.sh --werror diff --git a/examples/cpp/minimal/build_and_run.sh b/examples/cpp/minimal/build_and_run.sh index 860e803928fd1..5a445278bda1a 100755 --- a/examples/cpp/minimal/build_and_run.sh +++ b/examples/cpp/minimal/build_and_run.sh @@ -5,11 +5,31 @@ script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) cd "$script_path/../../.." set -x +WERROR=false + +while test $# -gt 0; do + case "$1" in + --werror) + shift + WERROR=true + ;; + + *) + break + ;; + esac +done + + num_threads=$(getconf _NPROCESSORS_ONLN) mkdir -p build pushd build - cmake -DCMAKE_BUILD_TYPE=Debug .. + if [ ${WERROR} = true ]; then + cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_COMPILE_WARNING_AS_ERROR=ON .. + else + cmake -DCMAKE_BUILD_TYPE=Debug .. + fi cmake --build . --config Debug --target rerun_example -j ${num_threads} popd diff --git a/rerun_cpp/build_and_run_tests.sh b/rerun_cpp/build_and_run_tests.sh index 2374239c15a07..f7da396595f7f 100755 --- a/rerun_cpp/build_and_run_tests.sh +++ b/rerun_cpp/build_and_run_tests.sh @@ -5,11 +5,31 @@ script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) cd "$script_path/.." set -x +WERROR=false + +while test $# -gt 0; do + case "$1" in + --werror) + shift + WERROR=true + ;; + + *) + break + ;; + esac +done + + num_threads=$(getconf _NPROCESSORS_ONLN) mkdir -p build pushd build - cmake -DCMAKE_BUILD_TYPE=Debug .. + if [ ${WERROR} = true ]; then + cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_COMPILE_WARNING_AS_ERROR=ON .. + else + cmake -DCMAKE_BUILD_TYPE=Debug .. + fi cmake --build . --config Debug --target rerun_sdk_tests -j ${num_threads} popd diff --git a/tests/cpp/build_all_doc_examples.sh b/tests/cpp/build_all_doc_examples.sh index 3e9f4c46156e3..fdfc1a219729c 100755 --- a/tests/cpp/build_all_doc_examples.sh +++ b/tests/cpp/build_all_doc_examples.sh @@ -5,10 +5,31 @@ script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) cd "$script_path/../.." set -x + +WERROR=false + +while test $# -gt 0; do + case "$1" in + --werror) + shift + WERROR=true + ;; + + *) + break + ;; + esac +done + + num_threads=$(getconf _NPROCESSORS_ONLN) mkdir -p build pushd build - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_BUILD_WARNINGS_AS_ERRORS=On .. + if [ ${WERROR} = true ]; then + cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_COMPILE_WARNING_AS_ERROR=ON .. + else + cmake -DCMAKE_BUILD_TYPE=Debug .. + fi cmake --build . --config Debug --target doc_examples -j ${num_threads} popd diff --git a/tests/cpp/run_all.sh b/tests/cpp/run_all.sh index abb21ab2d9a70..b026d3d19130f 100755 --- a/tests/cpp/run_all.sh +++ b/tests/cpp/run_all.sh @@ -5,13 +5,13 @@ script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) cd "$script_path/../.." echo "------------ Building all C++ Examples ------------" -/bin/bash ./tests/cpp/build_all_doc_examples.sh +/bin/bash ./tests/cpp/build_all_doc_examples.sh $@ echo "------------ Building & running SDK tests ------------" -/bin/bash ./rerun_cpp/build_and_run_tests.sh +/bin/bash ./rerun_cpp/build_and_run_tests.sh $@ echo "------------ Building & running minimal example ------------" -/bin/bash ./examples/cpp/minimal/build_and_run.sh +/bin/bash ./examples/cpp/minimal/build_and_run.sh $@ echo "------------ Running roundtrip tests ------------" python ./scripts/ci/run_e2e_roundtrip_tests.py