forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac_ci_steps.sh
executable file
·62 lines (49 loc) · 1.82 KB
/
mac_ci_steps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
set -e
function finish {
echo "disk space at end of build:"
df -h
}
trap finish EXIT
echo "disk space at beginning of build:"
df -h
# shellcheck source=ci/setup_cache.sh
. "$(dirname "$0")"/setup_cache.sh
read -ra BAZEL_BUILD_EXTRA_OPTIONS <<< "${BAZEL_BUILD_EXTRA_OPTIONS:-}"
read -ra BAZEL_EXTRA_TEST_OPTIONS <<< "${BAZEL_EXTRA_TEST_OPTIONS:-}"
BUILD_CONFIG="$(dirname "$(realpath "$0")")"/osx-build-config
# TODO(zuercher): remove --flaky_test_attempts when https://github.com/envoyproxy/envoy/issues/2428
# is resolved.
BAZEL_BUILD_OPTIONS=(
"--curses=no"
--verbose_failures
"--test_output=all"
"--flaky_test_attempts=integration@2"
"--override_repository=envoy_build_config=${BUILD_CONFIG}"
"${BAZEL_BUILD_EXTRA_OPTIONS[@]}"
"${BAZEL_EXTRA_TEST_OPTIONS[@]}")
NCPU=$(sysctl -n hw.ncpu)
if [[ $NCPU -gt 0 ]]; then
echo "limiting build to $NCPU jobs, based on CPU count"
BAZEL_BUILD_OPTIONS+=("--jobs=$NCPU")
fi
# Build envoy and run tests as separate steps so that failure output
# is somewhat more deterministic (rather than interleaving the build
# and test steps).
DEFAULT_TEST_TARGETS=(
"//test/integration:integration_test"
"//test/integration:protocol_integration_test"
"//test/integration:tcp_proxy_integration_test"
"//test/integration:extension_discovery_integration_test"
"//test/integration:listener_lds_integration_test")
if [[ $# -gt 0 ]]; then
TEST_TARGETS=("$@")
else
TEST_TARGETS=("${DEFAULT_TEST_TARGETS[@]}")
fi
if [[ "${TEST_TARGETS[*]}" == "${DEFAULT_TEST_TARGETS[*]}" ]]; then
bazel build "${BAZEL_BUILD_OPTIONS[@]}" //source/exe:envoy-static
fi
bazel test "${BAZEL_BUILD_OPTIONS[@]}" "${TEST_TARGETS[@]}"
# Additionally run macOS specific test suites
bazel test "${BAZEL_BUILD_OPTIONS[@]}" //test/extensions/network/dns_resolver/apple:apple_dns_impl_test