Compiler Cache, Remote CAS & Distributed Builds

Scale from a single workstation to shared team caching and sandboxed multi-node compilation without modifying your CMake, Ninja, or Cargo projects.

CLI & Env Reference View llms-full.txt

1. Direct-Mode Compiler & Link Caching

FastCi supports both explicit invocation (fastci wrap -- gcc ... or fastci cc gcc ...) and implicit launcher mode (fastci gcc ... when set as CMAKE_*_COMPILER_LAUNCHER or RUSTC_WRAPPER).

export CMAKE_C_COMPILER_LAUNCHER=fastci
export CMAKE_CXX_COMPILER_LAUNCHER=fastci
export CMAKE_C_LINKER_LAUNCHER=fastci
export CMAKE_CXX_LINKER_LAUNCHER=fastci

cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
fastci stats
export RUSTC_WRAPPER=fastci
export FASTCI_VERIFY_INPUTS=sample
cargo build --release
fastci stats
MSVC Debug Flags: Use /Z7, Never /Zi

/Zi writes debug symbols into a shared vc140.pdb via mspdbsrv.exe, preventing safe concurrent caching. Replace /Zi with /Z7 (or /DEBUG:FASTLINK) in CMake release/CI presets to get full Windows cache hits.

2. Shared Remote CAS Server (remote-serve)

FastCi includes a lightweight, persistent-connection HTTP/1.1 Remote CAS server with bearer-token authentication and size-bounded LRU storage:

fastci remote-serve \
  --listen 0.0.0.0:8080 \
  --dir /var/lib/fastci-cas \
  --token "$FASTCI_REMOTE_TOKEN" \
  --max-size-gb 50
# Main branch (read + write)
export FASTCI_REMOTE_CACHE=https://cas.internal:8080
export FASTCI_REMOTE_TOKEN="$SECRET_CAS_TOKEN"

# Untrusted Pull Requests (strict read-only!)
export FASTCI_REMOTE_READ_ONLY=1
Security: Always Isolate Untrusted PRs

Never allow fork Pull Requests to write to the shared Remote CAS. Set FASTCI_REMOTE_READ_ONLY=1 (or omit FASTCI_REMOTE_TOKEN on write-protected servers) on pull_request events so attackers cannot poison artifacts used by main-branch builds.

3. Distributed Compilation (dist-serve & dist-worker)

For large C/C++ clean builds where even a warm cache is cold (e.g., editing a core header), FastCi's distributed mode dispatches preprocessed translation units across a pool of workers over HTTP/1.1 with FCIA v1 archive framing and BLAKE3 integrity verification.

fastci dist-serve \
  --listen 0.0.0.0:9090 \
  --token "$FASTCI_DIST_TOKEN"
fastci dist-worker \
  --scheduler http://coordinator.internal:9090 \
  --token "$FASTCI_DIST_TOKEN" \
  --toolchain /usr/bin/clang \
  --slots 8 \
  --sandbox bwrap
export FASTCI_DIST_URL=http://coordinator.internal:9090
export FASTCI_DIST_TOKEN="$FASTCI_DIST_TOKEN"
export FASTCI_DIST_LOCAL_FALLBACK=1
cmake --build build --parallel 32

4. Cache Inspection & Garbage Collection

# Inspect hit/miss counters and cache footprint
fastci stats
fastci cache stats --json

# Prune oldest artifacts down to 2 GiB
fastci cache gc --max-size-mb 2048

# Reset everything cleanly
fastci cache clean