Skip to content

Commit 1a4fad0

Browse files
jinyan-li1sirutBuasai
authored andcommitted
Improve vLLM workflows (aws#5480)
* combinr workflow for vllm Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com>
1 parent ba33ed0 commit 1a4fad0

File tree

4 files changed

+543
-333
lines changed

4 files changed

+543
-333
lines changed

.github/workflows/pr-sglang.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: PR - SGLang
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- "docker/sglang/**"
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: pr-sglang-${{ github.event.pull_request.number }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
check-changes:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
sglang-sagemaker: ${{ steps.changes.outputs.sglang-sagemaker }}
22+
steps:
23+
- uses: actions/checkout@v5
24+
- uses: actions/setup-python@v6
25+
with:
26+
python-version: "3.12"
27+
- uses: pre-commit/action@v3.0.1
28+
with:
29+
extra_args: --all-files
30+
- name: Detect file changes
31+
id: changes
32+
uses: dorny/paths-filter@v3
33+
with:
34+
filters: |
35+
sglang-sagemaker:
36+
- "docker/sglang/Dockerfile"
37+
38+
build-sglang-image:
39+
needs: [check-changes]
40+
if: needs.check-changes.outputs.sglang-sagemaker == 'true'
41+
runs-on:
42+
- codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
43+
fleet:x86-build-runner
44+
steps:
45+
- uses: actions/checkout@v5
46+
- run: .github/scripts/runner_setup.sh
47+
- run: .github/scripts/buildkitd.sh
48+
- name: ECR login
49+
run: |
50+
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} |
51+
docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com
52+
53+
- name: Resolve image URI for build
54+
run: |
55+
IMAGE_URI=${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/ci:sglang-0.5.5-gpu-py312-cu129-ubuntu22.04-sagemaker-pr-${{ github.event.pull_request.number }}
56+
echo "Image URI to build: $IMAGE_URI"
57+
echo "IMAGE_URI=$IMAGE_URI" >> $GITHUB_ENV
58+
59+
- name: Build image
60+
run: |
61+
docker buildx build --progress plain \
62+
--build-arg CACHE_REFRESH="$(date +"%Y-%m-%d")" \
63+
--cache-to=type=inline \
64+
--cache-from=type=registry,ref=$IMAGE_URI \
65+
--tag $IMAGE_URI \
66+
--target sglang-sagemaker \
67+
-f docker/sglang/Dockerfile .
68+
69+
- name: Docker Push and save image URI artifact
70+
run: |
71+
docker push $IMAGE_URI
72+
docker rmi $IMAGE_URI
73+
echo $IMAGE_URI > image_uri.txt
74+
75+
- name: Upload image URI artifact
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: sglang-sagemaker-image-uri
79+
path: image_uri.txt
80+
81+
sglang-regression-test:
82+
needs: [build-sglang-image]
83+
if: needs.build-sglang-image.result == 'success'
84+
runs-on:
85+
- codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
86+
fleet:x86-g6xl-runner
87+
steps:
88+
- name: Checkout DLC source
89+
uses: actions/checkout@v5
90+
91+
- name: ECR login
92+
run: |
93+
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} |
94+
docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com
95+
96+
- name: Download image URI artifact
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: sglang-sagemaker-image-uri
100+
101+
- name: Resolve image URI for test
102+
run: |
103+
IMAGE_URI=$(cat image_uri.txt)
104+
echo "Resolved image URI: $IMAGE_URI"
105+
echo "IMAGE_URI=$IMAGE_URI" >> $GITHUB_ENV
106+
107+
- name: Pull image
108+
run: |
109+
docker pull $IMAGE_URI
110+
111+
- name: Checkout SGLang Tests
112+
uses: actions/checkout@v5
113+
with:
114+
repository: sgl-project/sglang
115+
ref: v0.5.5
116+
path: sglang_source
117+
118+
- name: Start container
119+
run: |
120+
CONTAINER_ID=$(docker run -d -it --rm --gpus=all --entrypoint /bin/bash \
121+
-v ${HOME}/.cache/huggingface:/root/.cache/huggingface \
122+
-v ./sglang_source:/workdir --workdir /workdir \
123+
-e HUGGING_FACE_HUB_TOKEN=${{ secrets.HUGGING_FACE_HUB_TOKEN }} \
124+
${IMAGE_URI})
125+
echo "CONTAINER_ID=$CONTAINER_ID" >> $GITHUB_ENV
126+
127+
- name: Run SGLang Tests
128+
run: |
129+
docker exec ${CONTAINER_ID} sh -c '
130+
set -eux
131+
nvidia-smi
132+
133+
# Regression Backend Runtime Test
134+
cd /workdir/test/srt
135+
python3 run_suite.py --suite per-commit-1-gpu
136+
137+
# Regression Frontend Language Test
138+
cd /workdir/test/lang
139+
python3 run_suite.py --suite per-commit
140+
'
141+
142+
- name: Cleanup container and images
143+
if: always()
144+
run: |
145+
docker rm -f ${CONTAINER_ID} || true
146+
docker image prune -a --force --filter "until=24h"
147+
docker system df

0 commit comments

Comments
 (0)