ci: use clang-format action for format checks

This commit is contained in:
KorewaWatchful
2026-05-20 21:13:20 -04:00
committed by Gamid
parent 53cbaa4c8b
commit 9def9989b7
17 changed files with 64 additions and 66 deletions
-14
View File
@@ -1,14 +0,0 @@
#!/bin/bash
set -ex
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
git fetch origin $GITHUB_BASE_REF:refs/remotes/origin/$GITHUB_BASE_REF
for f in $(git diff --diff-filter=AM --name-only origin/$GITHUB_BASE_REF 'vita3k/**.cpp' 'vita3k/**.h' 'tools/**.cpp' 'tools/**.h'); do
if [ "$(diff -u <(cat $f) <(clang-format $f))" != "" ]
then
echo "run format"
exit 1
fi
done
fi
+11 -1
View File
@@ -15,13 +15,23 @@ env:
jobs:
format-check:
name: Format Check (${{ matrix.path }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
path:
- vita3k
- tools
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Format check
run: .github/format-check.sh
uses: jidicula/clang-format-action@v4.18.0
with:
clang-format-version: '22'
check-path: ${{ matrix.path }}
build:
name: Build (${{ matrix.os }})
+3 -2
View File
@@ -1,6 +1,7 @@
@echo off
if "%CLANG_FORMAT_BIN%"=="" set "CLANG_FORMAT_BIN=clang-format"
cd vita3k
for /f %%f in ('dir *.cpp *.h /b/s') do clang-format -i %%f
for /f %%f in ('dir *.cpp *.h /b/s') do "%CLANG_FORMAT_BIN%" -i "%%f"
cd ..\tools
for /f %%f in ('dir *.cpp *.h /b/s') do clang-format -i %%f
for /f %%f in ('dir *.cpp *.h /b/s') do "%CLANG_FORMAT_BIN%" -i "%%f"
cd ..
+4 -2
View File
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -ex
set -euo pipefail
find vita3k tools/gen-modules tools/native-tool \( -name *.cpp -o -name *.h \) | xargs clang-format -i
CLANG_FORMAT_BIN="${CLANG_FORMAT_BIN:-clang-format}"
find vita3k tools/gen-modules tools/native-tool \( -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 "$CLANG_FORMAT_BIN" -i
+1 -2
View File
@@ -25,8 +25,7 @@
#elif defined(_MSC_VER)
#define DISABLE_WARNING_PUSH __pragma(warning(push))
#define DISABLE_WARNING_POP __pragma(warning(pop))
#define DISABLE_WARNING_NO_PUSH(warningNumber, warningName) __pragma(warning(disable \
: warningNumber))
#define DISABLE_WARNING_NO_PUSH(warningNumber, warningName) __pragma(warning(disable : warningNumber))
#else
#define DISABLE_WARNING_PUSH
#define DISABLE_WARNING_POP