mirror of
https://github.com/astral-sh/uv
synced 2026-06-21 13:47:25 +00:00
Use SRS for Linux and macOS CI
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
name: "Save SRS cache"
|
||||
description: "Save the SRS Cargo build cache"
|
||||
|
||||
inputs:
|
||||
artifact-cache-hit:
|
||||
description: "Whether setup-srs restored the primary SRS artifact cache key"
|
||||
required: false
|
||||
default: "false"
|
||||
artifact-cache-primary-key:
|
||||
description: "Primary SRS artifact cache key from setup-srs"
|
||||
required: false
|
||||
default: ""
|
||||
save-artifact-cache:
|
||||
description: "Whether this job is the designated SRS artifact cache writer"
|
||||
required: false
|
||||
default: "false"
|
||||
target-cache-hit:
|
||||
description: "Whether setup-srs restored the primary Cargo target cache key"
|
||||
required: false
|
||||
default: "false"
|
||||
target-cache-primary-key:
|
||||
description: "Primary Cargo target cache key from setup-srs"
|
||||
required: false
|
||||
default: ""
|
||||
target-path:
|
||||
description: "Cargo target profile directory to cache"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Save SRS artifact cache"
|
||||
if: ${{ inputs.save-artifact-cache == 'true' && inputs.artifact-cache-hit != 'true' }}
|
||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/index
|
||||
~/.cargo/registry/cache
|
||||
~/.cargo/git/db
|
||||
~/.cargo/srs-artifact-cache-v2
|
||||
key: ${{ inputs.artifact-cache-primary-key }}
|
||||
|
||||
- name: "Save Cargo target cache"
|
||||
if: ${{ inputs.target-path != '' && inputs.target-cache-hit != 'true' }}
|
||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||
with:
|
||||
path: ${{ inputs.target-path }}
|
||||
key: ${{ inputs.target-cache-primary-key }}
|
||||
@@ -0,0 +1,54 @@
|
||||
name: "Setup SRS"
|
||||
description: "Install SRS and restore its Cargo build cache"
|
||||
|
||||
inputs:
|
||||
target-path:
|
||||
description: "Cargo target profile directory to cache"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
outputs:
|
||||
artifact-cache-hit:
|
||||
description: "Whether the primary SRS artifact cache key was restored"
|
||||
value: ${{ steps.artifact-cache.outputs.cache-hit }}
|
||||
artifact-cache-primary-key:
|
||||
description: "Primary SRS artifact cache key to use when saving"
|
||||
value: ${{ steps.artifact-cache.outputs.cache-primary-key }}
|
||||
target-cache-hit:
|
||||
description: "Whether the primary Cargo target cache key was restored"
|
||||
value: ${{ steps.target-cache.outputs.cache-hit }}
|
||||
target-cache-primary-key:
|
||||
description: "Primary Cargo target cache key to use when saving"
|
||||
value: ${{ steps.target-cache.outputs.cache-primary-key }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Restore SRS artifact cache"
|
||||
id: artifact-cache
|
||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/index
|
||||
~/.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 }}
|
||||
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 }}-
|
||||
|
||||
- name: "Restore Cargo target cache"
|
||||
if: ${{ inputs.target-path != '' }}
|
||||
id: target-cache
|
||||
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 }}
|
||||
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 }}-
|
||||
|
||||
- name: "Install SRS"
|
||||
shell: bash
|
||||
run: bash "$GITHUB_ACTION_PATH/install.sh"
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
version="2026.06.09"
|
||||
toolchain="srs-${version}"
|
||||
|
||||
case "$(uname -s)-$(uname -m)" in
|
||||
Darwin-arm64)
|
||||
target="aarch64-apple-darwin"
|
||||
checksum="0f81e1d4d4ecaf6ceaf190ce273ed7a1f0dbeba4f673d600455a3dee41516177"
|
||||
;;
|
||||
Linux-x86_64)
|
||||
target="x86_64-unknown-linux-gnu"
|
||||
checksum="45477e527129c972ebf7970677fd36e50e853a8d21ec949ae711b7a63a030fbb"
|
||||
;;
|
||||
*)
|
||||
echo "SRS ${version} does not support $(uname -s)-$(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
archive="srs-${version}-${target}.tar.gz"
|
||||
install_root="${RUNNER_TEMP:-${HOME}/code/tmp}/srs-toolchains"
|
||||
snapshot="${install_root}/srs-${version}-${target}"
|
||||
|
||||
mkdir -p "$install_root"
|
||||
curl \
|
||||
--proto '=https' \
|
||||
--tlsv1.2 \
|
||||
--retry 5 \
|
||||
--retry-all-errors \
|
||||
--location \
|
||||
--silent \
|
||||
--show-error \
|
||||
--fail \
|
||||
"https://github.com/zanieb/srs/releases/download/${version}/${archive}" \
|
||||
--output "${install_root}/${archive}"
|
||||
|
||||
actual_checksum="$(shasum -a 256 "${install_root}/${archive}" | cut -d ' ' -f 1)"
|
||||
if [[ "$actual_checksum" != "$checksum" ]]; then
|
||||
echo "checksum mismatch for ${archive}: expected ${checksum}, got ${actual_checksum}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar -C "$install_root" -xzf "${install_root}/${archive}"
|
||||
rustup toolchain link "$toolchain" "$snapshot"
|
||||
|
||||
rustc +"$toolchain" -Vv
|
||||
cargo +"$toolchain" -Vv
|
||||
cargo +"$toolchain" clippy -V
|
||||
|
||||
{
|
||||
echo "CARGO_INCREMENTAL=0"
|
||||
echo "RUSTUP_TOOLCHAIN=${toolchain}"
|
||||
echo "SRS_CARGO_ARTIFACT_CACHE_MAX_SIZE=4GiB"
|
||||
} >> "$GITHUB_ENV"
|
||||
@@ -98,16 +98,16 @@ jobs:
|
||||
name: "simulated"
|
||||
runs-on: depot-ubuntu-24.04-4
|
||||
if: ${{ github.repository == 'astral-sh/uv' }}
|
||||
timeout-minutes: 20
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: "Checkout Branch"
|
||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
with:
|
||||
save-if: ${{ inputs.save-rust-cache == 'true' }}
|
||||
- name: "Setup SRS"
|
||||
id: srs
|
||||
uses: ./.github/actions/setup-srs
|
||||
|
||||
- name: "Install Rust toolchain"
|
||||
run: rustup show
|
||||
|
||||
@@ -17,19 +17,16 @@ env:
|
||||
jobs:
|
||||
build-binary-linux-libc:
|
||||
name: "linux libc"
|
||||
timeout-minutes: 10
|
||||
timeout-minutes: 20
|
||||
runs-on: github-ubuntu-24.04-x86_64-8
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Install mold"
|
||||
run: ./scripts/install-mold.sh
|
||||
|
||||
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
with:
|
||||
save-if: ${{ inputs.save-rust-cache == 'true' }}
|
||||
- name: "Setup SRS"
|
||||
id: srs
|
||||
uses: ./.github/actions/setup-srs
|
||||
|
||||
- name: "Build"
|
||||
run: cargo build --profile no-debug
|
||||
@@ -142,17 +139,18 @@ jobs:
|
||||
|
||||
build-binary-macos-aarch64:
|
||||
name: "macos aarch64"
|
||||
timeout-minutes: 10
|
||||
timeout-minutes: 20
|
||||
runs-on: macos-14 # github-macos-14-aarch64-3
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
- name: "Setup SRS"
|
||||
id: srs
|
||||
uses: ./.github/actions/setup-srs
|
||||
with:
|
||||
save-if: ${{ inputs.save-rust-cache == 'true' }}
|
||||
cache-bin: false
|
||||
target-path: ${{ github.workspace }}/target/no-debug
|
||||
- name: "Build"
|
||||
run: cargo build --profile no-debug --bin uv --bin uvx
|
||||
|
||||
@@ -165,6 +163,14 @@ jobs:
|
||||
./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:
|
||||
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
|
||||
|
||||
build-binary-macos-x86_64:
|
||||
name: "macos x86_64"
|
||||
timeout-minutes: 10
|
||||
|
||||
@@ -5,7 +5,7 @@ permissions: {}
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
timeout-minutes: 10
|
||||
timeout-minutes: 20
|
||||
name: "mkdocs"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -18,9 +18,9 @@ jobs:
|
||||
version: "0.11.21"
|
||||
|
||||
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
with:
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
- name: "Setup SRS"
|
||||
id: srs
|
||||
uses: ./.github/actions/setup-srs
|
||||
- name: "Generate reference documentation"
|
||||
run: |
|
||||
cargo dev generate-options-reference
|
||||
|
||||
@@ -19,22 +19,26 @@ env:
|
||||
|
||||
jobs:
|
||||
cargo-dev-generate-all:
|
||||
timeout-minutes: 10
|
||||
timeout-minutes: 20
|
||||
runs-on: ubuntu-latest
|
||||
name: "cargo dev generate-all"
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
with:
|
||||
save-if: ${{ inputs.save-rust-cache == 'true' }}
|
||||
- name: "Install Rustfmt"
|
||||
run: |
|
||||
rustup component add rustfmt
|
||||
mkdir -p "$RUNNER_TEMP/rustfmt-bin"
|
||||
ln -s "$(rustup which rustfmt)" "$RUNNER_TEMP/rustfmt-bin/rustfmt"
|
||||
echo "$RUNNER_TEMP/rustfmt-bin" >> "$GITHUB_PATH"
|
||||
- name: "Setup SRS"
|
||||
id: srs
|
||||
uses: ./.github/actions/setup-srs
|
||||
- name: "Generate all"
|
||||
run: cargo dev generate-all --mode dry-run
|
||||
- name: "Check sysconfig mappings"
|
||||
run: cargo dev generate-sysconfig-metadata --mode check
|
||||
- name: "Install Rustfmt"
|
||||
run: rustup component add rustfmt
|
||||
- name: "Check Packse scenario tests"
|
||||
run: cargo dev generate-scenario-tests --mode check
|
||||
- name: "Check JSON schema"
|
||||
|
||||
@@ -92,26 +92,25 @@ jobs:
|
||||
|
||||
clippy-ubuntu:
|
||||
name: "clippy on linux"
|
||||
timeout-minutes: 10
|
||||
timeout-minutes: 20
|
||||
if: ${{ inputs.code-changed == 'true' || github.ref == 'refs/heads/main' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
with:
|
||||
save-if: ${{ inputs.save-rust-cache == 'true' }}
|
||||
- name: "Setup SRS"
|
||||
id: srs
|
||||
uses: ./.github/actions/setup-srs
|
||||
- name: "Check uv_build dependencies"
|
||||
uses: EmbarkStudios/cargo-deny-action@bb137d7af7e4fb67e5f82a49c4fce4fad40782fe # v2.0.20
|
||||
with:
|
||||
command: check bans
|
||||
manifest-path: crates/uv-build/Cargo.toml
|
||||
- name: "Install Rust toolchain"
|
||||
run: rustup component add clippy
|
||||
run: rustup show
|
||||
- name: "Clippy"
|
||||
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
||||
|
||||
clippy-windows:
|
||||
name: "clippy on windows"
|
||||
timeout-minutes: 15
|
||||
|
||||
@@ -11,15 +11,15 @@ env:
|
||||
|
||||
jobs:
|
||||
cargo-publish-dry-run:
|
||||
timeout-minutes: 20
|
||||
timeout-minutes: 30
|
||||
runs-on: depot-ubuntu-24.04-8
|
||||
name: "cargo publish dry-run"
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
with:
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
- name: "Setup SRS"
|
||||
id: srs
|
||||
uses: ./.github/actions/setup-srs
|
||||
- name: "cargo publish dry-run"
|
||||
run: cargo publish --workspace --dry-run
|
||||
|
||||
+28
-10
@@ -25,7 +25,7 @@ jobs:
|
||||
# See: https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners#about-ubuntu-and-windows-larger-runners
|
||||
|
||||
cargo-test-linux:
|
||||
timeout-minutes: 10
|
||||
timeout-minutes: 20
|
||||
runs-on: depot-ubuntu-24.04-16
|
||||
name: "cargo test on linux"
|
||||
steps:
|
||||
@@ -33,12 +33,9 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Install mold"
|
||||
run: ./scripts/install-mold.sh
|
||||
|
||||
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
with:
|
||||
save-if: ${{ inputs.save-rust-cache == 'true' }}
|
||||
- name: "Setup SRS"
|
||||
id: srs
|
||||
uses: ./.github/actions/setup-srs
|
||||
|
||||
- name: "Install Rust toolchain"
|
||||
run: rustup show
|
||||
@@ -127,8 +124,16 @@ jobs:
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
|
||||
- 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"
|
||||
|
||||
cargo-test-macos:
|
||||
timeout-minutes: 20
|
||||
timeout-minutes: 30
|
||||
# Only run macOS tests on main without opt-in
|
||||
if: ${{ inputs.test-macos == 'true' }}
|
||||
runs-on: depot-macos-15
|
||||
@@ -138,9 +143,11 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
- name: "Setup SRS"
|
||||
id: srs
|
||||
uses: ./.github/actions/setup-srs
|
||||
with:
|
||||
save-if: ${{ inputs.save-rust-cache == 'true' }}
|
||||
target-path: ${{ github.workspace }}/target/fast-build
|
||||
|
||||
- name: "Install Rust toolchain"
|
||||
run: rustup show
|
||||
@@ -203,6 +210,17 @@ jobs:
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
|
||||
- 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"
|
||||
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/fast-build
|
||||
|
||||
cargo-test-windows:
|
||||
timeout-minutes: 15
|
||||
runs-on: namespace-profile-windows-2022-x86-64-16
|
||||
|
||||
Reference in New Issue
Block a user