Skip to content

Commit

Permalink
Script
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Feb 28, 2024
1 parent 8704677 commit 91bff57
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 114 deletions.
204 changes: 102 additions & 102 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
97 changes: 97 additions & 0 deletions .github/workflows/system-install.yml
Original file line number Diff line number Diff line change
@@ -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
24 changes: 12 additions & 12 deletions check_system_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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,
)

Expand All @@ -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.")
Expand All @@ -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.")
Expand All @@ -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,
)

Expand All @@ -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.")
Loading

0 comments on commit 91bff57

Please sign in to comment.