refactor workflows #205
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR - SGLang | |
| on: | |
| pull_request: | |
| branches: [main] | |
| types: [opened, reopened, synchronize] | |
| paths: | |
| - "**sglang**" | |
| - ".github/workflows/pr-sglang.yml" | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| env: | |
| # CI Image configuration | |
| CONTAINER_TYPE: "general" | |
| FRAMEWORK: "sglang" | |
| SGLANG_VERSION: "0.5.5" | |
| PYTHON_VERSION: "py312" | |
| CUDA_VERSION: "cu129" | |
| OS_VERSION: "ubuntu22.04" | |
| # Prod Image configuration | |
| PROD_SAGEMAKER_IMAGE: sglang:0.5-gpu-py312 | |
| # CI environment configuration | |
| FORCE_COLOR: "1" | |
| TEST_ARTIFACTS_DIRECTORY: "/test_artifacts/sglang" | |
| jobs: | |
| pr-validation: | |
| uses: ./.github/workflows/reusable-pr-validation.yml | |
| with: | |
| workflow-id: ${{ github.event.pull_request.number }} | |
| concurrency-group: "${{ github.workflow }}-pr-validation" | |
| concurrency-cancel-in-progress: true | |
| required-permission-level: "write" | |
| python-version: "3.12" | |
| run-pre-commit: true | |
| pre-commit-args: "--all-files" | |
| change-filters: | | |
| build-change: | |
| - "docker/sglang/**" | |
| - "scripts/sglang/**" | |
| - "scripts/common/**" | |
| - "scripts/telemetry/**" | |
| - ".github/workflows/pr-sglang*" | |
| test-change: | |
| - "test/sglang/**" | |
| setup-variables: | |
| runs-on: ubuntu-latest | |
| needs: [pr-validation] | |
| outputs: | |
| sglang-version: ${{ env.SGLANG_VERSION }} | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cuda-version: ${{ env.CUDA_VERSION }} | |
| os-version: ${{ env.OS_VERSION }} | |
| container-type: ${{ env.CONTAINER_TYPE }} | |
| framework: ${{ env.FRAMEWORK }} | |
| prod-sagemaker-image: ${{ env.PROD_SAGEMAKER_IMAGE }} | |
| test-artifacts-directory: ${{ env.TEST_ARTIFACTS_DIRECTORY }} | |
| steps: | |
| - name: Setup variables | |
| run: | | |
| echo "Setting up environment variables as job outputs" | |
| echo "SGLANG_VERSION=${{ env.SGLANG_VERSION }}" | |
| echo "PYTHON_VERSION=${{ env.PYTHON_VERSION }}" | |
| echo "CUDA_VERSION=${{ env.CUDA_VERSION }}" | |
| echo "OS_VERSION=${{ env.OS_VERSION }}" | |
| echo "CONTAINER_TYPE=${{ env.CONTAINER_TYPE }}" | |
| echo "FRAMEWORK=${{ env.FRAMEWORK }}" | |
| echo "PROD_SAGEMAKER_IMAGE=${{ env.PROD_SAGEMAKER_IMAGE }}" | |
| echo "TEST_ARTIFACTS_DIRECTORY=${{ env.TEST_ARTIFACTS_DIRECTORY }}" | |
| # ====================================================== | |
| # =============== SGLang SageMaker jobs ================ | |
| # ====================================================== | |
| build-sglang-image: | |
| needs: [pr-validation, setup-variables] | |
| if: needs.pr-validation.outputs.build-change == 'true' | |
| uses: ./.github/workflows/reusable-build-container-image.yml | |
| with: | |
| image-name: "ci" | |
| image-tag: "sglang-${{ needs.setup-variables.outputs.sglang-version }}-gpu-${{ needs.setup-variables.outputs.python-version }}-${{ needs.setup-variables.outputs.cuda-version }}-${{ needs.setup-variables.outputs.os-version }}-sagemaker-pr-${{ github.event.pull_request.number }}" | |
| dockerfile-path: "docker/sglang/Dockerfile" | |
| build-context: "." | |
| build-target: "sglang-sagemaker" | |
| base-image: "lmsysorg/sglang:v${{ needs.setup-variables.outputs.sglang-version }}-${{ needs.setup-variables.outputs.cuda-version }}-amd64" | |
| build-args: | | |
| { | |
| "CACHE_REFRESH": "${{ github.run_number }}", | |
| "BASE_IMAGE": "lmsysorg/sglang:v${{ needs.setup-variables.outputs.sglang-version }}-${{ needs.setup-variables.outputs.cuda-version }}-amd64", | |
| "CONTAINER_TYPE": "${{ needs.setup-variables.outputs.container-type }}", | |
| "FRAMEWORK": "${{ needs.setup-variables.outputs.framework }}", | |
| "FRAMEWORK_VERSION": "${{ needs.setup-variables.outputs.sglang-version }}" | |
| } | |
| workflow-id: ${{ github.event.pull_request.number }} | |
| runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:x86-build-runner", "buildspec-override:true"]' | |
| concurrency-group: "${{ github.workflow }}-build-sglang-image" | |
| concurrency-cancel-in-progress: true | |
| registry-type: "ecr" | |
| enable-cache: true | |
| cache-from: "registry" | |
| cache-to: "inline" | |
| push-image: true | |
| cleanup-image: true | |
| pre-build-script: ".github/scripts/buildkitd.sh" | |
| secrets: | |
| AWS_ACCOUNT_ID: ${{ vars.CI_AWS_ACCOUNT_ID }} | |
| AWS_REGION: ${{ vars.AWS_REGION }} | |
| set-test-environment: | |
| needs: [pr-validation, setup-variables, build-sglang-image] | |
| uses: ./.github/workflows/reusable-set-test-environment.yml | |
| with: | |
| environment-name: "sglang" | |
| build-job-result: ${{ needs.build-sglang-image.result }} | |
| ci-image-uri: ${{ needs.build-sglang-image.outputs.image-uri }} | |
| prod-image-name: ${{ needs.setup-variables.outputs.prod-sagemaker-image }} | |
| workflow-id: ${{ github.event.pull_request.number }} | |
| change-conditions: '["${{ needs.pr-validation.outputs.build-change }}", "${{ needs.pr-validation.outputs.test-change }}"]' | |
| concurrency-group: "${{ github.workflow }}-set-test-environment" | |
| concurrency-cancel-in-progress: true | |
| secrets: | |
| CI_AWS_ACCOUNT_ID: ${{ vars.CI_AWS_ACCOUNT_ID }} | |
| PROD_AWS_ACCOUNT_ID: ${{ vars.PROD_AWS_ACCOUNT_ID }} | |
| AWS_REGION: ${{ vars.AWS_REGION }} | |
| sglang-local-benchmark-test: | |
| needs: [setup-variables, set-test-environment, build-sglang-image] | |
| if: success() | |
| uses: ./.github/workflows/reusable-test-execution.yml | |
| with: | |
| test-name: "sglang-local-benchmark" | |
| test-category: "benchmark" | |
| execution-mode: "container" | |
| container-execution-style: "external" | |
| aws-account-id: ${{ needs.set-test-environment.outputs.aws-account-id }} | |
| image-uri: ${{ needs.set-test-environment.outputs.image-uri }} | |
| workflow-id: ${{ github.event.pull_request.number }} | |
| run-id: ${{ github.run_id }} | |
| run-attempt: ${{ github.run_attempt }} | |
| runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:x86-g6xl-runner", "buildspec-override:true"]' | |
| concurrency-group: "${{ github.workflow }}-sglang-local-benchmark-test" | |
| concurrency-cancel-in-progress: true | |
| container-gpus: "all" | |
| container-volumes: '["${HOME}/.cache/huggingface:/root/.cache/huggingface", "${{ needs.setup-variables.outputs.test-artifacts-directory }}/dataset:/dataset"]' | |
| container-ports: '["30000:30000"]' | |
| 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"]' | |
| container-environment-secrets: '["HF_TOKEN"]' | |
| pre-setup-commands: | | |
| mkdir -p ${{ needs.setup-variables.outputs.test-artifacts-directory }}/dataset | |
| if [ ! -f ${{ needs.setup-variables.outputs.test-artifacts-directory }}/dataset/ShareGPT_V3_unfiltered_cleaned_split.json ]; then | |
| echo "Downloading ShareGPT dataset..." | |
| 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 | |
| else | |
| echo "ShareGPT dataset already exists. Skipping download." | |
| fi | |
| container-startup-delay: 120 | |
| show-container-logs: true | |
| test-commands: | | |
| python3 -m sglang.bench_serving \ | |
| --backend sglang \ | |
| --host 127.0.0.1 --port 30000 \ | |
| --num-prompts 1000 \ | |
| --model Qwen/Qwen3-0.6B \ | |
| --dataset-name sharegpt \ | |
| --dataset-path /dataset/ShareGPT_V3_unfiltered_cleaned_split.json | |
| secrets: | |
| AWS_REGION: ${{ vars.AWS_REGION }} | |
| sglang-frontend-test: | |
| needs: [setup-variables, build-sglang-image, set-test-environment] | |
| if: success() | |
| uses: ./.github/workflows/reusable-test-execution.yml | |
| with: | |
| test-name: "sglang-frontend" | |
| test-category: "frontend" | |
| aws-account-id: ${{ needs.set-test-environment.outputs.aws-account-id }} | |
| image-uri: ${{ needs.set-test-environment.outputs.image-uri }} | |
| workflow-id: ${{ github.event.pull_request.number }} | |
| run-id: ${{ github.run_id }} | |
| run-attempt: ${{ github.run_attempt }} | |
| external-repo: "sgl-project/sglang" | |
| external-repo-ref: "v${{ needs.setup-variables.outputs.sglang-version }}" | |
| external-repo-path: "sglang_source" | |
| runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:x86-g6exl-runner", "buildspec-override:true"]' | |
| concurrency-group: "${{ github.workflow }}-sglang-frontend-test" | |
| concurrency-cancel-in-progress: true | |
| container-gpus: "all" | |
| container-entrypoint: "/bin/bash" | |
| container-volumes: '["${HOME}/.cache/huggingface:/root/.cache/huggingface", "./sglang_source:/workdir"]' | |
| container-environment: '[]' | |
| container-environment-secrets: '["HF_TOKEN"]' | |
| container-workdir: "/workdir" | |
| setup-commands: | | |
| bash scripts/ci/ci_install_dependency.sh | |
| test-commands: | | |
| nvidia-smi | |
| # Frontend Test | |
| cd /workdir/test/lang | |
| python3 run_suite.py --suite per-commit | |
| secrets: | |
| AWS_REGION: ${{ vars.AWS_REGION }} | |
| sglang-sagemaker-endpoint-test: | |
| needs: [set-test-environment] | |
| if: | | |
| always() && !failure() && !cancelled() && | |
| needs.set-test-environment.result == 'success' | |
| uses: ./.github/workflows/reusable-test-execution.yml | |
| with: | |
| test-name: "sglang-sagemaker-endpoint" | |
| test-category: "integration" | |
| execution-mode: "local" | |
| workflow-id: ${{ github.event.pull_request.number }} | |
| run-id: ${{ github.run_id }} | |
| run-attempt: ${{ github.run_attempt }} | |
| runs-on: '["codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}", "fleet:default-runner", "buildspec-override:true"]' | |
| concurrency-group: "${{ github.workflow }}-sglang-sagemaker-endpoint-test" | |
| concurrency-cancel-in-progress: false | |
| ecr-authenticate: false | |
| local-setup-commands: | | |
| uv venv | |
| source .venv/bin/activate | |
| uv pip install -r test/requirements.txt | |
| uv pip install -r test/sglang/sagemaker/requirements.txt | |
| local-test-commands: | | |
| source .venv/bin/activate | |
| cd test/ | |
| python3 -m pytest -vs -rA --image-uri ${{ needs.set-test-environment.outputs.image-uri }} sglang/sagemaker | |
| secrets: | |
| AWS_REGION: ${{ vars.AWS_REGION }} |