Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions .github/workflows/build_x86_64_cuda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: xLLM Build x86_64 CUDA

on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- '.github/**'
- 'cibuild/**'
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
paths-ignore:
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request_review:
types: [submitted]
paths:
- '.github/**.yaml'
- 'cibuild/**.sh'
- 'setup.py'
- 'examples/generate.py'

env:
JOBNAME: xllm-x86_64-cuda-cibuild-${{ github.run_id }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
# need to review code first when sensitive files are modified.
check-sensitive:
runs-on: [self-hosted]
outputs:
requires_approval: ${{ steps.check_sensitive.outputs.requires_approval }}
do_build: ${{ steps.decide.outputs.do_build }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure we can compare commits

- name: Install jq
run: yum install -y jq

- name: Check if sensitive files were changed
id: check_sensitive
run: |
sensitive_files=(
".github/**.yaml"
"cibuild/**.sh"
"setup.py"
)
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
requires_approval="false"
while IFS= read -r changed_file; do
[[ -z "$changed_file" ]] && continue
for pattern in "${sensitive_files[@]}"; do
if [[ "$changed_file" == $pattern ]]; then
requires_approval="true"
break 2
fi
done
done < <(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}")
echo "requires_approval=$requires_approval" >> $GITHUB_OUTPUT
- name: Decide whether to check build
id: decide
run: |
event="${{ github.event_name }}"
if [[ "$event" == "workflow_dispatch" || "$event" == "push" ]]; then
echo "do_build=true" >> $GITHUB_OUTPUT
elif [[ "$event" == "pull_request" ]]; then
if [ "${{ steps.check_sensitive.outputs.requires_approval }}" == "true" ]; then
echo "do_build=false" >> $GITHUB_OUTPUT
else
echo "do_build=true" >> $GITHUB_OUTPUT
fi
elif [[ "$event" == "pull_request_review" ]]; then
# Since pull_request_review now only triggers when sensitive files are modified,
# we only need to check if the review is approved
if [[ "${{ github.event.review.state }}" == "approved" ]]; then
echo "do_build=true" >> $GITHUB_OUTPUT
else
echo "do_build=false" >> $GITHUB_OUTPUT
fi
else
echo "do_build=false" >> $GITHUB_OUTPUT
fi
build:
needs: check-sensitive
if: >
(github.event_name == 'workflow_dispatch' || github.event_name == 'push') ||
needs.check-sensitive.outputs.do_build == 'true'
runs-on: [self-hosted]
steps:
- name: Checkout Code
timeout-minutes: 5
uses: actions/checkout@v4
with:
submodules: true

- name: Build
if: ${{ success() }}
timeout-minutes: 60
run: |
chmod +x ./cibuild/build_cuda.sh
bash cibuild/build_cuda.sh 'pip install pre-commit -i https://pypi.tuna.tsinghua.edu.cn/simple; python setup.py build --device cuda'
2 changes: 1 addition & 1 deletion .github/workflows/build_x86_64_mlu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ jobs:
timeout-minutes: 60
run: |
chmod +x ./cibuild/build_mlu.sh
bash cibuild/build_mlu.sh 'pip install pre-commit -i https://pypi.tuna.tsinghua.edu.cn/simple; VCPKG_ROOT=/export/home/mlu_vcpkg_src python setup.py build --device mlu'
bash cibuild/build_mlu.sh 'pip install pre-commit -i https://pypi.tuna.tsinghua.edu.cn/simple; python setup.py build --device mlu'
29 changes: 29 additions & 0 deletions cibuild/build_cuda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -e

function error() {
echo "Require build command, e.g. python setup.py build --device cuda"
exit 1
}

IMAGE="quay.io/jd_xllm/xllm-ai:xllm-dev-cuda-x86"

RUN_OPTS=(
--rm
-t
--privileged
--ipc=host
--network=host
--pid=host
--shm-size '128gb'
-v /export/home:/export/home
-v /export/home/mlu_vcpkg_cache:/root/.cache/vcpkg # cuda and mlu vcpkg cache is same
-w /export/home
)

CMD="$*"
[[ -z "${CMD}" ]] && error

[[ ! -x $(command -v docker) ]] && echo "ERROR: 'docker' command is missing." && exit 1

docker run "${RUN_OPTS[@]}" "${IMAGE}" bash -c "set -euo pipefail; cd $(pwd); ${CMD}"
2 changes: 1 addition & 1 deletion cibuild/build_mlu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

function error() {
echo "Require build command, e.g. python setup.py build"
echo "Require build command, e.g. python setup.py build --device mlu"
exit 1
}

Expand Down
2 changes: 1 addition & 1 deletion cibuild/build_npu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

function error() {
echo "Require build command, e.g. python setup.py build"
echo "Require build command, e.g. python setup.py build --device a2"
exit 1
}

Expand Down
60 changes: 0 additions & 60 deletions cibuild/install/install_base.sh

This file was deleted.

16 changes: 0 additions & 16 deletions cibuild/install/install_ccache.sh

This file was deleted.

18 changes: 0 additions & 18 deletions cibuild/install/install_cmake.sh

This file was deleted.

32 changes: 0 additions & 32 deletions cibuild/install/install_gcc.sh

This file was deleted.

13 changes: 0 additions & 13 deletions cibuild/install/install_ninja.sh

This file was deleted.

38 changes: 0 additions & 38 deletions cibuild/install/install_python.sh

This file was deleted.

12 changes: 0 additions & 12 deletions cibuild/install/install_user.sh

This file was deleted.

Loading