ci: simplify clang-format

This commit is contained in:
orng 2026-03-28 22:50:45 -05:00
parent 3fc458c4bd
commit 3a736777fd

View file

@ -1,69 +1,23 @@
name: Clang Format
name: Clang-Format (Linux x86/64)
on:
push:
paths:
- '**.cpp'
- '**.h'
- '**.c'
- '**.cc'
- '**.cxx'
- '**.hh'
- '**.hpp'
- '**.hxx'
- '**.inl'
- '.clang-format'
- '.github/workflows/clang-format.yml'
- '.github/scripts/check-clang-format.sh'
pull_request:
paths:
- '**.cpp'
- '**.h'
- '**.c'
- '**.cc'
- '**.cxx'
- '**.hh'
- '**.hpp'
- '**.hxx'
- '**.inl'
- '.clang-format'
- '.github/workflows/clang-format.yml'
- '.github/scripts/check-clang-format.sh'
- "**.cpp"
- "**.h"
- "**.meson.build"
- ".github/workflows/*"
jobs:
clang-format:
runs-on: ubuntu-24.04
concurrency:
group: clang-format-${{ github.ref }}
cancel-in-progress: true
formatting-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format-19
- name: Check changed files
env:
CLANG_FORMAT_BIN: clang-format-19
EVENT_NAME: ${{ github.event_name }}
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
BEFORE_SHA: ${{ github.event.before }}
CURRENT_SHA: ${{ github.sha }}
run: |
set -euo pipefail
BASE_SHA=""
if [ "$EVENT_NAME" = "pull_request" ]; then
git fetch --no-tags origin "$PR_BASE_REF"
BASE_SHA="$(git merge-base "origin/$PR_BASE_REF" "$CURRENT_SHA")"
elif [ -n "$BEFORE_SHA" ] && [ "$BEFORE_SHA" != "0000000000000000000000000000000000000000" ]; then
BASE_SHA="$BEFORE_SHA"
fi
bash ./.github/scripts/check-clang-format.sh "$BASE_SHA" "$CURRENT_SHA"
- name: Run clang-format style check
uses: jidicula/clang-format-action@v4.18.0
with:
# keep this in line with the flake
clang-format-version: "21"