Unverified Commit 50dc0c1e authored by Lianmin Zheng's avatar Lianmin Zheng Committed by GitHub
Browse files

Run tests based on labels (#10456)

parent 76becc1d
...@@ -6,6 +6,7 @@ on: ...@@ -6,6 +6,7 @@ on:
paths: paths:
- "python/sglang/**" - "python/sglang/**"
- "docs/**" - "docs/**"
types: [synchronize, labeled]
workflow_dispatch: workflow_dispatch:
...@@ -17,7 +18,7 @@ concurrency: ...@@ -17,7 +18,7 @@ concurrency:
jobs: jobs:
run-all-notebooks: run-all-notebooks:
runs-on: 1-gpu-runner runs-on: 1-gpu-runner
if: github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request' if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
......
...@@ -18,5 +18,13 @@ jobs: ...@@ -18,5 +18,13 @@ jobs:
python -m pip install pre-commit python -m pip install pre-commit
pre-commit install pre-commit install
- name: Linting - name: Run pre-commit checks
run: pre-commit run --all-files --show-diff-on-failure run: pre-commit run --all-files --show-diff-on-failure
- name: Run sgl-kernel clang-format checks
uses: DoozyX/clang-format-lint-action@v0.18.1
with:
source: sgl-kernel
extensions: h,c,cpp,hpp,cu,cuh,cc
clangFormatVersion: 18
style: file
...@@ -9,7 +9,7 @@ on: ...@@ -9,7 +9,7 @@ on:
branches: [ main ] branches: [ main ]
paths: paths:
- "sgl-router/**" - "sgl-router/**"
types: [opened, synchronize, reopened, labeled] types: [synchronize, labeled]
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
...@@ -24,11 +24,11 @@ permissions: ...@@ -24,11 +24,11 @@ permissions:
contents: read contents: read
pull-requests: write pull-requests: write
issues: write issues: write
jobs: jobs:
# Quick check job that always runs on PRs # Quick check job that always runs on PRs
benchmark-compile-check: benchmark-compile-check:
name: Benchmark Compilation Check name: Benchmark Compilation Check
if: github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
......
...@@ -17,6 +17,7 @@ on: ...@@ -17,6 +17,7 @@ on:
- "test/**" - "test/**"
- "sgl-kernel/**" - "sgl-kernel/**"
- ".github/workflows/pr-test-amd.yml" - ".github/workflows/pr-test-amd.yml"
types: [synchronize, labeled]
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
...@@ -25,8 +26,7 @@ concurrency: ...@@ -25,8 +26,7 @@ concurrency:
jobs: jobs:
accuracy-test-1-gpu-amd: accuracy-test-1-gpu-amd:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -52,8 +52,7 @@ jobs: ...@@ -52,8 +52,7 @@ jobs:
bash scripts/ci/amd_ci_exec.sh python3 models/test_qwen_models.py bash scripts/ci/amd_ci_exec.sh python3 models/test_qwen_models.py
accuracy-test-2-gpu-amd: accuracy-test-2-gpu-amd:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -77,8 +76,7 @@ jobs: ...@@ -77,8 +76,7 @@ jobs:
bash scripts/ci/amd_ci_exec.sh -e SGLANG_USE_AITER=0 python3 test_moe_eval_accuracy_large.py bash scripts/ci/amd_ci_exec.sh -e SGLANG_USE_AITER=0 python3 test_moe_eval_accuracy_large.py
mla-test-1-gpu-amd: mla-test-1-gpu-amd:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -102,8 +100,7 @@ jobs: ...@@ -102,8 +100,7 @@ jobs:
bash scripts/ci/amd_ci_exec.sh python3 test_mla.py bash scripts/ci/amd_ci_exec.sh python3 test_mla.py
performance-test-1-gpu-part-1-amd: performance-test-1-gpu-part-1-amd:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -143,8 +140,7 @@ jobs: ...@@ -143,8 +140,7 @@ jobs:
bash scripts/ci/amd_ci_exec.sh python3 -m unittest test_bench_serving.TestBenchServing.test_offline_throughput_non_stream_small_batch_size bash scripts/ci/amd_ci_exec.sh python3 -m unittest test_bench_serving.TestBenchServing.test_offline_throughput_non_stream_small_batch_size
performance-test-1-gpu-part-2-amd: performance-test-1-gpu-part-2-amd:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -178,8 +174,7 @@ jobs: ...@@ -178,8 +174,7 @@ jobs:
bash scripts/ci/amd_ci_exec.sh python3 -m unittest test_bench_serving.TestBenchServing.test_offline_throughput_default_fp8 bash scripts/ci/amd_ci_exec.sh python3 -m unittest test_bench_serving.TestBenchServing.test_offline_throughput_default_fp8
bench-test-2-gpu-amd: bench-test-2-gpu-amd:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -223,8 +218,7 @@ jobs: ...@@ -223,8 +218,7 @@ jobs:
bash scripts/ci/amd_ci_exec.sh python3 -m unittest test_bench_serving.TestBenchServing.test_moe_offline_throughput_without_radix_cache bash scripts/ci/amd_ci_exec.sh python3 -m unittest test_bench_serving.TestBenchServing.test_moe_offline_throughput_without_radix_cache
unit-test-backend-1-gpu-amd: unit-test-backend-1-gpu-amd:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -249,8 +243,7 @@ jobs: ...@@ -249,8 +243,7 @@ jobs:
bash scripts/ci/amd_ci_exec.sh python3 run_suite.py --suite per-commit-amd --auto-partition-id ${{ matrix.part }} --auto-partition-size 8 bash scripts/ci/amd_ci_exec.sh python3 run_suite.py --suite per-commit-amd --auto-partition-id ${{ matrix.part }} --auto-partition-size 8
unit-test-backend-1-gpu-amd-mi35x: unit-test-backend-1-gpu-amd-mi35x:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -274,8 +267,7 @@ jobs: ...@@ -274,8 +267,7 @@ jobs:
bash scripts/ci/amd_ci_exec.sh python3 run_suite.py --suite per-commit-amd-mi35x bash scripts/ci/amd_ci_exec.sh python3 run_suite.py --suite per-commit-amd-mi35x
unit-test-backend-2-gpu-amd: unit-test-backend-2-gpu-amd:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -299,8 +291,7 @@ jobs: ...@@ -299,8 +291,7 @@ jobs:
bash scripts/ci/amd_ci_exec.sh python3 run_suite.py --suite per-commit-2-gpu-amd bash scripts/ci/amd_ci_exec.sh python3 run_suite.py --suite per-commit-2-gpu-amd
unit-test-backend-8-gpu-amd: unit-test-backend-8-gpu-amd:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -324,8 +315,7 @@ jobs: ...@@ -324,8 +315,7 @@ jobs:
bash scripts/ci/amd_ci_exec.sh python3 run_suite.py --suite per-commit-8-gpu-amd --timeout-per-file 3600 bash scripts/ci/amd_ci_exec.sh python3 run_suite.py --suite per-commit-8-gpu-amd --timeout-per-file 3600
unit-test-sgl-kernel-amd: unit-test-sgl-kernel-amd:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -353,25 +343,3 @@ jobs: ...@@ -353,25 +343,3 @@ jobs:
docker exec -w /sglang-checkout/sgl-kernel/tests ci_sglang python3 -m pytest test_apply_token_bitmask_inplace.py docker exec -w /sglang-checkout/sgl-kernel/tests ci_sglang python3 -m pytest test_apply_token_bitmask_inplace.py
docker exec -w /sglang-checkout/sgl-kernel/tests ci_sglang python3 -m pytest test_activation.py docker exec -w /sglang-checkout/sgl-kernel/tests ci_sglang python3 -m pytest test_activation.py
docker exec -w /sglang-checkout/sgl-kernel/tests ci_sglang python3 -m pytest test_kvcacheio.py docker exec -w /sglang-checkout/sgl-kernel/tests ci_sglang python3 -m pytest test_kvcacheio.py
pr-test-amd-finish:
if: always()
needs: [
accuracy-test-1-gpu-amd, mla-test-1-gpu-amd, bench-test-2-gpu-amd,
accuracy-test-2-gpu-amd, performance-test-1-gpu-part-1-amd, performance-test-1-gpu-part-2-amd,
unit-test-backend-1-gpu-amd, unit-test-backend-1-gpu-amd-mi35x, unit-test-backend-2-gpu-amd,
unit-test-backend-8-gpu-amd, unit-test-sgl-kernel-amd
]
runs-on: ubuntu-latest
steps:
- name: Check all dependent job statuses
run: |
results=(${{ join(needs.*.result, ' ') }})
for result in "${results[@]}"; do
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
echo "Job failed with result: $result"
exit 1
fi
done
echo "All jobs completed successfully"
exit 0
...@@ -5,6 +5,7 @@ on: ...@@ -5,6 +5,7 @@ on:
branches: [ main ] branches: [ main ]
pull_request: pull_request:
branches: [ main ] branches: [ main ]
types: [synchronize, labeled]
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
...@@ -23,17 +24,29 @@ jobs: ...@@ -23,17 +24,29 @@ jobs:
check-changes: check-changes:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
src: ${{ steps.filter.outputs.src }} h20_files: ${{ steps.filter.outputs.h20_files }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Fail if the PR does not have the 'run-ci' label
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'run-ci')
run: |
echo "This pull request does not have the 'run-ci' label. Failing the workflow."
exit 1
- name: Fail if the PR is a draft
if: github.event_name == 'pull_request' && github.event.pull_request.draft == true
run: |
echo "This pull request is a draft. Failing the workflow."
exit 1
- name: Detect file changes - name: Detect file changes
id: filter id: filter
uses: dorny/paths-filter@v3 uses: dorny/paths-filter@v3
with: with:
filters: | filters: |
src: h20_files:
- "python/sglang/srt/models/deepseek*" - "python/sglang/srt/models/deepseek*"
- "python/sglang/srt/layers/moe/**" - "python/sglang/srt/layers/moe/**"
- ".github/workflows/pr-test-h20.yml" - ".github/workflows/pr-test-h20.yml"
...@@ -41,9 +54,7 @@ jobs: ...@@ -41,9 +54,7 @@ jobs:
per-commit-8-gpu-h20: per-commit-8-gpu-h20:
needs: [check-changes] needs: [check-changes]
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: needs.check-changes.outputs.h20_files == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 8-gpu-h20 runs-on: 8-gpu-h20
steps: steps:
- name: Checkout code - name: Checkout code
...@@ -65,17 +76,31 @@ jobs: ...@@ -65,17 +76,31 @@ jobs:
check-changes, check-changes,
per-commit-8-gpu-h20, per-commit-8-gpu-h20,
] ]
if: needs.check-changes.outputs.src == 'true' if: always()
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check all dependent job statuses - name: Check all dependent job statuses
run: | run: |
results=(${{ join(needs.*.result, ' ') }}) # Convert the 'needs' context to a JSON string
for result in "${results[@]}"; do json_needs='${{ toJson(needs) }}'
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
echo "Job failed with result: $result" # Get a list of all job names from the JSON keys
job_names=$(echo "$json_needs" | jq -r 'keys_unsorted[]')
for job in $job_names; do
# For each job, extract its result
result=$(echo "$json_needs" | jq -r --arg j "$job" '.[$j].result')
# Print the job name and its result
echo "$job: $result"
# Check for failure or cancellation and exit if found
if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
echo "The above jobs failed."
exit 1 exit 1
fi fi
done done
# If the loop completes, all jobs were successful
echo "All jobs completed successfully" echo "All jobs completed successfully"
exit 0 exit 0
...@@ -15,6 +15,7 @@ on: ...@@ -15,6 +15,7 @@ on:
- "scripts/ci/**" - "scripts/ci/**"
- "test/**" - "test/**"
- ".github/workflows/pr-test-npu.yml" - ".github/workflows/pr-test-npu.yml"
types: [synchronize, labeled]
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
...@@ -23,8 +24,7 @@ concurrency: ...@@ -23,8 +24,7 @@ concurrency:
jobs: jobs:
per-commit-1-ascend-npu: per-commit-1-ascend-npu:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
runs-on: linux-arm64-npu-1 runs-on: linux-arm64-npu-1
container: container:
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.2.rc1-910b-ubuntu22.04-py3.11 image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.2.rc1-910b-ubuntu22.04-py3.11
...@@ -58,8 +58,7 @@ jobs: ...@@ -58,8 +58,7 @@ jobs:
python3 run_suite.py --suite per-commit-1-ascend-npu python3 run_suite.py --suite per-commit-1-ascend-npu
per-commit-2-ascend-npu: per-commit-2-ascend-npu:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
runs-on: linux-arm64-npu-2 runs-on: linux-arm64-npu-2
container: container:
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.2.rc1-910b-ubuntu22.04-py3.11 image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.2.rc1-910b-ubuntu22.04-py3.11
...@@ -93,8 +92,7 @@ jobs: ...@@ -93,8 +92,7 @@ jobs:
python3 run_suite.py --suite per-commit-2-ascend-npu python3 run_suite.py --suite per-commit-2-ascend-npu
per-commit-4-ascend-npu: per-commit-4-ascend-npu:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
runs-on: linux-arm64-npu-4 runs-on: linux-arm64-npu-4
container: container:
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.2.rc1-910b-ubuntu22.04-py3.11 image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.2.rc1-910b-ubuntu22.04-py3.11
...@@ -128,8 +126,7 @@ jobs: ...@@ -128,8 +126,7 @@ jobs:
python3 run_suite.py --suite per-commit-4-ascend-npu --timeout-per-file 3600 python3 run_suite.py --suite per-commit-4-ascend-npu --timeout-per-file 3600
per-commit-16-ascend-a3: per-commit-16-ascend-a3:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
runs-on: linux-aarch64-a3-16 runs-on: linux-aarch64-a3-16
container: container:
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.2.rc1-a3-ubuntu22.04-py3.11 image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.2.rc1-a3-ubuntu22.04-py3.11
...@@ -161,24 +158,3 @@ jobs: ...@@ -161,24 +158,3 @@ jobs:
run: | run: |
cd test/srt cd test/srt
python3 run_suite.py --suite per-commit-16-ascend-a3 --timeout-per-file 5400 python3 run_suite.py --suite per-commit-16-ascend-a3 --timeout-per-file 5400
pr-test-npu-finish:
if: always()
needs:
- per-commit-1-ascend-npu
- per-commit-2-ascend-npu
- per-commit-4-ascend-npu
- per-commit-16-ascend-a3
runs-on: ubuntu-latest
steps:
- name: Check all dependent job statuses
run: |
results=(${{ join(needs.*.result, ' ') }})
for result in "${results[@]}"; do
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
echo "Job failed with result: $result"
exit 1
fi
done
echo "All jobs completed successfully"
exit 0
...@@ -13,6 +13,7 @@ on: ...@@ -13,6 +13,7 @@ on:
- 'python/sglang/srt/disaggregation/**' - 'python/sglang/srt/disaggregation/**'
- 'scripts/ci/ci_start_disaggregation_servers.sh' - 'scripts/ci/ci_start_disaggregation_servers.sh'
- 'sgl-router/**' - 'sgl-router/**'
types: [synchronize, labeled]
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
...@@ -26,8 +27,7 @@ permissions: ...@@ -26,8 +27,7 @@ permissions:
jobs: jobs:
test-disaggregation: test-disaggregation:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
runs-on: [h200] runs-on: [h200]
timeout-minutes: 45 timeout-minutes: 45
......
...@@ -9,6 +9,7 @@ on: ...@@ -9,6 +9,7 @@ on:
branches: [ main ] branches: [ main ]
paths: paths:
- "sgl-router/**" - "sgl-router/**"
types: [synchronize, labeled]
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
...@@ -21,7 +22,7 @@ env: ...@@ -21,7 +22,7 @@ env:
jobs: jobs:
unit-test-rust: unit-test-rust:
if: github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request' if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
...@@ -81,7 +82,7 @@ jobs: ...@@ -81,7 +82,7 @@ jobs:
run: sccache --show-stats run: sccache --show-stats
pytest-rust: pytest-rust:
if: github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request' if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
runs-on: BM.A10.4 runs-on: BM.A10.4
timeout-minutes: 25 timeout-minutes: 25
steps: steps:
......
...@@ -17,6 +17,7 @@ on: ...@@ -17,6 +17,7 @@ on:
- "test/**" - "test/**"
- "sgl-kernel/**" - "sgl-kernel/**"
- ".github/workflows/pr-test-xeon.yml" - ".github/workflows/pr-test-xeon.yml"
types: [synchronize, labeled]
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
...@@ -25,8 +26,7 @@ concurrency: ...@@ -25,8 +26,7 @@ concurrency:
jobs: jobs:
build-test: build-test:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
runs-on: xeon-gnr runs-on: xeon-gnr
env: env:
HF_HOME: /home/sdp/.cache/huggingface HF_HOME: /home/sdp/.cache/huggingface
...@@ -87,20 +87,3 @@ jobs: ...@@ -87,20 +87,3 @@ jobs:
if: always() if: always()
run: | run: |
docker rm -f ci_sglang_xeon || true docker rm -f ci_sglang_xeon || true
pr-test-xeon-finish:
if: always()
needs: [build-test]
runs-on: ubuntu-latest
steps:
- name: Check all dependent job statuses
run: |
results=(${{ join(needs.*.result, ' ') }})
for result in "${results[@]}"; do
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
echo "Job failed with result: $result"
exit 1
fi
done
echo "All jobs completed successfully"
exit 0
...@@ -2,9 +2,10 @@ name: PR Test ...@@ -2,9 +2,10 @@ name: PR Test
on: on:
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
types: [synchronize, labeled]
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
...@@ -21,47 +22,46 @@ concurrency: ...@@ -21,47 +22,46 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
# =============================================== sgl-kernel ==================================================== # =============================================== check changes ====================================================
check-changes:
sgl-kernel-check-changes:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
src: ${{ steps.filter.outputs.src }} main_package: ${{ steps.filter.outputs.main_package }}
sgl_kernel: ${{ steps.filter.outputs.sgl_kernel }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Fail if the PR does not have the 'run-ci' label
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'run-ci')
run: |
echo "This pull request does not have the 'run-ci' label. Failing the workflow."
exit 1
- name: Fail if the PR is a draft
if: github.event_name == 'pull_request' && github.event.pull_request.draft == true
run: |
echo "This pull request is a draft. Failing the workflow."
exit 1
- name: Detect file changes - name: Detect file changes
id: filter id: filter
uses: dorny/paths-filter@v3 uses: dorny/paths-filter@v3
with: with:
filters: | filters: |
src: main_package:
- "python/**"
- "scripts/ci/**"
- "test/**"
- ".github/workflows/pr-test.yml"
sgl_kernel:
- "sgl-kernel/**" - "sgl-kernel/**"
sgl-kernel-lint: # =============================================== sgl-kernel ====================================================
runs-on: ubuntu-latest
needs: sgl-kernel-check-changes
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') &&
github.event.pull_request.draft == false &&
needs.sgl-kernel-check-changes.outputs.src == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check clang-format
uses: DoozyX/clang-format-lint-action@v0.18.1
with:
source: sgl-kernel
extensions: h,c,cpp,hpp,cu,cuh,cc
clangFormatVersion: 18
style: file
sgl-kernel-build-wheels: sgl-kernel-build-wheels:
needs: sgl-kernel-check-changes needs: [check-changes]
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: needs.check-changes.outputs.sgl_kernel == 'true'
github.event.pull_request.draft == false &&
needs.sgl-kernel-check-changes.outputs.src == 'true'
runs-on: sgl-kernel-build-node runs-on: sgl-kernel-build-node
strategy: strategy:
matrix: matrix:
...@@ -91,7 +91,6 @@ jobs: ...@@ -91,7 +91,6 @@ jobs:
if: github.event_name != 'push' || (matrix.cuda-version != '11.8') if: github.event_name != 'push' || (matrix.cuda-version != '11.8')
run: | run: |
cd sgl-kernel cd sgl-kernel
chmod +x ./build.sh
./build.sh "${{ matrix.python-version }}" "${{ matrix.cuda-version }}" ./build.sh "${{ matrix.python-version }}" "${{ matrix.cuda-version }}"
- name: Upload artifacts - name: Upload artifacts
...@@ -101,10 +100,8 @@ jobs: ...@@ -101,10 +100,8 @@ jobs:
path: sgl-kernel/dist/* path: sgl-kernel/dist/*
sgl-kernel-unit-test: sgl-kernel-unit-test:
needs: [sgl-kernel-check-changes, sgl-kernel-build-wheels] needs: [check-changes, sgl-kernel-build-wheels]
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: needs.check-changes.outputs.sgl_kernel == 'true'
github.event.pull_request.draft == false &&
needs.sgl-kernel-check-changes.outputs.src == 'true'
runs-on: 1-gpu-runner runs-on: 1-gpu-runner
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
...@@ -121,13 +118,9 @@ jobs: ...@@ -121,13 +118,9 @@ jobs:
merge-multiple: true merge-multiple: true
pattern: wheel-python3.10-cuda12.9 pattern: wheel-python3.10-cuda12.9
- name: Install - name: Install dependencies
run: | run: |
bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
pip3 install torch==2.8.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/test/cu126 && pip3 install pytest
pip3 uninstall sgl-kernel -y || true
pip3 install sgl-kernel/dist/*whl --force-reinstall --no-deps
pip3 list | grep sgl-kernel
- name: Run test - name: Run test
timeout-minutes: 30 timeout-minutes: 30
...@@ -135,15 +128,9 @@ jobs: ...@@ -135,15 +128,9 @@ jobs:
cd sgl-kernel cd sgl-kernel
pytest tests/ pytest tests/
- name: Uninstall dependencies
run: |
pip3 uninstall sgl-kernel -y
sgl-kernel-mla-test: sgl-kernel-mla-test:
needs: [sgl-kernel-check-changes, sgl-kernel-build-wheels] needs: [check-changes, sgl-kernel-build-wheels]
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: needs.check-changes.outputs.sgl_kernel == 'true'
github.event.pull_request.draft == false &&
needs.sgl-kernel-check-changes.outputs.src == 'true'
runs-on: 1-gpu-runner runs-on: 1-gpu-runner
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
...@@ -160,13 +147,9 @@ jobs: ...@@ -160,13 +147,9 @@ jobs:
merge-multiple: true merge-multiple: true
pattern: wheel-python3.10-cuda12.9 pattern: wheel-python3.10-cuda12.9
- name: Install - name: Install dependencies
run: | run: |
bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
pip3 install torch==2.8.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/test/cu126
pip3 uninstall sgl-kernel -y || true
pip3 install sgl-kernel/dist/*whl --force-reinstall --no-deps
pip3 list | grep sgl-kernel
- name: Run test - name: Run test
timeout-minutes: 30 timeout-minutes: 30
...@@ -174,62 +157,19 @@ jobs: ...@@ -174,62 +157,19 @@ jobs:
cd test/srt cd test/srt
python3 test_mla_deepseek_v3.py python3 test_mla_deepseek_v3.py
- name: Uninstall dependencies
run: |
pip3 uninstall sgl-kernel -y
sgl-kernel-finish:
needs: [sgl-kernel-unit-test, sgl-kernel-mla-test, sgl-kernel-lint, sgl-kernel-build-wheels]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check all dependent job statuses
run: |
results=(${{ join(needs.*.result, ' ') }})
for result in "${results[@]}"; do
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
echo "Job failed with result: $result"
exit 1
fi
done
echo "All jobs completed successfully"
exit 0
# =============================================== primary ==================================================== # =============================================== primary ====================================================
check-changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Detect file changes
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
src:
- "python/**"
- "scripts/ci/**"
- "test/**"
- ".github/workflows/pr-test.yml"
- "sgl-kernel/**"
unit-test-frontend: unit-test-frontend:
needs: [check-changes, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 1-gpu-runner runs-on: 1-gpu-runner
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -238,7 +178,7 @@ jobs: ...@@ -238,7 +178,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
- name: Run test - name: Run test
timeout-minutes: 10 timeout-minutes: 10
...@@ -247,11 +187,9 @@ jobs: ...@@ -247,11 +187,9 @@ jobs:
python3 run_suite.py --suite per-commit python3 run_suite.py --suite per-commit
unit-test-backend-1-gpu: unit-test-backend-1-gpu:
needs: [check-changes, unit-test-frontend, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, unit-test-frontend, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 1-gpu-runner runs-on: 1-gpu-runner
strategy: strategy:
fail-fast: false fail-fast: false
...@@ -262,7 +200,7 @@ jobs: ...@@ -262,7 +200,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -271,7 +209,7 @@ jobs: ...@@ -271,7 +209,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
- name: Run test - name: Run test
timeout-minutes: 30 timeout-minutes: 30
...@@ -280,11 +218,9 @@ jobs: ...@@ -280,11 +218,9 @@ jobs:
python3 run_suite.py --suite per-commit --auto-partition-id ${{ matrix.part }} --auto-partition-size 10 python3 run_suite.py --suite per-commit --auto-partition-id ${{ matrix.part }} --auto-partition-size 10
unit-test-backend-2-gpu: unit-test-backend-2-gpu:
needs: [check-changes, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 2-gpu-runner runs-on: 2-gpu-runner
strategy: strategy:
fail-fast: false fail-fast: false
...@@ -295,7 +231,7 @@ jobs: ...@@ -295,7 +231,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -304,7 +240,7 @@ jobs: ...@@ -304,7 +240,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
- name: Run test - name: Run test
timeout-minutes: 30 timeout-minutes: 30
...@@ -313,11 +249,9 @@ jobs: ...@@ -313,11 +249,9 @@ jobs:
python3 run_suite.py --suite per-commit-2-gpu --auto-partition-id ${{ matrix.part }} --auto-partition-size 2 python3 run_suite.py --suite per-commit-2-gpu --auto-partition-id ${{ matrix.part }} --auto-partition-size 2
unit-test-backend-4-gpu: unit-test-backend-4-gpu:
needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 4-gpu-runner runs-on: 4-gpu-runner
strategy: strategy:
fail-fast: false fail-fast: false
...@@ -328,7 +262,7 @@ jobs: ...@@ -328,7 +262,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -337,7 +271,7 @@ jobs: ...@@ -337,7 +271,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
- name: Run test - name: Run test
timeout-minutes: 20 timeout-minutes: 20
...@@ -346,11 +280,9 @@ jobs: ...@@ -346,11 +280,9 @@ jobs:
python3 run_suite.py --suite per-commit-4-gpu --auto-partition-id ${{ matrix.part }} --auto-partition-size 2 python3 run_suite.py --suite per-commit-4-gpu --auto-partition-id ${{ matrix.part }} --auto-partition-size 2
unit-test-backend-8-gpu: unit-test-backend-8-gpu:
needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 8-gpu-runner runs-on: 8-gpu-runner
strategy: strategy:
fail-fast: false fail-fast: false
...@@ -361,7 +293,7 @@ jobs: ...@@ -361,7 +293,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -370,7 +302,7 @@ jobs: ...@@ -370,7 +302,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
- name: Run test - name: Run test
timeout-minutes: 20 timeout-minutes: 20
...@@ -379,18 +311,16 @@ jobs: ...@@ -379,18 +311,16 @@ jobs:
python3 run_suite.py --suite per-commit-8-gpu --auto-partition-id ${{ matrix.part }} --auto-partition-size 2 python3 run_suite.py --suite per-commit-8-gpu --auto-partition-id ${{ matrix.part }} --auto-partition-size 2
performance-test-1-gpu-part-1: performance-test-1-gpu-part-1:
needs: [check-changes, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 1-gpu-runner runs-on: 1-gpu-runner
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -399,7 +329,7 @@ jobs: ...@@ -399,7 +329,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
- name: Benchmark single latency - name: Benchmark single latency
timeout-minutes: 10 timeout-minutes: 10
...@@ -440,18 +370,16 @@ jobs: ...@@ -440,18 +370,16 @@ jobs:
python3 -m unittest test_bench_serving.TestBenchServing.test_lora_online_latency_with_concurrent_adapter_updates python3 -m unittest test_bench_serving.TestBenchServing.test_lora_online_latency_with_concurrent_adapter_updates
performance-test-1-gpu-part-2: performance-test-1-gpu-part-2:
needs: [check-changes, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 1-gpu-runner runs-on: 1-gpu-runner
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -460,7 +388,7 @@ jobs: ...@@ -460,7 +388,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
- name: Benchmark offline throughput (w/o RadixAttention) - name: Benchmark offline throughput (w/o RadixAttention)
timeout-minutes: 10 timeout-minutes: 10
...@@ -493,18 +421,16 @@ jobs: ...@@ -493,18 +421,16 @@ jobs:
python3 -m unittest test_bench_serving.TestBenchServing.test_vlm_online_latency python3 -m unittest test_bench_serving.TestBenchServing.test_vlm_online_latency
performance-test-2-gpu: performance-test-2-gpu:
needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 2-gpu-runner runs-on: 2-gpu-runner
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -513,7 +439,7 @@ jobs: ...@@ -513,7 +439,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
- name: Benchmark single latency (TP=2) - name: Benchmark single latency (TP=2)
timeout-minutes: 10 timeout-minutes: 10
...@@ -552,18 +478,16 @@ jobs: ...@@ -552,18 +478,16 @@ jobs:
python3 -m unittest test_bench_serving.TestBenchServing.test_pp_long_context_prefill python3 -m unittest test_bench_serving.TestBenchServing.test_pp_long_context_prefill
accuracy-test-1-gpu: accuracy-test-1-gpu:
needs: [check-changes, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 1-gpu-runner runs-on: 1-gpu-runner
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -572,7 +496,7 @@ jobs: ...@@ -572,7 +496,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
git clone https://github.com/merrymercy/human-eval.git git clone https://github.com/merrymercy/human-eval.git
cd human-eval cd human-eval
pip install -e . pip install -e .
...@@ -584,18 +508,16 @@ jobs: ...@@ -584,18 +508,16 @@ jobs:
python3 test_eval_accuracy_large.py python3 test_eval_accuracy_large.py
accuracy-test-2-gpu: accuracy-test-2-gpu:
needs: [check-changes, accuracy-test-1-gpu, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, accuracy-test-1-gpu, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 2-gpu-runner runs-on: 2-gpu-runner
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -604,7 +526,7 @@ jobs: ...@@ -604,7 +526,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_dependency.sh
git clone https://github.com/merrymercy/human-eval.git git clone https://github.com/merrymercy/human-eval.git
cd human-eval cd human-eval
pip install -e . pip install -e .
...@@ -616,18 +538,16 @@ jobs: ...@@ -616,18 +538,16 @@ jobs:
python3 test_moe_eval_accuracy_large.py python3 test_moe_eval_accuracy_large.py
unit-test-deepep-4-gpu: unit-test-deepep-4-gpu:
needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 4-gpu-runner runs-on: 4-gpu-runner
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -636,7 +556,7 @@ jobs: ...@@ -636,7 +556,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_deepep.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_deepep.sh
- name: Run test - name: Run test
timeout-minutes: 20 timeout-minutes: 20
...@@ -645,18 +565,16 @@ jobs: ...@@ -645,18 +565,16 @@ jobs:
python3 run_suite.py --suite per-commit-4-gpu-deepep python3 run_suite.py --suite per-commit-4-gpu-deepep
unit-test-deepep-8-gpu: unit-test-deepep-8-gpu:
needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: 8-gpu-runner runs-on: 8-gpu-runner
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -665,7 +583,7 @@ jobs: ...@@ -665,7 +583,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} bash scripts/ci/ci_install_deepep.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} bash scripts/ci/ci_install_deepep.sh
- name: Run test - name: Run test
timeout-minutes: 20 timeout-minutes: 20
...@@ -674,11 +592,9 @@ jobs: ...@@ -674,11 +592,9 @@ jobs:
python3 run_suite.py --suite per-commit-8-gpu-deepep python3 run_suite.py --suite per-commit-8-gpu-deepep
unit-test-backend-8-gpu-b200: unit-test-backend-8-gpu-b200:
needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-check-changes, sgl-kernel-finish] needs: [check-changes, unit-test-backend-2-gpu, sgl-kernel-build-wheels]
if: always() && !failure() && !cancelled() && if: always() && !failure() && !cancelled() &&
(github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && needs.check-changes.outputs.main_package == 'true'
github.event.pull_request.draft == false &&
needs.check-changes.outputs.src == 'true'
runs-on: b200-runner runs-on: b200-runner
strategy: strategy:
fail-fast: false fail-fast: false
...@@ -687,7 +603,7 @@ jobs: ...@@ -687,7 +603,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
if: needs.sgl-kernel-check-changes.outputs.src == 'true' if: needs.check-changes.outputs.sgl_kernel == 'true'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: sgl-kernel/dist/ path: sgl-kernel/dist/
...@@ -696,7 +612,7 @@ jobs: ...@@ -696,7 +612,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
CUSTOM_BUILD_SGL_KERNEL=${{needs.sgl-kernel-check-changes.outputs.src}} IS_BLACKWELL=1 bash scripts/ci/ci_install_dependency.sh CUSTOM_BUILD_SGL_KERNEL=${{needs.check-changes.outputs.sgl_kernel}} IS_BLACKWELL=1 bash scripts/ci/ci_install_dependency.sh
- name: Run test - name: Run test
timeout-minutes: 60 timeout-minutes: 60
...@@ -704,10 +620,13 @@ jobs: ...@@ -704,10 +620,13 @@ jobs:
cd test/srt cd test/srt
python3 run_suite.py --suite per-commit-8-gpu-b200 --auto-partition-id 0 --auto-partition-size 1 python3 run_suite.py --suite per-commit-8-gpu-b200 --auto-partition-id 0 --auto-partition-size 1
pr-test-finish: pr-test-finish:
needs: [ needs: [
check-changes, check-changes,
sgl-kernel-build-wheels,
sgl-kernel-unit-test, sgl-kernel-mla-test,
unit-test-frontend, unit-test-backend-1-gpu, unit-test-frontend, unit-test-backend-1-gpu,
unit-test-backend-2-gpu, unit-test-backend-4-gpu, unit-test-backend-8-gpu, unit-test-backend-2-gpu, unit-test-backend-4-gpu, unit-test-backend-8-gpu,
performance-test-1-gpu-part-1, performance-test-1-gpu-part-2, performance-test-2-gpu, performance-test-1-gpu-part-1, performance-test-1-gpu-part-2, performance-test-2-gpu,
...@@ -720,12 +639,26 @@ jobs: ...@@ -720,12 +639,26 @@ jobs:
steps: steps:
- name: Check all dependent job statuses - name: Check all dependent job statuses
run: | run: |
results=(${{ join(needs.*.result, ' ') }}) # Convert the 'needs' context to a JSON string
for result in "${results[@]}"; do json_needs='${{ toJson(needs) }}'
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
echo "Job failed with result: $result" # Get a list of all job names from the JSON keys
job_names=$(echo "$json_needs" | jq -r 'keys_unsorted[]')
for job in $job_names; do
# For each job, extract its result
result=$(echo "$json_needs" | jq -r --arg j "$job" '.[$j].result')
# Print the job name and its result
echo "$job: $result"
# Check for failure or cancellation and exit if found
if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
echo "The above jobs failed."
exit 1 exit 1
fi fi
done done
# If the loop completes, all jobs were successful
echo "All jobs completed successfully" echo "All jobs completed successfully"
exit 0 exit 0
...@@ -7,12 +7,16 @@ on: ...@@ -7,12 +7,16 @@ on:
- "python/**" - "python/**"
- "scripts/ci/**" - "scripts/ci/**"
- "test/**" - "test/**"
- ".github/workflows/vllm-dependency-test.yml"
pull_request: pull_request:
branches: [ main ] branches: [ main ]
paths: paths:
- "python/**" - "python/**"
- "scripts/ci/**" - "scripts/ci/**"
- "test/**" - "test/**"
- ".github/workflows/vllm-dependency-test.yml"
types: [synchronize, labeled]
workflow_dispatch:
concurrency: concurrency:
group: vllm-dependency-test-${{ github.ref }} group: vllm-dependency-test-${{ github.ref }}
...@@ -20,8 +24,7 @@ concurrency: ...@@ -20,8 +24,7 @@ concurrency:
jobs: jobs:
vllm-dependency-test: vllm-dependency-test:
if: (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request') && if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci')
github.event.pull_request.draft == false
runs-on: 1-gpu-runner runs-on: 1-gpu-runner
steps: steps:
- name: Checkout code - name: Checkout code
...@@ -32,12 +35,8 @@ jobs: ...@@ -32,12 +35,8 @@ jobs:
bash scripts/ci/ci_install_dependency.sh bash scripts/ci/ci_install_dependency.sh
pip install "bitsandbytes>=0.44.0" pip install "bitsandbytes>=0.44.0"
pip install "sgl-kernel==0.3.9.post2"
- name: Run vLLM dependency tests - name: Run vLLM dependency tests
timeout-minutes: 60 timeout-minutes: 30
run: | run: |
export SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK=1
cd test/srt cd test/srt
python3 run_suite.py --suite vllm_dependency_test --timeout-per-file 3600 python3 run_suite.py --suite vllm_dependency_test --timeout-per-file 600
...@@ -68,6 +68,13 @@ You can identify potential reviewers for your code by checking the [code owners] ...@@ -68,6 +68,13 @@ You can identify potential reviewers for your code by checking the [code owners]
Another effective strategy is to review the file modification history and contact individuals who have frequently edited the files. Another effective strategy is to review the file modification history and contact individuals who have frequently edited the files.
If you modify files protected by code owners, their approval is required to merge the code. If you modify files protected by code owners, their approval is required to merge the code.
## How to trigger CI
To trigger CI, the pull request must have the "run-ci" label.
- If you have write access to sgl-project/sglang, your pull request will be automatically tagged by @sglang-bot.
- If you have triage access to sgl-project/sglang, you can manually add the label by clicking "Labels" on the right side of your pull request page.
- If you do not have the above access, please request a review and ask other maintainers to add the label for you.
## General code style ## General code style
- Avoid code duplication. If the same code snippet (more than five lines) appears multiple times, extract it into a shared function. - Avoid code duplication. If the same code snippet (more than five lines) appears multiple times, extract it into a shared function.
- Minimize device synchronization. Reduce expensive CPU-GPU synchronization operations, such as `tensor.item()` or `tensor.cpu()`, whenever possible. Use vectorized code. - Minimize device synchronization. Reduce expensive CPU-GPU synchronization operations, such as `tensor.item()` or `tensor.cpu()`, whenever possible. Use vectorized code.
......
# Code Structures # Code Structure
- `eval`: The evaluation utilities. - `eval`: The evaluation utilities.
- `lang`: The frontend language. - `lang`: The frontend language.
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
- `bench_serving.py`: Benchmark online serving with dynamic requests. - `bench_serving.py`: Benchmark online serving with dynamic requests.
- `check_env.py`: Check the environment variables and dependencies. - `check_env.py`: Check the environment variables and dependencies.
- `global_config.py`: The global configs and constants. - `global_config.py`: The global configs and constants.
- `launch_server.py`: The entry point for launching the local server. - `launch_server.py`: The entry point for launching a local server.
- `utils.py`: Common utilities. - `utils.py`: Common utilities.
- `version.py`: Version info. - `version.py`: Version info.
...@@ -5,16 +5,15 @@ ...@@ -5,16 +5,15 @@
[![PyPI](https://img.shields.io/pypi/v/sgl-kernel)](https://pypi.org/project/sgl-kernel) [![PyPI](https://img.shields.io/pypi/v/sgl-kernel)](https://pypi.org/project/sgl-kernel)
## Installation ## Installation
For CUDA 12.1 and above:
```bash ```bash
pip3 install sgl-kernel pip3 install sgl-kernel
``` ```
For CUDA 11.8: For CUDA 12.4:
```bash ```bash
pip3 install sgl-kernel -i https://docs.sglang.ai/whl/cu118 pip3 install sgl-kernel -i https://docs.sglang.ai/whl/cu124
``` ```
## Build from source ## Build from source
......
...@@ -146,7 +146,6 @@ suites = { ...@@ -146,7 +146,6 @@ suites = {
TestFile("test_full_deepseek_v3.py", 333), TestFile("test_full_deepseek_v3.py", 333),
], ],
"per-commit-8-gpu-b200": [ "per-commit-8-gpu-b200": [
# add more here
TestFile("test_gpt_oss_4gpu.py", 600), TestFile("test_gpt_oss_4gpu.py", 600),
TestFile("test_deepseek_v3_fp4_4gpu.py", 600), TestFile("test_deepseek_v3_fp4_4gpu.py", 600),
], ],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment