From 63cfbd9ad9d9d01761aa913c06435d8571cb63e8 Mon Sep 17 00:00:00 2001 From: Anthony Ronning <101225832+AnthonyRonning@users.noreply.github.com> Date: Sat, 10 Oct 2026 09:26:44 +0000 Subject: [PATCH] ci: report sccache stats from the build server --- .github/workflows/android-build.yml | 2 +- .github/workflows/android-pr-build.yml | 2 +- .github/workflows/desktop-build.yml | 4 ++-- .github/workflows/desktop-pr-build.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- .github/workflows/rust-tests.yml | 2 +- docs/repository-workflows.md | 6 ++++++ scripts/ci/_common.sh | 5 +++-- scripts/ci/sccache-stats.sh | 7 +++++++ 9 files changed, 25 insertions(+), 11 deletions(-) create mode 100755 scripts/ci/sccache-stats.sh diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 7c6e579ff..d071bb0f3 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -65,7 +65,7 @@ jobs: - name: Show sccache stats if: always() - run: nix develop --no-update-lock-file .#android -c sccache --show-stats + run: nix develop --no-update-lock-file .#android -c ./scripts/ci/sccache-stats.sh - name: Collect Android release checksums run: | diff --git a/.github/workflows/android-pr-build.yml b/.github/workflows/android-pr-build.yml index 0744e104a..2c35956d1 100644 --- a/.github/workflows/android-pr-build.yml +++ b/.github/workflows/android-pr-build.yml @@ -59,7 +59,7 @@ jobs: - name: Show sccache stats if: always() - run: nix develop --no-update-lock-file .#android -c sccache --show-stats + run: nix develop --no-update-lock-file .#android -c ./scripts/ci/sccache-stats.sh - name: Upload Android fake signed PR artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # was v4 diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 07a8c7f51..eba5955a3 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -55,7 +55,7 @@ jobs: - name: Show sccache stats if: always() - run: nix develop --no-update-lock-file .#ci -c sccache --show-stats + run: nix develop --no-update-lock-file .#ci -c ./scripts/ci/sccache-stats.sh - name: Collect macOS release checksums run: | @@ -133,7 +133,7 @@ jobs: - name: Show sccache stats if: always() - run: nix develop --no-update-lock-file .#desktop-linux -c sccache --show-stats + run: nix develop --no-update-lock-file .#desktop-linux -c ./scripts/ci/sccache-stats.sh - name: Collect Linux release checksums run: | diff --git a/.github/workflows/desktop-pr-build.yml b/.github/workflows/desktop-pr-build.yml index b44b33a80..5421fd0a3 100644 --- a/.github/workflows/desktop-pr-build.yml +++ b/.github/workflows/desktop-pr-build.yml @@ -42,7 +42,7 @@ jobs: - name: Show sccache stats if: always() - run: nix develop --no-update-lock-file .#ci -c sccache --show-stats + run: nix develop --no-update-lock-file .#ci -c ./scripts/ci/sccache-stats.sh - name: Upload macOS PR Build uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # was v4 @@ -135,7 +135,7 @@ jobs: - name: Show sccache stats if: always() - run: nix develop --no-update-lock-file .#desktop-linux -c sccache --show-stats + run: nix develop --no-update-lock-file .#desktop-linux -c ./scripts/ci/sccache-stats.sh - name: Upload Linux PR Builds uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # was v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f1522502..f3f837c9a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -197,7 +197,7 @@ jobs: - name: Show sccache stats if: always() - run: nix develop --no-update-lock-file .#${{ matrix.nix_shell }} -c sccache --show-stats + run: nix develop --no-update-lock-file .#${{ matrix.nix_shell }} -c ./scripts/ci/sccache-stats.sh - name: Collect desktop release checksums run: | @@ -434,7 +434,7 @@ jobs: - name: Show sccache stats if: always() - run: nix develop --no-update-lock-file .#android -c sccache --show-stats + run: nix develop --no-update-lock-file .#android -c ./scripts/ci/sccache-stats.sh - name: Collect Android release checksums run: | diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml index 5048c2dd4..a05a2e9f1 100644 --- a/.github/workflows/rust-tests.yml +++ b/.github/workflows/rust-tests.yml @@ -70,4 +70,4 @@ jobs: - name: Show sccache stats if: always() - run: nix develop --no-update-lock-file .#ci -c sccache --show-stats + run: nix develop --no-update-lock-file .#ci -c ./scripts/ci/sccache-stats.sh diff --git a/docs/repository-workflows.md b/docs/repository-workflows.md index e3fd942df..657aeb648 100644 --- a/docs/repository-workflows.md +++ b/docs/repository-workflows.md @@ -72,6 +72,12 @@ job trusts its runner with the selected environment's secrets. PR builds have no signing credentials and retain their existing branch-scoped caches. No persistent vendor disks or Docker builders are configured by these workflows. +Research's Unix compiler-cache statistics use `scripts/ci/sccache-stats.sh`, +which shares the build's cache configuration. In Actions the sccache socket +lives under `RUNNER_TEMP`, so separate Nix shells reach the same server despite +their different `TMPDIR` values. Cache archive restoration and compiler hits +remain separate measurements. + ## macOS runners and Apple toolchain Research desktop/iOS builds, iOS ONNX cache warming, Agent release-binary jobs diff --git a/scripts/ci/_common.sh b/scripts/ci/_common.sh index 596356cd8..7e03bc4c2 100755 --- a/scripts/ci/_common.sh +++ b/scripts/ci/_common.sh @@ -114,7 +114,8 @@ configure_sccache() { case "${os}" in darwin) - socket_root="${TMPDIR:-/tmp}" + # Nix creates a different TMPDIR for each workflow step. + socket_root="${RUNNER_TEMP:-${TMPDIR:-/tmp}}" export SCCACHE_SERVER_UDS="${SCCACHE_SERVER_UDS:-${socket_root%/}/maple-sccache-${os}.sock}" export SCCACHE_DIR="${SCCACHE_DIR:-${HOME}/Library/Caches/Mozilla.sccache}" ;; @@ -127,7 +128,7 @@ configure_sccache() { fi ;; *) - socket_root="${TMPDIR:-/tmp}" + socket_root="${RUNNER_TEMP:-${TMPDIR:-/tmp}}" export SCCACHE_SERVER_UDS="${SCCACHE_SERVER_UDS:-${socket_root%/}/maple-sccache-${os}.sock}" export SCCACHE_DIR="${SCCACHE_DIR:-${HOME}/.cache/sccache}" ;; diff --git a/scripts/ci/sccache-stats.sh b/scripts/ci/sccache-stats.sh new file mode 100755 index 000000000..521f92cd4 --- /dev/null +++ b/scripts/ci/sccache-stats.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/_common.sh" + +configure_sccache +exec sccache --show-stats