Scope srs caches by workload

This commit is contained in:
Zanie Blue
2026-06-09 15:41:37 -05:00
parent 37e0df4cbe
commit e86be3a9f0
9 changed files with 73 additions and 7 deletions
+9 -6
View File
@@ -2,6 +2,9 @@ name: "Setup srs"
description: "Install srs and restore its Cargo build cache"
inputs:
artifact-cache-scope:
description: "Stable name for the workload that reads and writes this artifact cache"
required: true
target-path:
description: "Cargo target profile directory to cache"
required: false
@@ -33,10 +36,10 @@ runs:
~/.cargo/registry/cache
~/.cargo/git/db
~/.cargo/srs-artifact-cache-v2
key: srs-artifacts-v1-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/rust-toolchain.toml', '.cargo/**') }}-${{ github.sha }}
key: srs-artifacts-v2-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ inputs.artifact-cache-scope }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/rust-toolchain.toml', '.cargo/**') }}-${{ github.sha }}
restore-keys: |
srs-artifacts-v1-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/rust-toolchain.toml', '.cargo/**') }}-
srs-artifacts-v1-2026.06.09-${{ runner.os }}-${{ runner.arch }}-
srs-artifacts-v2-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ inputs.artifact-cache-scope }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/rust-toolchain.toml', '.cargo/**') }}-
srs-artifacts-v2-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ inputs.artifact-cache-scope }}-
- name: "Restore Cargo target cache"
if: ${{ inputs.target-path != '' }}
@@ -44,10 +47,10 @@ runs:
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ inputs.target-path }}
key: srs-target-v1-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/rust-toolchain.toml', '.cargo/**') }}-${{ github.sha }}
key: srs-target-v2-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ inputs.artifact-cache-scope }}-${{ github.job }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/rust-toolchain.toml', '.cargo/**') }}-${{ github.sha }}
restore-keys: |
srs-target-v1-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/rust-toolchain.toml', '.cargo/**') }}-
srs-target-v1-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-
srs-target-v2-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ inputs.artifact-cache-scope }}-${{ github.job }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', '**/rust-toolchain.toml', '.cargo/**') }}-
srs-target-v2-2026.06.09-${{ runner.os }}-${{ runner.arch }}-${{ inputs.artifact-cache-scope }}-${{ github.job }}-
- name: "Install srs"
shell: bash
+10
View File
@@ -108,6 +108,8 @@ jobs:
- name: "Setup srs"
id: srs
uses: ./.github/actions/setup-srs
with:
artifact-cache-scope: depot-linux-bench
- name: "Install Rust toolchain"
run: rustup show
@@ -134,3 +136,11 @@ jobs:
run: cargo codspeed run
mode: simulation
token: ${{ secrets.CODSPEED_TOKEN }}
- name: "Save srs build cache"
if: ${{ inputs.save-rust-cache == 'true' }}
uses: ./.github/actions/save-srs-cache
with:
artifact-cache-hit: ${{ steps.srs.outputs.artifact-cache-hit }}
artifact-cache-primary-key: ${{ steps.srs.outputs.artifact-cache-primary-key }}
save-artifact-cache: "true"
+13
View File
@@ -27,6 +27,8 @@ jobs:
- name: "Setup srs"
id: srs
uses: ./.github/actions/setup-srs
with:
artifact-cache-scope: github-linux-no-debug
- name: "Build"
run: cargo build --profile no-debug
@@ -39,6 +41,13 @@ jobs:
./target/no-debug/uv
./target/no-debug/uvx
retention-days: 1
- name: "Save srs build cache"
if: ${{ inputs.save-rust-cache == 'true' }}
uses: ./.github/actions/save-srs-cache
with:
artifact-cache-hit: ${{ steps.srs.outputs.artifact-cache-hit }}
artifact-cache-primary-key: ${{ steps.srs.outputs.artifact-cache-primary-key }}
save-artifact-cache: "true"
build-binary-linux-aarch64:
name: "linux aarch64"
@@ -150,6 +159,7 @@ jobs:
id: srs
uses: ./.github/actions/setup-srs
with:
artifact-cache-scope: github-macos-no-debug
target-path: ${{ github.workspace }}/target/no-debug
- name: "Build"
run: cargo build --profile no-debug --bin uv --bin uvx
@@ -167,6 +177,9 @@ jobs:
if: ${{ inputs.save-rust-cache == 'true' }}
uses: ./.github/actions/save-srs-cache
with:
artifact-cache-hit: ${{ steps.srs.outputs.artifact-cache-hit }}
artifact-cache-primary-key: ${{ steps.srs.outputs.artifact-cache-primary-key }}
save-artifact-cache: "true"
target-cache-hit: ${{ steps.srs.outputs.target-cache-hit }}
target-cache-primary-key: ${{ steps.srs.outputs.target-cache-primary-key }}
target-path: ${{ github.workspace }}/target/no-debug
+2
View File
@@ -21,6 +21,8 @@ jobs:
- name: "Setup srs"
id: srs
uses: ./.github/actions/setup-srs
with:
artifact-cache-scope: github-linux-dev
- name: "Generate reference documentation"
run: |
cargo dev generate-options-reference
@@ -35,6 +35,8 @@ jobs:
- name: "Setup srs"
id: srs
uses: ./.github/actions/setup-srs
with:
artifact-cache-scope: github-linux-dev
- name: "Generate all"
run: cargo dev generate-all --mode dry-run
- name: "Check sysconfig mappings"
@@ -44,3 +46,10 @@ jobs:
- name: "Check JSON schema"
if: ${{ inputs.schema-changed == 'true' }}
run: cargo dev generate-json-schema --mode check
- name: "Save srs build cache"
if: ${{ inputs.save-rust-cache == 'true' }}
uses: ./.github/actions/save-srs-cache
with:
artifact-cache-hit: ${{ steps.srs.outputs.artifact-cache-hit }}
artifact-cache-primary-key: ${{ steps.srs.outputs.artifact-cache-primary-key }}
save-artifact-cache: "true"
+9
View File
@@ -107,10 +107,19 @@ jobs:
- name: "Setup srs"
id: srs
uses: ./.github/actions/setup-srs
with:
artifact-cache-scope: github-linux-clippy
- name: "Install Rust toolchain"
run: rustup show
- name: "Clippy"
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
- name: "Save srs build cache"
if: ${{ inputs.save-rust-cache == 'true' }}
uses: ./.github/actions/save-srs-cache
with:
artifact-cache-hit: ${{ steps.srs.outputs.artifact-cache-hit }}
artifact-cache-primary-key: ${{ steps.srs.outputs.artifact-cache-primary-key }}
save-artifact-cache: "true"
clippy-windows:
name: "clippy on windows"
timeout-minutes: 15
+14
View File
@@ -1,5 +1,10 @@
on:
workflow_call:
inputs:
save-rust-cache:
required: false
type: string
default: "true"
permissions: {}
@@ -21,5 +26,14 @@ jobs:
- name: "Setup srs"
id: srs
uses: ./.github/actions/setup-srs
with:
artifact-cache-scope: depot-linux-publish
- name: "cargo publish dry-run"
run: cargo publish --workspace --dry-run
- name: "Save srs build cache"
if: ${{ inputs.save-rust-cache == 'true' }}
uses: ./.github/actions/save-srs-cache
with:
artifact-cache-hit: ${{ steps.srs.outputs.artifact-cache-hit }}
artifact-cache-primary-key: ${{ steps.srs.outputs.artifact-cache-primary-key }}
save-artifact-cache: "true"
+4 -1
View File
@@ -79,6 +79,7 @@ jobs:
[[ "$file" == "rust-toolchain.toml" || "$file" == "crates/uv-build/rust-toolchain.toml" || "$file" =~ ^\.cargo/ ]] && rust_config_changed=1
[[ "$file" == "pyproject.toml" || "$file" =~ ^crates/.*/pyproject\.toml$ ]] && python_config_changed=1
[[ "$file" =~ ^\.github/workflows/.*\.yml$ ]] && workflow_changed=1
[[ "$file" =~ ^\.github/actions/(setup-srs|save-srs-cache)/ ]] && cache_action_changed=1
[[ "$file" == ".github/workflows/build-release-binaries.yml" || "$file" == ".github/workflows/release.yml" ]] && release_workflow_changed=1
[[ "$file" == "scripts/check_uv_wheel_contents.py" || "$file" == "scripts/patch-dist-manifest-checksums.py" || "$file" == "scripts/repair-sdist-cargo-lock.py" ]] && release_build_changed=1
[[ "$file" == ".github/workflows/ci.yml" ]] && ci_workflow_changed=1
@@ -104,7 +105,7 @@ jobs:
[[ $rust_code_changed || $rust_deps_changed || $rust_config_changed ]] && any_rust_changed=1
[[ $python_config_changed || $rust_deps_changed || $rust_config_changed || $uv_build_changed || $release_workflow_changed ]] && release_build_changed=1
[[ $publish_code_changed || $ci_workflow_changed ]] && publish_changed=1
[[ $rust_deps_changed || $rust_config_changed || $workflow_changed ]] && cache_relevant_changed=1
[[ $rust_deps_changed || $rust_config_changed || $workflow_changed || $cache_action_changed ]] && cache_relevant_changed=1
[[ $python_config_changed || $rust_deps_changed || $rust_config_changed || $dockerfile_changed || $docker_workflow_changed ]] && docker_build_changed=1
# Decisions
@@ -174,6 +175,8 @@ jobs:
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
uses: ./.github/workflows/check-publish.yml
with:
save-rust-cache: ${{ needs.plan.outputs.save-rust-cache }}
check-release:
needs: plan
+3
View File
@@ -36,6 +36,8 @@ jobs:
- name: "Setup srs"
id: srs
uses: ./.github/actions/setup-srs
with:
artifact-cache-scope: depot-linux-test
- name: "Install Rust toolchain"
run: rustup show
@@ -149,6 +151,7 @@ jobs:
id: srs
uses: ./.github/actions/setup-srs
with:
artifact-cache-scope: depot-macos-test
target-path: ${{ github.workspace }}/target/fast-build
- name: "Install Rust toolchain"