fix(ci): keep cmake/ninja files for proper caching

Don't remove CMakeCache.txt, build.ninja, .ninja_log etc. after baking.
These files are needed by ninja to know what's already been built,
preventing re-downloads of Zig, BoringSSL, and other dependencies.

Verified: After baking and simulating CI checkout (git clean -fdx -e build/ -e vendor/),
running `bun run build:release` proceeds directly to building without downloading any
dependencies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2026-01-17 08:42:30 +00:00
parent ab19da8156
commit 64fb607ba9
2 changed files with 4 additions and 5 deletions

View File

@@ -189,12 +189,12 @@ RUN git clone --depth=1 https://github.com/oven-sh/bun.git /var/lib/buildkite-ag
WORKDIR /var/lib/buildkite-agent/build
# Install dependencies, generate source lists, and run cmake configure to download build dependencies
# Keep cmake/ninja files so subsequent builds can skip already-downloaded dependencies
RUN bun install --frozen-lockfile && \
bun run scripts/glob-sources.mjs && \
mkdir -p build/release && \
cmake -S . -B build/release -G Ninja -DCMAKE_BUILD_TYPE=Release -DCI=ON && \
cmake --build build/release --target clone-zig clone-boringssl clone-mimalloc clone-zstd clone-lolhtml clone-cares clone-libdeflate clone-libarchive clone-tinycc clone-zlib clone-lshpack clone-brotli clone-highway clone-hdrhistogram clone-picohttpparser || true && \
rm -rf build/release/CMakeFiles build/release/CMakeCache.txt build/release/cmake_install.cmake build/release/build.ninja build/release/compile_commands.json && \
rm -rf node_modules
COPY ../*/agent.mjs /var/bun/scripts/

View File

@@ -122,10 +122,9 @@ cmake --build "$BUILD_PATH" --target clone-zig clone-boringssl clone-mimalloc cl
print "Downloading debug WebKit variant..."
cmake $CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug -B "$BUN_REPO_PATH/build/debug" || true
# Clean up build artifacts but keep downloaded dependencies
print "Cleaning up build artifacts..."
rm -rf "$BUILD_PATH/CMakeFiles" "$BUILD_PATH/CMakeCache.txt" "$BUILD_PATH/cmake_install.cmake" "$BUILD_PATH/build.ninja" "$BUILD_PATH/compile_commands.json" "$BUILD_PATH/.ninja_deps" "$BUILD_PATH/.ninja_log"
rm -rf "$BUN_REPO_PATH/build/debug/CMakeFiles" "$BUN_REPO_PATH/build/debug/CMakeCache.txt" "$BUN_REPO_PATH/build/debug/build.ninja" 2>/dev/null || true
# Keep cmake/ninja files so subsequent builds don't re-download dependencies
# The ninja build system tracks what's been built - removing these files causes re-downloads
print "Keeping build system files for caching..."
# Remove node_modules - will be reinstalled during actual builds
print "Removing node_modules..."