Skip to content

Commit

Permalink
ci: collect bazel profile and store in artifacts (envoyproxy#5857)
Browse files Browse the repository at this point in the history
Signed-off-by: Lizan Zhou <[email protected]>
  • Loading branch information
lizan authored and htuch committed Feb 6, 2019
1 parent cfd8fab commit 13a3bbc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
19 changes: 13 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
- run: ci/docker_push.sh
- run: ci/docker_tag.sh
- store_artifacts:
path: /build/envoy/generated/failed-testlogs
path: /build/envoy/generated
destination: /
asan:
executor: ubuntu-build
steps:
Expand All @@ -33,23 +34,27 @@ jobs:
- checkout
- run: ci/do_circle_ci.sh bazel.asan
- store_artifacts:
path: /build/envoy/generated/failed-testlogs
path: /build/envoy/generated
destination: /
tsan:
executor: ubuntu-build
steps:
- run: rm -rf /home/circleci/project/.git # CircleCI git caching is likely broken
- checkout
- run: ci/do_circle_ci.sh bazel.tsan
- store_artifacts:
path: /build/envoy/generated/failed-testlogs
path: /build/envoy/generated
destination: /

compile_time_options:
executor: ubuntu-build
steps:
- run: rm -rf /home/circleci/project/.git # CircleCI git caching is likely broken
- checkout
- run: ci/do_circle_ci.sh bazel.compile_time_options
- store_artifacts:
path: /build/envoy/generated/failed-testlogs
path: /build/envoy/generated
destination: /
api:
executor: ubuntu-build
steps:
Expand All @@ -61,7 +66,8 @@ jobs:
- "fb:f3:fe:be:1c:b2:ec:b6:25:f9:7b:a6:87:54:02:8c"
- run: ci/api_mirror.sh
- store_artifacts:
path: /build/envoy/generated/failed-testlogs
path: /build/envoy/generated
destination: /
filter_example_mirror:
executor: ubuntu-build
steps:
Expand Down Expand Up @@ -105,7 +111,8 @@ jobs:
no_output_timeout: 60m
- run: ci/coverage_publish.sh
- store_artifacts:
path: /build/envoy/generated/coverage
path: /build/envoy/generated
destination: /

clang_tidy:
executor: ubuntu-build
Expand Down
6 changes: 5 additions & 1 deletion ci/build_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ BAZEL_OPTIONS="--package_path %workspace%:${ENVOY_SRCDIR}"
export BAZEL_QUERY_OPTIONS="${BAZEL_OPTIONS}"
export BAZEL_BUILD_OPTIONS="--strategy=Genrule=standalone --spawn_strategy=standalone \
--verbose_failures ${BAZEL_OPTIONS} --action_env=HOME --action_env=PYTHONUSERBASE \
--jobs=${NUM_CPUS} --show_task_finish ${BAZEL_BUILD_EXTRA_OPTIONS}"
--jobs=${NUM_CPUS} --show_task_finish --experimental_generate_json_trace_profile ${BAZEL_BUILD_EXTRA_OPTIONS}"
export BAZEL_TEST_OPTIONS="${BAZEL_BUILD_OPTIONS} --test_env=HOME --test_env=PYTHONUSERBASE \
--test_env=UBSAN_OPTIONS=print_stacktrace=1 \
--cache_test_results=no --test_output=all ${BAZEL_EXTRA_TEST_OPTIONS}"
Expand Down Expand Up @@ -109,6 +109,10 @@ mkdir -p "${ENVOY_COVERAGE_DIR}"
export ENVOY_FAILED_TEST_LOGS="${ENVOY_BUILD_DIR}"/generated/failed-testlogs
mkdir -p "${ENVOY_FAILED_TEST_LOGS}"

# This is where we copy the build profile to.
export ENVOY_BUILD_PROFILE="${ENVOY_BUILD_DIR}"/generated/build-profile
mkdir -p "${ENVOY_BUILD_PROFILE}"

# This is where we build for bazel.release* and bazel.dev.
export ENVOY_CI_DIR="${ENVOY_SRCDIR}"/ci

Expand Down
8 changes: 8 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ fi

echo "building using ${NUM_CPUS} CPUs"

function collect_build_profile() {
cp -f "$(bazel info output_base)/command.profile" "${ENVOY_BUILD_PROFILE}/$1.profile" || true
}

function bazel_with_collection() {
declare -r BAZEL_OUTPUT="${ENVOY_SRCDIR}"/bazel.output.txt
bazel $* | tee "${BAZEL_OUTPUT}"
Expand All @@ -30,12 +34,14 @@ function bazel_with_collection() {
done
exit "${BAZEL_STATUS}"
fi
collect_build_profile $1
}

function bazel_release_binary_build() {
echo "Building..."
cd "${ENVOY_CI_DIR}"
bazel build ${BAZEL_BUILD_OPTIONS} -c opt //source/exe:envoy-static
collect_build_profile release_build
# Copy the envoy-static binary somewhere that we can access outside of the
# container.
cp -f \
Expand All @@ -54,6 +60,7 @@ function bazel_debug_binary_build() {
echo "Building..."
cd "${ENVOY_CI_DIR}"
bazel build ${BAZEL_BUILD_OPTIONS} -c dbg //source/exe:envoy-static
collect_build_profile debug_build
# Copy the envoy-static binary somewhere that we can access outside of the
# container.
cp -f \
Expand Down Expand Up @@ -248,6 +255,7 @@ elif [[ "$1" == "bazel.coverage" ]]; then
# directory. Wow.
cd "${ENVOY_BUILD_DIR}"
SRCDIR="${GCOVR_DIR}" "${ENVOY_SRCDIR}"/test/run_envoy_bazel_coverage.sh
collect_build_profile coverage
exit 0
elif [[ "$1" == "bazel.clang_tidy" ]]; then
setup_clang_toolchain
Expand Down

0 comments on commit 13a3bbc

Please sign in to comment.