Measure srs cache effectiveness

This commit is contained in:
Zanie Blue
2026-06-09 17:41:08 -05:00
parent 74e9709fbb
commit f394a9d0e4
2 changed files with 126 additions and 0 deletions
+78
View File
@@ -49,6 +49,84 @@ jobs:
artifact-cache-primary-key: ${{ steps.srs.outputs.artifact-cache-primary-key }}
save-artifact-cache: "true"
srs-artifact-cache-probe:
name: "srs artifact cache probe (${{ matrix.cache_mode }})"
timeout-minutes: 20
runs-on: github-ubuntu-24.04-x86_64-8
strategy:
fail-fast: false
matrix:
cache_mode: [enabled, disabled]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Setup srs"
uses: ./.github/actions/setup-srs
with:
artifact-cache-scope: github-linux-no-debug
- name: "Build"
env:
CARGO_LOG: cargo::core::compiler=debug,cargo::core::compiler::fingerprint=warn,cargo::core::compiler::job_queue=warn,cargo::core::compiler::build_runner=warn
CARGO_TARGET_DIR: ${{ runner.temp }}/srs-artifact-cache-probe
CARGO_TERM_COLOR: never
SRS_CARGO_ARTIFACT_CACHE: ${{ matrix.cache_mode == 'enabled' && '1' || '0' }}
run: |
cache_root="$HOME/.cargo/srs-artifact-cache-v2"
diagnostics="$RUNNER_TEMP/srs-artifact-cache-${{ matrix.cache_mode }}"
mkdir -p "$cache_root" "$diagnostics"
initial_entries="$(find "$cache_root" -type f -name complete 2>/dev/null | wc -l | tr -d ' ')"
initial_size="$(du -sk "$cache_root" 2>/dev/null | cut -f1 || true)"
SECONDS=0
set +e
cargo -vv build --profile no-debug \
> "$diagnostics/stdout.log" \
2> "$diagnostics/stderr.log"
status="$?"
set -e
elapsed="$SECONDS"
final_entries="$(find "$cache_root" -type f -name complete 2>/dev/null | wc -l | tr -d ' ')"
final_size="$(du -sk "$cache_root" 2>/dev/null | cut -f1 || true)"
cache_hits="$(grep -c 'artifact cache hit for' "$diagnostics/stderr.log" || true)"
cache_stores="$(grep -c 'stored artifact cache entry for' "$diagnostics/stderr.log" || true)"
cache_rejections="$(grep -Ec 'not (storing|restoring) artifact cache|ignoring artifact cache' "$diagnostics/stderr.log" || true)"
rustc_runs="$(grep -Ec '^ *Running .*rustc' "$diagnostics/stderr.log" || true)"
{
echo "### srs artifact cache ${{ matrix.cache_mode }}"
echo
echo "| Metric | Value |"
echo "| --- | ---: |"
echo "| Wall time | ${elapsed}s |"
echo "| Initial entries | ${initial_entries} |"
echo "| Final entries | ${final_entries} |"
echo "| Initial size | ${initial_size:-0} KiB |"
echo "| Final size | ${final_size:-0} KiB |"
echo "| Artifact hits | ${cache_hits} |"
echo "| Artifact stores | ${cache_stores} |"
echo "| Artifact rejections | ${cache_rejections} |"
echo "| rustc launches | ${rustc_runs} |"
} | tee -a "$GITHUB_STEP_SUMMARY"
if [[ "$status" -ne 0 ]]; then
tail -200 "$diagnostics/stderr.log"
exit "$status"
fi
- name: "Upload diagnostics"
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: srs-artifact-cache-${{ matrix.cache_mode }}-${{ github.sha }}
path: ${{ runner.temp }}/srs-artifact-cache-${{ matrix.cache_mode }}
if-no-files-found: error
retention-days: 1
build-binary-linux-aarch64:
name: "linux aarch64"
timeout-minutes: 10
+48
View File
@@ -228,6 +228,54 @@ jobs:
target-cache-primary-key: ${{ steps.srs.outputs.target-cache-primary-key }}
target-path: ${{ github.workspace }}/target/fast-build
cargo-test-macos-stable-control:
timeout-minutes: 30
if: ${{ inputs.test-macos == 'true' }}
runs-on: depot-macos-15
name: "cargo test on macos (Rust 1.96 control)"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Install Rust toolchain"
run: rustup show
- name: "Create HFS+ disk image (no reflink support)"
run: |
hdiutil create -size 256m -fs HFS+ -volname NoReflink /tmp/noreflink.dmg
hdiutil attach /tmp/noreflink.dmg
echo "HFS_MOUNT=/Volumes/NoReflink" >> "$GITHUB_ENV"
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: "0.11.19"
- name: "Install required Python versions"
run: uv python install
- name: "Install cargo nextest"
uses: taiki-e/install-action@e49978b799e49ff429d162b7a30601a569ab6538 # v2.81.1
with:
tool: cargo-nextest
- name: "Cargo test"
env:
UV_HTTP_RETRIES: 5
RUST_BACKTRACE: 1
UV_INTERNAL__TEST_COW_FS: ${{ runner.temp }}
UV_INTERNAL__TEST_NOCOW_FS: ${{ env.HFS_MOUNT }}
UV_INTERNAL__TEST_ALT_FS: ${{ env.HFS_MOUNT }}
INSTA_UPDATE: new
INSTA_PENDING_DIR: ${{ github.workspace }}/pending-snapshots
run: |
cargo nextest run \
--cargo-profile fast-build \
--no-default-features \
--features test-python,test-python-managed,test-pypi,test-git,test-git-lfs,performance,test-crates-io,native-auth,apple-native \
--workspace \
--profile ci-macos
cargo-test-windows:
timeout-minutes: 15
runs-on: namespace-profile-windows-2022-x86-64-16