Skip to content

debug ucc tests - do not merge #5190

debug ucc tests - do not merge

debug ucc tests - do not merge #5190

Workflow file for this run

name: Codestyle
on: [pull_request]
# Cancel in-progress runs for the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GIT_CF: https://raw.githubusercontent.com/llvm/llvm-project/release/21.x/clang/tools/clang-format/git-clang-format
LLVM_VERSION: 21
jobs:
check-codestyle:
runs-on: ubuntu-22.04
name: Check code style
defaults:
run:
shell: bash
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends wget lsb-release software-properties-common gnupg
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm.asc
sudo add-apt-repository -y "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_VERSION} main"
sudo apt-get update
sudo apt-get install -y --no-install-recommends clang-format-${LLVM_VERSION}
# Install git-clang-format (no version suffix)
curl -fsSL $GIT_CF -o git-clang-format
chmod +x ./git-clang-format
sudo mv ./git-clang-format /usr/bin/git-clang-format
- name: Checking out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Check commit title
run: |
set -eE
range="remotes/origin/$GITHUB_BASE_REF..HEAD"
check_title() {
msg=$1
if [ ${#msg} -gt 50 ]
then
if ! echo $msg | grep -qP '^Merge'
then
echo "Commit title is too long: ${#msg}"
return 1
fi
fi
H1="CODESTYLE|REVIEW|CORE|UTIL|TEST|API|DOCS|TOOLS|BUILD|MC|EC|SCHEDULE|TOPO"
H2="CI|CL/|TL/|MC/|EC/|UCP|SHM|NCCL|SHARP|BASIC|HIER|DOCA_UROM|CUDA|CPU|EE|RCCL|ROCM|SELF|MLX5"
if ! echo $msg | grep -qP '^Merge |^'"(($H1)|($H2))"'+: \w'
then
echo "Wrong header"
return 1
fi
if [ "${msg: -1}" = "." ]
then
echo "Dot at the end of title"
return 1
fi
return 0
}
ok=1
for sha1 in `git log $range --format="%h"`
do
title=`git log -1 --format="%s" $sha1`
if check_title "$title"
then
echo "Good commit title: '$title'"
else
echo "Bad commit title: '$title'"
ok=0
fi
echo "--------------------------------------------------"
done
if [ $ok -ne 1 ]
then
exit 1
fi
- name: Check code format
run: |
set -eEuo pipefail
echo "Commit ${{ github.event.pull_request.base.sha }}"
diff=`git-clang-format --binary=clang-format-${LLVM_VERSION} --style=file --diff ${{ github.event.pull_request.base.sha }}` || true
if [ "$diff" = "no modified files to format" ] || [ "$diff" = "clang-format did not modify any files" ]
then
echo "Format check PASS"
else
echo "Format check FAILED"
echo ""
echo "Please format your code using:"
echo " git-clang-format --binary=clang-format-${LLVM_VERSION} ${{ github.event.pull_request.base.sha }}"
echo ""
echo "Formatting differences:"
echo "$diff"
fi