From 6fca885a86a5ac91cd5022749f3fa2fc0c40c964 Mon Sep 17 00:00:00 2001 From: Alexander Bayandin Date: Sun, 30 Jun 2024 11:15:40 +0100 Subject: [PATCH] CI(compute-tools): enable sccache --- .github/workflows/build_and_test.yml | 6 ++++++ Dockerfile.compute-node | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 500c71f1c5..bf6b904506 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -867,6 +867,9 @@ jobs: PG_VERSION=${{ matrix.version }} BUILD_TAG=${{ needs.tag.outputs.build-tag }} TAG=${{ needs.build-build-tools-image.outputs.image-tag }} + RUSTC_WRAPPER=sccache + AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_DEV }} + AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_KEY_DEV }} provenance: false push: true pull: true @@ -907,6 +910,9 @@ jobs: GIT_VERSION=${{ github.event.pull_request.head.sha || github.sha }} BUILD_TAG=${{ needs.tag.outputs.build-tag }} TAG=${{ needs.build-build-tools-image.outputs.image-tag }} + RUSTC_WRAPPER=sccache + AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_DEV }} + AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_KEY_DEV }} provenance: false push: true pull: true diff --git a/Dockerfile.compute-node b/Dockerfile.compute-node index 7ab685625a..ca85cfbb7b 100644 --- a/Dockerfile.compute-node +++ b/Dockerfile.compute-node @@ -868,10 +868,22 @@ FROM $REPOSITORY/$IMAGE:$TAG AS compute-tools ARG BUILD_TAG ENV BUILD_TAG=$BUILD_TAG +ARG RUSTC_WRAPPER +ARG SCCACHE_BUCKET=neon-github-dev +ARG SCCACHE_REGION=eu-central-1 +ARG SCCACHE_S3_KEY_PREFIX=sccache +ARG AWS_ACCESS_KEY_ID +ARG AWS_SECRET_ACCESS_KEY + USER nonroot # Copy entire project to get Cargo.* files with proper dependencies for the whole project COPY --chown=nonroot . . -RUN cd compute_tools && mold -run cargo build --locked --profile release-line-debug-size-lto +RUN set -e \ + && RUSTFLAGS="-Clinker=clang -Clink-arg=-fuse-ld=mold -Clink-arg=-Wl,--no-rosegment" cargo build \ + --bin compute_ctl \ + --locked \ + --profile release-line-debug-size-lto \ + && sccache --show-stats ######################################################################################### #