Add support for differentiation of immediate functions #1812
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: clang-format | |
on: | |
pull_request: | |
paths: | |
- '**.h' | |
- '**.cpp' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
jobs: | |
precheckin: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout PR branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install clang-format | |
run: | | |
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`" | |
echo "deb https://apt.llvm.org/${os_codename}/ llvm-toolchain-${os_codename}-18 main" | sudo tee -a /etc/apt/sources.list | |
sudo apt update | |
sudo apt install -y clang-format-18 | |
- name: Download git-clang-format | |
run: | | |
wget https://raw.githubusercontent.com/llvm/llvm-project/main/clang/tools/clang-format/git-clang-format | |
chmod +x git-clang-format | |
- name: Run git-clang-format | |
run: | | |
PR_BASE=$(git rev-list ${{ github.event.pull_request.head.sha }} ^${{ github.event.pull_request.base.sha }} | tail --lines 1 | xargs -I {} git rev-parse {}~1) | |
echo "running git clang-format against $PR_BASE commit" | |
git \ | |
-c color.ui=always \ | |
-c diff.wsErrorHighlight=all \ | |
-c color.diff.whitespace='red reverse' \ | |
clang-format-18 --diff --binary clang-format-18 --commit $PR_BASE || \ | |
(echo "Please run the following git-clang-format locally to fix the formatting: \n | |
git-clang-format HEAD~\n | |
for multiple commits we should place the formatting changes in the related commit with:\n | |
\t\tgit rebase -i -x \"git-clang-format-18 master && git commit -a --allow-empty --fixup=HEAD\" --strategy-option=theirs origin/master\n | |
\t\t Then inspect the results with: git log --oneline\n | |
\t\t Then squash without poluting the history with: git rebase --autosquash -i master\n" && exit 1) |