Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
131 changes: 131 additions & 0 deletions .github/workflows/build_x86_64_musa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Copyright 2026 The xLLM Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: xLLM Build x86_64 MUSA

on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request:
branches: [main]
paths-ignore:
- 'docs/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request_review:
types: [submitted]

permissions:
contents: read

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

jobs:
check-sensitive:
runs-on: [xllm-cpu-only-cicd]
outputs:
do_build: ${{ steps.decide.outputs.do_build }}
steps:
- name: Checkout code
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_review'
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Check if sensitive files were changed
id: check_sensitive
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_review'
run: |
requires_approval=false
while IFS= read -r changed_file; do
case "${changed_file}" in
.github/**|cibuild/**|setup.py|examples/generate.py)
requires_approval=true
break
;;
esac
done < <(
git diff --name-only \
"${{ github.event.pull_request.base.sha }}" \
"${{ github.event.pull_request.head.sha }}"
)
echo "requires_approval=${requires_approval}" >> "${GITHUB_OUTPUT}"

- name: Decide whether to build
id: decide
run: |
event="${{ github.event_name }}"
requires_approval="${{ steps.check_sensitive.outputs.requires_approval }}"
do_build=false
if [[ "${event}" == "workflow_dispatch" || "${event}" == "push" ]]; then
do_build=true
elif [[ "${event}" == "pull_request" &&
"${requires_approval}" != "true" ]]; then
do_build=true
elif [[ "${event}" == "pull_request_review" ]]; then
association="${{ github.event.review.author_association }}"
review_state="${{ github.event.review.state }}"
review_commit="${{ github.event.review.commit_id }}"
head_sha="${{ github.event.pull_request.head.sha }}"
if [[ "${requires_approval}" == "true" &&
"${review_state}" == "approved" &&
"${review_commit}" == "${head_sha}" &&
("${association}" == "OWNER" ||
"${association}" == "MEMBER" ||
"${association}" == "COLLABORATOR") ]]; then
do_build=true
fi
fi
echo "do_build=${do_build}" >> "${GITHUB_OUTPUT}"

build:
needs: check-sensitive
if: needs.check-sensitive.outputs.do_build == 'true'
runs-on: [xllm-musa-x86-cicd]
timeout-minutes: 120
steps:
- name: Prepare vcpkg cache
run: mkdir -p /export/home/musa_vcpkg_cache/archives /export/home/musa_vcpkg_cache/downloads

- name: Prepare submodule checkout
run: |
if [ -d .git/modules ]; then
find .git/modules -type f -name '*.lock' -print -delete || true
fi

- name: Checkout code
uses: actions/checkout@v4
timeout-minutes: 10
with:
persist-credentials: false
submodules: recursive

- name: Clean submodules
run: git submodule foreach --recursive git clean -ffdx

- name: Build Python package
run: bash ./cibuild/build_musa.sh 'python setup.py build --device musa'
37 changes: 37 additions & 0 deletions cibuild/build_musa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# Copyright 2026 The xLLM Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

IMAGE="registry.mthreads.com/presale/devtech/xllm:musa-cicd-20260820"
COMMAND="unset VCPKG_ROOT VCPKG_BINARY_SOURCES DEPENDENCES_ROOT FETCHCONTENT_SOURCE_DIR_VCPKG CMAKE_TOOLCHAIN_FILE
export VCPKG_DEFAULT_BINARY_CACHE=/root/.cache/vcpkg/archives
export VCPKG_DOWNLOADS=/root/.cache/vcpkg/downloads
$*"

docker run \
--rm \
--runtime=mthreads \
--network=host \
--env "GITHUB_WORKSPACE=${PWD}" \
--env MAX_JOBS=16 \
--env "CMAKE_ARGS=-DCMAKE_CUDA_COMPILER=/usr/local/musa/tools/musamapping/mcc_wrapper -DCMAKE_MODULE_PATH=/usr/local/musa/tools/musamapping/cmake/Modules" \
--env "XLLM_HOST_GID=$(id -g)" \
--env "XLLM_HOST_UID=$(id -u)" \
--volume "${PWD}:${PWD}" \
--volume /export/home/musa_vcpkg_cache:/root/.cache/vcpkg \
--workdir "${PWD}" \
--entrypoint /usr/local/bin/run-xllm-musa-ci \
"${IMAGE}" run "${COMMAND}"
4 changes: 4 additions & 0 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ add_subdirectory(sentencepiece)
add_subdirectory(minja)
add_subdirectory(brpc)
add_subdirectory(smhasher/src)
if(USE_MUSA AND TARGET SMHasherSupport)
# SMHasher uses the deprecated register storage class in SpeedTest.cpp.
target_compile_options(SMHasherSupport PRIVATE -Wno-register)
endif()
add_subdirectory(cpprestsdk)
if(USE_MUSA AND TARGET cpprest)
# mcc_wrapper diagnoses signed conversions in cpprestsdk headers more
Expand Down
Loading