Wrap CC and CXX with sccache by default

Build scripts that compile C/C++ (cc crate, libduckdb-sys's bundled
DuckDB, ring's assembly) are not cached by RUSTC_WRAPPER and dominate
warm CI time on Rust projects with heavy native deps. Export
CC=sccache cc and CXX=sccache c++ so those compilations land in the
same sccache backend as rustc.

Gated behind a new sccache-wrap-cc input (default "true") so callers
with build systems that do not tolerate multi-word CC/CXX can opt out.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-05 21:56:32 -07:00
parent 8a04fb6158
commit a83a6d8f5c
2 changed files with 13 additions and 0 deletions

View File

@@ -39,6 +39,10 @@ inputs:
description: Optional S3 key prefix. Defaults to repository/runner/toolchain scope.
default: ""
required: false
sccache-wrap-cc:
description: Also wrap CC and CXX with sccache so build-script C/C++ compiles (e.g. libduckdb-sys, ring) hit the same cache as rustc. Set to "false" to opt out.
default: "true"
required: false
outputs:
sccache-enabled:
@@ -119,6 +123,10 @@ runs:
echo "SCCACHE_S3_ENABLE_VIRTUAL_HOST_STYLE=true" >> "$GITHUB_ENV"
fi
fi
if [ '${{ inputs.sccache-wrap-cc }}' = 'true' ]; then
echo "CC=sccache cc" >> "$GITHUB_ENV"
echo "CXX=sccache c++" >> "$GITHUB_ENV"
fi
- name: Start sccache
if: ${{ inputs.sccache == 'true' }}