Skip to content

feat: add MUSA CICD supports. #32

feat: add MUSA CICD supports.

feat: add MUSA CICD supports. #32

# 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'