upload-wheels.sh 3.06 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash

set -ex

# Assume wheels are in artifacts/dist/*.whl
wheel_files=(artifacts/dist/*.whl)

# Check that exactly one wheel is found
if [[ ${#wheel_files[@]} -ne 1 ]]; then
  echo "Error: Expected exactly one wheel file in artifacts/dist/, but found ${#wheel_files[@]}"
  exit 1
fi

# Get the single wheel file
wheel="${wheel_files[0]}"

17
18
19
20
21
22
23
24
25
26
27
28
29
# Detect architecture and rename 'linux' to appropriate manylinux version
arch=$(uname -m)
if [[ $arch == "x86_64" ]]; then
    manylinux_version="manylinux1"
elif [[ $arch == "aarch64" ]]; then
    manylinux_version="manylinux2014"
else
    echo "Warning: Unknown architecture $arch, using manylinux1 as default"
    manylinux_version="manylinux1"
fi

# Rename 'linux' to the appropriate manylinux version in the wheel filename
new_wheel="${wheel/linux/$manylinux_version}"
30
31
32
33
34
35
36
mv -- "$wheel" "$new_wheel"
wheel="$new_wheel"

# Extract the version from the wheel
version=$(unzip -p "$wheel" '**/METADATA' | grep '^Version: ' | cut -d' ' -f2)
echo "Version: $version"

37
38
normal_wheel="$wheel" # Save the original wheel filename

39
40
# If the version contains "dev", rename it to v1.0.0.dev for consistency
if [[ $version == *dev* ]]; then
41
42
43
44
45
46
    suffix="${version##*.}"
    if [[ $suffix == cu* ]]; then
        new_version="1.0.0.dev+${suffix}"
    else
        new_version="1.0.0.dev"
    fi
47
    new_wheel="${wheel/$version/$new_version}"
48
49
    # use cp to keep both files in the artifacts directory
    cp -- "$wheel" "$new_wheel"
50
51
52
53
54
    wheel="$new_wheel"
    version="$new_version"
fi

# Upload the wheel to S3
55
56
57
python3 .buildkite/generate_index.py --wheel "$normal_wheel"

# generate index for this commit
58
aws s3 cp "$wheel" "s3://vllm-wheels/$BUILDKITE_COMMIT/"
59
aws s3 cp "$normal_wheel" "s3://vllm-wheels/$BUILDKITE_COMMIT/"
60

61
if [[ $normal_wheel == *"cu126"* ]]; then
Huy Do's avatar
Huy Do committed
62
63
    # if $normal_wheel matches cu126, do not upload the index.html
    echo "Skipping index files for cu126 wheels"
64
65
66
elif [[ $normal_wheel == *"cu128"* ]]; then
    # if $normal_wheel matches cu128, do not upload the index.html
    echo "Skipping index files for cu128 wheels"
67
else
68
69
    # only upload index.html for cu129 wheels (default wheels) as it
    # is available on both x86 and arm64
70
71
72
    aws s3 cp index.html "s3://vllm-wheels/$BUILDKITE_COMMIT/vllm/index.html"
    aws s3 cp "s3://vllm-wheels/nightly/index.html" "s3://vllm-wheels/$BUILDKITE_COMMIT/index.html"
fi
73
74

# generate index for nightly
75
aws s3 cp "$wheel" "s3://vllm-wheels/nightly/"
76
aws s3 cp "$normal_wheel" "s3://vllm-wheels/nightly/"
77

78
if [[ $normal_wheel == *"cu126"* ]]; then
Huy Do's avatar
Huy Do committed
79
80
    # if $normal_wheel matches cu126, do not upload the index.html
    echo "Skipping index files for cu126 wheels"
81
82
83
elif [[ $normal_wheel == *"cu128"* ]]; then
    # if $normal_wheel matches cu128, do not upload the index.html
    echo "Skipping index files for cu128 wheels"
84
else
85
86
    # only upload index.html for cu129 wheels (default wheels) as it
    # is available on both x86 and arm64
87
88
    aws s3 cp index.html "s3://vllm-wheels/nightly/vllm/index.html"
fi
89

Huy Do's avatar
Huy Do committed
90
aws s3 cp "$wheel" "s3://vllm-wheels/$version/"
91
aws s3 cp index.html "s3://vllm-wheels/$version/vllm/index.html"