diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74e67f9c1394..82b1be3af855 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,105 +17,105 @@ env: RUSTUP_MAX_RETRIES: 10 PYTHON_VERSION: "3.12" -jobs: - cargo-fmt: - name: "cargo fmt" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: "Install Rust toolchain" - run: rustup component add rustfmt - - name: "rustfmt" - run: cargo fmt --all --check - - cargo-clippy: - name: "cargo clippy" - strategy: - matrix: - os: [ubuntu-latest, windows-latest] - fail-fast: false - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - name: "Install Rust toolchain" - run: rustup component add clippy - - uses: Swatinem/rust-cache@v2 - with: - save-if: ${{ github.ref == 'refs/heads/main' }} - - name: "Clippy" - run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings - - cargo-test: - strategy: - matrix: - include: - # We use the large GitHub actions runners for faster testing - # For Ubuntu and Windows, this requires Organization-level configuration - # See: https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners#about-ubuntu-and-windows-larger-runners - - { os: "ubuntu", runner: "ubuntu-latest-large" } - - { os: "windows", runner: "windows-latest-large" } - - { os: "macos", runner: "macos-14" } - fail-fast: false - runs-on: - labels: ${{ matrix.runner }} - name: "cargo test | ${{ matrix.os }}" - steps: - - uses: actions/checkout@v4 - - if: ${{ matrix.os == 'macos' }} - name: "Install bootstrap dependencies" - run: brew install coreutils - - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: "Install pipx" - run: pip install pipx - - name: "Install required Python versions" - run: pipx run scripts/bootstrap/install.py - - name: "Install Rust toolchain" - run: rustup show - - if: ${{ matrix.os != 'windows' }} - uses: rui314/setup-mold@v1 - - name: "Install cargo nextest" - uses: taiki-e/install-action@v2 - with: - tool: cargo-nextest - - uses: Swatinem/rust-cache@v2 - with: - save-if: ${{ github.ref == 'refs/heads/main' }} - - name: "Cargo test" - run: | - cargo nextest run --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 12 --final-status-level slow - - name: "Smoke test" - if: ${{ matrix.os != 'windows' }} - run: | - uv="./target/debug/uv" - $uv venv - $uv pip install ruff - - name: "Smoke test" - if: ${{ matrix.os == 'windows' }} - run: | - Set-Alias -Name uv -Value ./target/debug/uv - uv venv - uv pip install ruff - - # Separate job for the nightly crate - windows-trampoline: - runs-on: windows-latest - name: "check windows trampoline" - steps: - - uses: actions/checkout@v4 - - name: "Install Rust toolchain" - working-directory: crates/uv-trampoline - run: | - rustup target add x86_64-pc-windows-msvc - rustup component add clippy rust-src --toolchain nightly-2024-01-23-x86_64-pc-windows-msvc - - uses: rui314/setup-mold@v1 - - uses: Swatinem/rust-cache@v2 - with: - workspaces: "crates/uv-trampoline" - - name: "Clippy" - working-directory: crates/uv-trampoline - run: cargo clippy --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings - - name: "Build" - working-directory: crates/uv-trampoline - run: cargo build --release --target x86_64-pc-windows-msvc +#jobs: +# cargo-fmt: +# name: "cargo fmt" +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - name: "Install Rust toolchain" +# run: rustup component add rustfmt +# - name: "rustfmt" +# run: cargo fmt --all --check +# +# cargo-clippy: +# name: "cargo clippy" +# strategy: +# matrix: +# os: [ubuntu-latest, windows-latest] +# fail-fast: false +# runs-on: ${{ matrix.os }} +# steps: +# - uses: actions/checkout@v4 +# - name: "Install Rust toolchain" +# run: rustup component add clippy +# - uses: Swatinem/rust-cache@v2 +# with: +# save-if: ${{ github.ref == 'refs/heads/main' }} +# - name: "Clippy" +# run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings +# +# cargo-test: +# strategy: +# matrix: +# include: +# # We use the large GitHub actions runners for faster testing +# # For Ubuntu and Windows, this requires Organization-level configuration +# # See: https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners#about-ubuntu-and-windows-larger-runners +# - { os: "ubuntu", runner: "ubuntu-latest-large" } +# - { os: "windows", runner: "windows-latest-large" } +# - { os: "macos", runner: "macos-14" } +# fail-fast: false +# runs-on: +# labels: ${{ matrix.runner }} +# name: "cargo test | ${{ matrix.os }}" +# steps: +# - uses: actions/checkout@v4 +# - if: ${{ matrix.os == 'macos' }} +# name: "Install bootstrap dependencies" +# run: brew install coreutils +# - uses: actions/setup-python@v5 +# with: +# python-version: "3.12" +# - name: "Install pipx" +# run: pip install pipx +# - name: "Install required Python versions" +# run: pipx run scripts/bootstrap/install.py +# - name: "Install Rust toolchain" +# run: rustup show +# - if: ${{ matrix.os != 'windows' }} +# uses: rui314/setup-mold@v1 +# - name: "Install cargo nextest" +# uses: taiki-e/install-action@v2 +# with: +# tool: cargo-nextest +# - uses: Swatinem/rust-cache@v2 +# with: +# save-if: ${{ github.ref == 'refs/heads/main' }} +# - name: "Cargo test" +# run: | +# cargo nextest run --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 12 --final-status-level slow +# - name: "Smoke test" +# if: ${{ matrix.os != 'windows' }} +# run: | +# uv="./target/debug/uv" +# $uv venv +# $uv pip install ruff +# - name: "Smoke test" +# if: ${{ matrix.os == 'windows' }} +# run: | +# Set-Alias -Name uv -Value ./target/debug/uv +# uv venv +# uv pip install ruff +# +# # Separate job for the nightly crate +# windows-trampoline: +# runs-on: windows-latest +# name: "check windows trampoline" +# steps: +# - uses: actions/checkout@v4 +# - name: "Install Rust toolchain" +# working-directory: crates/uv-trampoline +# run: | +# rustup target add x86_64-pc-windows-msvc +# rustup component add clippy rust-src --toolchain nightly-2024-01-23-x86_64-pc-windows-msvc +# - uses: rui314/setup-mold@v1 +# - uses: Swatinem/rust-cache@v2 +# with: +# workspaces: "crates/uv-trampoline" +# - name: "Clippy" +# working-directory: crates/uv-trampoline +# run: cargo clippy --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings +# - name: "Build" +# working-directory: crates/uv-trampoline +# run: cargo build --release --target x86_64-pc-windows-msvc diff --git a/.github/workflows/system-install.yml b/.github/workflows/system-install.yml new file mode 100644 index 000000000000..9e6d1a6a52cb --- /dev/null +++ b/.github/workflows/system-install.yml @@ -0,0 +1,97 @@ +name: System Install + +on: + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +env: + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + CARGO_TERM_COLOR: always + RUSTUP_MAX_RETRIES: 10 + PYTHON_VERSION: "3.12" + +jobs: + # Install Python on Ubuntu. + install-ubuntu: + name: "Install Python on Ubuntu" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: "Install Rust toolchain" + run: rustup update + + - uses: Swatinem/rust-cache@v2 +# with: +# save-if: ${{ github.ref == 'refs/heads/main' }} + + - name: "Build" + run: cargo build + + - name: "Validate global Python install" + run: python3.12 check_system_python.py $(which python3.12) --uv ./target/debug/uv + + # Install Python on macOS. + install-macos: + name: "Install Python on macOS" + runs-on: macos-14 + steps: + - uses: actions/checkout@v4 + + - name: "Install Python" + run: brew install python@3.8 + + - name: "Install Rust toolchain" + run: rustup update + + - uses: Swatinem/rust-cache@v2 +# with: +# save-if: ${{ github.ref == 'refs/heads/main' }} + + - name: "Build" + run: cargo build + + - name: "Validate global Python install" + run: python3.8 check_system_python.py $(which python3.8) --uv ./target/debug/uv + + # Install Python on Windows. + install-windows: + name: "Install Python on Windows" + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: "Install Python" + run: choco install python + +# - name: "Install Rust toolchain" +# run: rustup update +# +# - uses: Swatinem/rust-cache@v2 +## with: +## save-if: ${{ github.ref == 'refs/heads/main' }} +# +# - name: "Build" +# run: cargo build + + # Print Python path. + - name: "Print Python path" + run: | + echo "Python path: $(which python3.12)" + +# # Print uv path. +# - name: "Print uv path" +# run: | +# echo "uv path: $(which ./target/debug/uv)" + + - name: "Validate global Python install" + run: C:\ProgramData\Chocolatey\bin\python3.12 check_system_python.py C:\ProgramData\Chocolatey\bin\python3.12 --uv ./target/debug/uv diff --git a/check_system_python.py b/check_system_python.py index 7e74b48a8176..e40f84085511 100644 --- a/check_system_python.py +++ b/check_system_python.py @@ -23,8 +23,8 @@ code = subprocess.run( [python, "-m", "pip", "show", "black"], cwd=temp_dir, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, + # stdout=subprocess.DEVNULL, + # stderr=subprocess.DEVNULL, ) if code.returncode == 0: raise Exception("The package `black` is installed.") @@ -34,8 +34,8 @@ subprocess.run( [uv, "pip", "install", "black", "--python", python], cwd=temp_dir, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, +# stdout=subprocess.DEVNULL, +# stderr=subprocess.DEVNULL, check=True, ) @@ -44,8 +44,8 @@ code = subprocess.run( [python, "-m", "pip", "show", "black"], cwd=temp_dir, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, +# stdout=subprocess.DEVNULL, +# stderr=subprocess.DEVNULL, ) if code.returncode != 0: raise Exception("The package `black` isn't installed.") @@ -55,8 +55,8 @@ code = subprocess.run( ["black", "--version"], cwd=temp_dir, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, +# stdout=subprocess.DEVNULL, +# stderr=subprocess.DEVNULL, ) if code.returncode != 0: raise Exception("The package `black` isn't in the path.") @@ -66,8 +66,8 @@ subprocess.run( [uv, "pip", "uninstall", "black", "--python", python], cwd=temp_dir, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, +# stdout=subprocess.DEVNULL, +# stderr=subprocess.DEVNULL, check=True, ) @@ -76,8 +76,8 @@ code = subprocess.run( [python, "-m", "pip", "show", "black"], cwd=temp_dir, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, +# stdout=subprocess.DEVNULL, +# stderr=subprocess.DEVNULL, ) if code.returncode == 0: raise Exception("The package `black` is installed.") diff --git a/crates/uv/src/main.rs b/crates/uv/src/main.rs index 7c33e5081b9d..747c64610f8a 100644 --- a/crates/uv/src/main.rs +++ b/crates/uv/src/main.rs @@ -440,6 +440,11 @@ struct PipSyncArgs { no_index: bool, /// The Python interpreter into which packages should be installed. + /// + /// By default, `uv` installs into the virtual environment in the current working directory or + /// any parent directory. The `--python` option allows you to specify a different interpreter, + /// which is intended for use in continuous integration (CI) environments or other automated + /// workflows. #[clap(long)] python: Option, @@ -613,6 +618,11 @@ struct PipInstallArgs { no_index: bool, /// The Python interpreter into which packages should be installed. + /// + /// By default, `uv` installs into the virtual environment in the current working directory or + /// any parent directory. The `--python` option allows you to specify a different interpreter, + /// which is intended for use in continuous integration (CI) environments or other automated + /// workflows. #[clap(long)] python: Option, @@ -686,6 +696,11 @@ struct PipUninstallArgs { editable: Vec, /// The Python interpreter from which packages should be uninstalled. + /// + /// By default, `uv` uninstalls from the virtual environment in the current working directory or + /// any parent directory. The `--python` option allows you to specify a different interpreter, + /// which is intended for use in continuous integration (CI) environments or other automated + /// workflows. #[clap(long)] python: Option, }