From 47abd6bdc2eaf73e5d49043d6d345eee0707764d Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 5 Jan 2021 10:46:11 -0800 Subject: [PATCH 1/3] Add cache for bazel to prove why bazel rocks Signed-off-by: Bogdan Drutu --- .github/workflows/ci.yml | 58 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2bd69380a..915f6a0826 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,13 +87,20 @@ jobs: - name: run tests run: ./ci/do_ci.sh cmake.test_example_plugin - gcc_48_test: + bazel_gcc_48_test: name: Bazel gcc 4.8 runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 with: submodules: 'recursive' + - name: Mount Bazel Cache + uses: actions/cache@v2 + env: + cache-name: bazel_cache + with: + path: /home/runner/.cache/bazel + key: bazel_gcc_48_test - name: setup run: | sudo ./ci/setup_ci_environment.sh @@ -111,6 +118,13 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' + - name: Mount Bazel Cache + uses: actions/cache@v2 + env: + cache-name: bazel_cache + with: + path: /home/runner/.cache/bazel + key: bazel_test - name: setup run: | sudo ./ci/setup_ci_environment.sh @@ -125,6 +139,13 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' + - name: Mount Bazel Cache + uses: actions/cache@v2 + env: + cache-name: bazel_cache + with: + path: /home/runner/.cache/bazel + key: bazel_valgrind - name: setup run: | sudo ./ci/setup_ci_environment.sh @@ -139,6 +160,13 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' + - name: Mount Bazel Cache + uses: actions/cache@v2 + env: + cache-name: bazel_cache + with: + path: /home/runner/.cache/bazel + key: bazel_noexcept - name: setup run: | sudo ./ci/setup_ci_environment.sh @@ -153,6 +181,13 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' + - name: Mount Bazel Cache + uses: actions/cache@v2 + env: + cache-name: bazel_cache + with: + path: /home/runner/.cache/bazel + key: bazel_asan - name: setup run: | sudo ./ci/setup_ci_environment.sh @@ -167,6 +202,13 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' + - name: Mount Bazel Cache + uses: actions/cache@v2 + env: + cache-name: bazel_cache + with: + path: /home/runner/.cache/bazel + key: bazel_tsan - name: setup run: | sudo ./ci/setup_ci_environment.sh @@ -181,6 +223,13 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' + - name: Mount Bazel Cache + uses: actions/cache@v2 + env: + cache-name: bazel_cache + with: + path: /Users/runner/.cache/bazel + key: bazel_osx - name: run tests run: ./ci/do_ci.sh bazel.test @@ -191,6 +240,13 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' + - name: Mount Bazel Cache + uses: actions/cache@v2 + env: + cache-name: bazel_cache + with: + path: /home/runner/.cache/bazel + key: bazel_benchmark - name: setup run: | sudo ./ci/setup_ci_environment.sh From 6bf16591d95768e9ba0731bffdcf34de8f5df0eb Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 5 Jan 2021 12:23:22 -0800 Subject: [PATCH 2/3] For osx the output root is /private/var/tmp, make it similar with linux Signed-off-by: Bogdan Drutu --- ci/do_ci.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 79797279b4..9a56aa3dd9 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -114,8 +114,8 @@ EOF examples/plugin/load/load_plugin_example ${PLUGIN_DIR}/libexample_plugin.so /dev/null exit 0 elif [[ "$1" == "bazel.test" ]]; then - bazel build $BAZEL_OPTIONS //... - bazel test $BAZEL_TEST_OPTIONS //... + bazel --output_user_root=~/.cache/bazel build $BAZEL_OPTIONS //... + bazel --output_user_root=~/.cache/bazel test $BAZEL_TEST_OPTIONS //... exit 0 elif [[ "$1" == "bazel.legacy.test" ]]; then # we uses C++ future and async() function to test the Prometheus Exporter functionality, From 3969d3a9809cfb10f4a45ac11b24fc22bb0a01b8 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Wed, 6 Jan 2021 09:05:21 -0800 Subject: [PATCH 3/3] Set output root for all linux/macos builds Signed-off-by: Bogdan Drutu --- ci/do_ci.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 9a56aa3dd9..32a8bb99df 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -10,6 +10,7 @@ mkdir -p "${PLUGIN_DIR}" BAZEL_OPTIONS="" BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors" +BAZEL_STARTUP_OPTIONS="--output_user_root=$HOME/.cache/bazel" if [[ "$1" == "cmake.test" ]]; then cd "${BUILD_DIR}" @@ -114,34 +115,34 @@ EOF examples/plugin/load/load_plugin_example ${PLUGIN_DIR}/libexample_plugin.so /dev/null exit 0 elif [[ "$1" == "bazel.test" ]]; then - bazel --output_user_root=~/.cache/bazel build $BAZEL_OPTIONS //... - bazel --output_user_root=~/.cache/bazel test $BAZEL_TEST_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS //... exit 0 elif [[ "$1" == "bazel.legacy.test" ]]; then # we uses C++ future and async() function to test the Prometheus Exporter functionality, # that make this test always fail. ignore Prometheus exporter here. - bazel build $BAZEL_OPTIONS -- //... -//exporters/otlp/... -//exporters/prometheus/... - bazel test $BAZEL_TEST_OPTIONS -- //... -//exporters/otlp/... -//exporters/prometheus/... + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS -- //... -//exporters/otlp/... -//exporters/prometheus/... + bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS -- //... -//exporters/otlp/... -//exporters/prometheus/... exit 0 elif [[ "$1" == "bazel.noexcept" ]]; then # there are some exceptions and error handling code from the Prometheus Client # that make this test always fail. ignore Prometheus exporter in the noexcept here. - bazel build --copt=-fno-exceptions $BAZEL_OPTIONS -- //... -//exporters/prometheus/... - bazel test --copt=-fno-exceptions $BAZEL_TEST_OPTIONS -- //... -//exporters/prometheus/... + bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions $BAZEL_OPTIONS -- //... -//exporters/prometheus/... + bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions $BAZEL_TEST_OPTIONS -- //... -//exporters/prometheus/... exit 0 elif [[ "$1" == "bazel.asan" ]]; then - bazel test --config=asan $BAZEL_TEST_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS test --config=asan $BAZEL_TEST_OPTIONS //... exit 0 elif [[ "$1" == "bazel.tsan" ]]; then - bazel test --config=tsan $BAZEL_TEST_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS test --config=tsan $BAZEL_TEST_OPTIONS //... exit 0 elif [[ "$1" == "bazel.valgrind" ]]; then - bazel build $BAZEL_OPTIONS //... - bazel test --run_under="/usr/bin/valgrind --leak-check=full --error-exitcode=1 --suppressions=\"${SRC_DIR}/ci/valgrind-suppressions\"" $BAZEL_TEST_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS test --run_under="/usr/bin/valgrind --leak-check=full --error-exitcode=1 --suppressions=\"${SRC_DIR}/ci/valgrind-suppressions\"" $BAZEL_TEST_OPTIONS //... exit 0 elif [[ "$1" == "benchmark" ]]; then [ -z "${BENCHMARK_DIR}" ] && export BENCHMARK_DIR=$HOME/benchmark - bazel build $BAZEL_OPTIONS -c opt -- \ + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS -c opt -- \ $(bazel query 'attr("tags", "benchmark_result", ...)') echo "" echo "Benchmark results in $BENCHMARK_DIR:"