Skip to content

Commit fb1e376

Browse files
committed
fix
Signed-off-by: Junpu Fan <[email protected]>
1 parent 328993e commit fb1e376

File tree

5 files changed

+908
-835
lines changed

5 files changed

+908
-835
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/actions/pr-permission-gate/action.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/pr-sglang.yml

Lines changed: 122 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
types: [opened, reopened, synchronize]
77
paths:
88
- "**sglang**"
9+
- ".github/workflows/pr-sglang.yml"
910

1011
permissions:
1112
contents: read
@@ -79,11 +80,36 @@ jobs:
7980
test-change:
8081
- "test/sglang/**"
8182
83+
setup-variables:
84+
runs-on: ubuntu-latest
85+
needs: [gatekeeper, check-changes]
86+
outputs:
87+
sglang-version: ${{ env.SGLANG_VERSION }}
88+
python-version: ${{ env.PYTHON_VERSION }}
89+
cuda-version: ${{ env.CUDA_VERSION }}
90+
os-version: ${{ env.OS_VERSION }}
91+
container-type: ${{ env.CONTAINER_TYPE }}
92+
framework: ${{ env.FRAMEWORK }}
93+
prod-sagemaker-image: ${{ env.PROD_SAGEMAKER_IMAGE }}
94+
test-artifacts-directory: ${{ env.TEST_ARTIFACTS_DIRECTORY }}
95+
steps:
96+
- name: Setup variables
97+
run: |
98+
echo "Setting up environment variables as job outputs"
99+
echo "SGLANG_VERSION=${{ env.SGLANG_VERSION }}"
100+
echo "PYTHON_VERSION=${{ env.PYTHON_VERSION }}"
101+
echo "CUDA_VERSION=${{ env.CUDA_VERSION }}"
102+
echo "OS_VERSION=${{ env.OS_VERSION }}"
103+
echo "CONTAINER_TYPE=${{ env.CONTAINER_TYPE }}"
104+
echo "FRAMEWORK=${{ env.FRAMEWORK }}"
105+
echo "PROD_SAGEMAKER_IMAGE=${{ env.PROD_SAGEMAKER_IMAGE }}"
106+
echo "TEST_ARTIFACTS_DIRECTORY=${{ env.TEST_ARTIFACTS_DIRECTORY }}"
107+
82108
# ======================================================
83109
# =============== SGLang SageMaker jobs ================
84110
# ======================================================
85111
build-sglang-image:
86-
needs: [check-changes]
112+
needs: [check-changes, setup-variables]
87113
if: needs.check-changes.outputs.build-change == 'true'
88114
runs-on:
89115
- codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
@@ -133,7 +159,7 @@ jobs:
133159
docker rmi ${CI_IMAGE_URI}
134160
135161
set-test-environment:
136-
needs: [check-changes, build-sglang-image]
162+
needs: [check-changes, setup-variables, build-sglang-image]
137163
if: |
138164
always() && !failure() && !cancelled() &&
139165
(needs.check-changes.outputs.build-change == 'true' || needs.check-changes.outputs.test-change == 'true')
@@ -164,144 +190,107 @@ jobs:
164190
echo "IMAGE_URI=${IMAGE_URI}" >> ${GITHUB_OUTPUT}
165191
166192
sglang-local-benchmark-test:
167-
needs: [set-test-environment, build-sglang-image]
193+
needs: [setup-variables, set-test-environment, build-sglang-image]
168194
if: success()
169-
runs-on:
170-
- codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
171-
fleet:x86-g6xl-runner
172-
buildspec-override:true
173-
concurrency:
174-
group: ${{ github.workflow }}-sglang-local-benchmark-test-${{ github.event.pull_request.number }}
175-
cancel-in-progress: true
176-
steps:
177-
- name: Checkout DLC source
178-
uses: actions/checkout@v5
179-
180-
- name: Container pull
181-
uses: ./.github/actions/ecr-authenticate
182-
with:
183-
aws-account-id: ${{ needs.set-test-environment.outputs.aws-account-id }}
184-
aws-region: ${{ vars.AWS_REGION }}
185-
image-uri: ${{ needs.set-test-environment.outputs.image-uri }}
186-
187-
- name: Setup for SGLang datasets
188-
run: |
189-
mkdir -p ${TEST_ARTIFACTS_DIRECTORY}/dataset
190-
if [ ! -f ${TEST_ARTIFACTS_DIRECTORY}/dataset/ShareGPT_V3_unfiltered_cleaned_split.json ]; then
191-
echo "Downloading ShareGPT dataset..."
192-
wget -P ${TEST_ARTIFACTS_DIRECTORY}/dataset https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json
193-
else
194-
echo "ShareGPT dataset already exists. Skipping download."
195-
fi
196-
197-
- name: Start container
198-
run: |
199-
CONTAINER_ID=$(docker run -d -it --rm --gpus=all \
200-
-v ${HOME}/.cache/huggingface:/root/.cache/huggingface \
201-
-v ${TEST_ARTIFACTS_DIRECTORY}/dataset:/dataset \
202-
-p 30000:30000 \
203-
-e SM_SGLANG_MODEL_PATH=Qwen/Qwen3-0.6B \
204-
-e SM_SGLANG_REASONING_PARSER=qwen3 \
205-
-e SM_SGLANG_HOST=127.0.0.1 \
206-
-e SM_SGLANG_PORT=30000 \
207-
-e HF_TOKEN=${{ secrets.HUGGING_FACE_HUB_TOKEN }} \
208-
${{ needs.set-test-environment.outputs.image-uri }})
209-
echo "CONTAINER_ID=${CONTAINER_ID}" >> ${GITHUB_ENV}
210-
echo "Waiting for serving endpoint startup ..."
211-
sleep 120s
212-
docker logs ${CONTAINER_ID}
213-
214-
- name: Run SGLang tests
215-
run: |
216-
docker exec ${CONTAINER_ID} python3 -m sglang.bench_serving \
217-
--backend sglang \
218-
--host 127.0.0.1 --port 30000 \
219-
--num-prompts 1000 \
220-
--model Qwen/Qwen3-0.6B \
221-
--dataset-name sharegpt \
222-
--dataset-path /dataset/ShareGPT_V3_unfiltered_cleaned_split.json
195+
uses: ./.github/workflows/reusable-test-execution.yml
196+
with:
197+
test-name: "sglang-local-benchmark"
198+
test-category: "benchmark"
199+
execution-mode: "container"
200+
container-execution-style: "external"
201+
aws-account-id: ${{ needs.set-test-environment.outputs.aws-account-id }}
202+
image-uri: ${{ needs.set-test-environment.outputs.image-uri }}
203+
workflow-id: ${{ github.event.pull_request.number }}
204+
run-id: ${{ github.run_id }}
205+
run-attempt: ${{ github.run_attempt }}
206+
runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:x86-g6xl-runner", "buildspec-override:true"]'
207+
concurrency-group: "${{ github.workflow }}-sglang-local-benchmark-test"
208+
concurrency-cancel-in-progress: true
209+
container-gpus: "all"
210+
container-volumes: '["${HOME}/.cache/huggingface:/root/.cache/huggingface", "${{ needs.setup-variables.outputs.test-artifacts-directory }}/dataset:/dataset"]'
211+
container-ports: '["30000:30000"]'
212+
container-environment: '["SM_SGLANG_MODEL_PATH=Qwen/Qwen3-0.6B", "SM_SGLANG_REASONING_PARSER=qwen3", "SM_SGLANG_HOST=127.0.0.1", "SM_SGLANG_PORT=30000"]'
213+
container-environment-secrets: '["HF_TOKEN"]'
214+
pre-setup-commands: |
215+
mkdir -p ${{ needs.setup-variables.outputs.test-artifacts-directory }}/dataset
216+
if [ ! -f ${{ needs.setup-variables.outputs.test-artifacts-directory }}/dataset/ShareGPT_V3_unfiltered_cleaned_split.json ]; then
217+
echo "Downloading ShareGPT dataset..."
218+
wget -P ${{ needs.setup-variables.outputs.test-artifacts-directory }}/dataset https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json
219+
else
220+
echo "ShareGPT dataset already exists. Skipping download."
221+
fi
222+
container-startup-delay: 120
223+
show-container-logs: true
224+
test-commands: |
225+
python3 -m sglang.bench_serving \
226+
--backend sglang \
227+
--host 127.0.0.1 --port 30000 \
228+
--num-prompts 1000 \
229+
--model Qwen/Qwen3-0.6B \
230+
--dataset-name sharegpt \
231+
--dataset-path /dataset/ShareGPT_V3_unfiltered_cleaned_split.json
232+
secrets:
233+
AWS_REGION: ${{ vars.AWS_REGION }}
223234

224235
sglang-frontend-test:
225-
needs: [build-sglang-image, set-test-environment]
236+
needs: [setup-variables, build-sglang-image, set-test-environment]
226237
if: success()
227-
runs-on:
228-
- codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
229-
fleet:x86-g6exl-runner
230-
buildspec-override:true
231-
concurrency:
232-
group: ${{ github.workflow }}-sglang-frontend-test-${{ github.event.pull_request.number }}
233-
cancel-in-progress: true
234-
steps:
235-
- name: Checkout DLC source
236-
uses: actions/checkout@v5
237-
238-
- name: Container pull
239-
uses: ./.github/actions/ecr-authenticate
240-
with:
241-
aws-account-id: ${{ needs.set-test-environment.outputs.aws-account-id }}
242-
aws-region: ${{ vars.AWS_REGION }}
243-
image-uri: ${{ needs.set-test-environment.outputs.image-uri }}
244-
245-
- name: Checkout SGLang tests
246-
uses: actions/checkout@v5
247-
with:
248-
repository: sgl-project/sglang
249-
ref: v${{ env.SGLANG_VERSION }}
250-
path: sglang_source
251-
252-
- name: Start container
253-
run: |
254-
CONTAINER_ID=$(docker run -d -it --rm --gpus=all --entrypoint /bin/bash \
255-
-v ${HOME}/.cache/huggingface:/root/.cache/huggingface \
256-
-v ./sglang_source:/workdir --workdir /workdir \
257-
-e HF_TOKEN=${{ secrets.HUGGING_FACE_HUB_TOKEN }} \
258-
${{ needs.set-test-environment.outputs.image-uri }})
259-
echo "CONTAINER_ID=${CONTAINER_ID}" >> ${GITHUB_ENV}
260-
261-
- name: Setup for SGLang tests
262-
run: |
263-
docker exec ${CONTAINER_ID} sh -c '
264-
set -eux
265-
266-
bash scripts/ci/ci_install_dependency.sh
267-
'
268-
269-
- name: Run SGLang tests
270-
run: |
271-
docker exec ${CONTAINER_ID} sh -c '
272-
set -eux
273-
nvidia-smi
274-
275-
# Frontend Test
276-
cd /workdir/test/lang
277-
python3 run_suite.py --suite per-commit
278-
'
238+
uses: ./.github/workflows/reusable-test-execution.yml
239+
with:
240+
test-name: "sglang-frontend"
241+
test-category: "frontend"
242+
aws-account-id: ${{ needs.set-test-environment.outputs.aws-account-id }}
243+
image-uri: ${{ needs.set-test-environment.outputs.image-uri }}
244+
workflow-id: ${{ github.event.pull_request.number }}
245+
run-id: ${{ github.run_id }}
246+
run-attempt: ${{ github.run_attempt }}
247+
external-repo: "sgl-project/sglang"
248+
external-repo-ref: "v${{ needs.setup-variables.outputs.sglang-version }}"
249+
external-repo-path: "sglang_source"
250+
runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:x86-g6exl-runner", "buildspec-override:true"]'
251+
concurrency-group: "${{ github.workflow }}-sglang-frontend-test"
252+
concurrency-cancel-in-progress: true
253+
container-gpus: "all"
254+
container-entrypoint: "/bin/bash"
255+
container-volumes: '["${HOME}/.cache/huggingface:/root/.cache/huggingface", "./sglang_source:/workdir"]'
256+
container-environment: '[]'
257+
container-environment-secrets: '["HF_TOKEN"]'
258+
container-workdir: "/workdir"
259+
setup-commands: |
260+
bash scripts/ci/ci_install_dependency.sh
261+
test-commands: |
262+
nvidia-smi
263+
# Frontend Test
264+
cd /workdir/test/lang
265+
python3 run_suite.py --suite per-commit
266+
secrets:
267+
AWS_REGION: ${{ vars.AWS_REGION }}
279268

280269
sglang-sagemaker-endpoint-test:
281270
needs: [set-test-environment]
282271
if: |
283272
always() && !failure() && !cancelled() &&
284273
needs.set-test-environment.result == 'success'
285-
runs-on:
286-
- codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
287-
fleet:default-runner
288-
buildspec-override:true
289-
concurrency:
290-
group: ${{ github.workflow }}-sglang-sagemaker-endpoint-test-${{ github.event.pull_request.number }}
291-
cancel-in-progress: false
292-
steps:
293-
- name: Checkout DLC source
294-
uses: actions/checkout@v5
295-
296-
- name: Install test dependencies
297-
run: |
298-
uv venv
299-
source .venv/bin/activate
300-
uv pip install -r test/requirements.txt
301-
uv pip install -r test/sglang/sagemaker/requirements.txt
302-
303-
- name: Run sagemaker tests
304-
run: |
305-
source .venv/bin/activate
306-
cd test/
307-
python3 -m pytest -vs -rA --image-uri ${{ needs.set-test-environment.outputs.image-uri }} sglang/sagemaker
274+
uses: ./.github/workflows/reusable-test-execution.yml
275+
with:
276+
test-name: "sglang-sagemaker-endpoint"
277+
test-category: "integration"
278+
execution-mode: "local"
279+
workflow-id: ${{ github.event.pull_request.number }}
280+
run-id: ${{ github.run_id }}
281+
run-attempt: ${{ github.run_attempt }}
282+
runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:default-runner", "buildspec-override:true"]'
283+
concurrency-group: "${{ github.workflow }}-sglang-sagemaker-endpoint-test"
284+
concurrency-cancel-in-progress: false
285+
ecr-authenticate: false
286+
local-setup-commands: |
287+
uv venv
288+
source .venv/bin/activate
289+
uv pip install -r test/requirements.txt
290+
uv pip install -r test/sglang/sagemaker/requirements.txt
291+
local-test-commands: |
292+
source .venv/bin/activate
293+
cd test/
294+
python3 -m pytest -vs -rA --image-uri ${{ needs.set-test-environment.outputs.image-uri }} sglang/sagemaker
295+
secrets:
296+
AWS_REGION: ${{ vars.AWS_REGION }}

0 commit comments

Comments
 (0)