Skip to content

feat: support global kv cache management. #19

feat: support global kv cache management.

feat: support global kv cache management. #19

Workflow file for this run

name: CheckFormat
on:
workflow_dispatch:
push:
branches: [main]
paths: ['xllm_service/**']
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
paths: ['xllm_service/**']
jobs:
format-check:
runs-on: ubuntu-latest
steps:
- name: Install clang-format
run: |
pip install clang-format==20.1.6
clang-format --version
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine base commit for comparison
id: get_base_commit
run: |
# pull_request action
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "base_commit=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT
else
# push action
echo "base_commit=${{ github.sha }}~1" >> $GITHUB_OUTPUT
fi
- name: Verify clang-format configuration
run: |
if [ ! -f ".clang-format" ]; then
echo "❌ .clang-format file not found in repository root"
exit 1
fi
clang-format --style=file --dump-config > /dev/null || {
echo "❌ .clang-format file has invalid format"
exit 1
}
- name: Check code format
shell: /usr/bin/bash {0}
run: |
BASE_COMMIT="${{ steps.get_base_commit.outputs.base_commit }}"
CLANG_FORMAT_FILE="$(pwd)/.clang-format"
# do clang-format
diff=$(git-clang-format \
--style=file:"$CLANG_FORMAT_FILE" \
--extensions="c,h,cc,cp,cpp,c++,cxx,hh,hpp,hxx,inc,cu,cuh" \
--commit "$BASE_COMMIT" \
--diff)
# check diff
if [ "$diff" = "no modified files to format" ] || [ "$diff" = "clang-format did not modify any files" ]; then
echo "✅ Code format is correct"
exit 0
fi
printf "\n❌ You have introduced coding style breakages.\n"
printf "\n\033[1mSuggested changes:\n\n"
echo "$diff"
exit 1