@@ -22,8 +22,22 @@ echo "skipping build + test runs"
22
22
exit 0
23
23
fi
24
24
25
- tools/bazel build //:all --verbose_failures
26
- tools/bazel build //python:all --verbose_failures
25
+ BAZEL_DISK_CACHE_FOLDER=" /ci/cache/bazel-disk-cache-$( hostname) "
26
+ readonly BAZEL_DISK_CACHE_FOLDER
27
+ # Cleanup the cache if any of the two conditions are true.
28
+ BAZEL_DISK_CACHE_GC_OPTIONS=" --experimental_disk_cache_gc_max_age=7d --experimental_disk_cache_gc_max_size=10G"
29
+ # We don't run a bazel daemon in background, so we do a GC during the build,
30
+ # that's why we specify _idle_delay=0.
31
+ BAZEL_DISK_CACHE_GC_OPTIONS+=" --experimental_disk_cache_gc_idle_delay=0"
32
+ readonly BAZEL_DISK_CACHE_GC_OPTIONS
33
+
34
+ BAZEL_DISK_CACHE_FLAGS=" --disk_cache=${BAZEL_DISK_CACHE_FOLDER} ${BAZEL_DISK_CACHE_GC_OPTIONS} "
35
+ readonly BAZEL_DISK_CACHE_FLAGS
36
+
37
+ # shellcheck disable=SC2086
38
+ tools/bazel build //:all ${BAZEL_DISK_CACHE_FLAGS} --verbose_failures
39
+ # shellcheck disable=SC2086
40
+ tools/bazel build //python:all ${BAZEL_DISK_CACHE_FLAGS} --verbose_failures
27
41
28
42
# Smoke test that processes run without crashing.
29
43
./bazel-bin/traced &
@@ -37,3 +51,6 @@ kill $(jobs -p)
37
51
# Check the amalgamated build here to avoid slowing down all the Linux bots.
38
52
echo -e " \n\n***** Testing amalgamated build *****\n"
39
53
tools/test_gen_amalgamated.py
54
+
55
+ # Print the size of the bazel cache to make sure it won't grow infinitely.
56
+ du -sh " ${BAZEL_DISK_CACHE_FOLDER} "
0 commit comments