From 36908feb367d24a958482c23cb219598cd97e615 Mon Sep 17 00:00:00 2001 From: Tim Morgan Date: Mon, 2 Dec 2024 07:41:29 -0600 Subject: [PATCH] Only build valgrind if needed --- Dockerfile | 9 ++++++--- Rakefile | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2e5c3d0ab..8a9f30663 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,13 +10,16 @@ RUN pip3 install compiledb || pip3 install compiledb --break-system-packages RUN gem install bundler --no-doc # Valgrind on our docker image is too old to handle compressed debug symbols or some such. -WORKDIR /tmp -RUN wget https://sourceware.org/pub/valgrind/valgrind-3.24.0.tar.bz2 && \ +ARG NEED_VALGRIND=false +RUN if [ "$NEED_VALGRIND" = "true" ]; then \ + cd /tmp && \ + wget https://sourceware.org/pub/valgrind/valgrind-3.24.0.tar.bz2 && \ tar xvf valgrind-3.24.0.tar.bz2 && \ cd valgrind-3.24.0 && \ ./configure && \ make -j 4 && \ - make install + make install; \ + fi ENV LC_ALL=C.UTF-8 ENV LLVM_CONFIG=/usr/lib/llvm-14/bin/llvm-config diff --git a/Rakefile b/Rakefile index 29f90c09a..b84d70153 100644 --- a/Rakefile +++ b/Rakefile @@ -308,6 +308,7 @@ task :docker_build_clang_release do '--build-arg CXX=clang++ ' \ '--build-arg NAT_CXX_FLAGS=-DNAT_GC_GUARD ' \ '--build-arg NAT_BUILD_MODE=release ' \ + "--build-arg NEED_VALGRIND=#{ENV.fetch('NEED_VALGRIND', 'false')} " \ '.' end @@ -391,7 +392,9 @@ task docker_test_all_ruby_spec_nightly: :docker_build_clang do "natalie_clang_#{ruby_version_string} test_all_ruby_spec_nightly" end -task docker_test_perf: :docker_build_clang_release do +task :docker_test_perf do + ENV['NEED_VALGRIND'] = 'true' + Rake::Task['docker_build_clang_release'].invoke sh "docker run #{docker_run_flags} " \ "-e STATS_API_SECRET=#{(ENV['STATS_API_SECRET'] || '').inspect} " \ "-e GIT_SHA=#{(ENV['LAST_COMMIT_SHA'] || '').inspect} " \