mirror of
https://github.com/Vita3K/Vita3K.git
synced 2026-07-11 01:34:23 +02:00
ci: use clang-format action for format checks
This commit is contained in:
@@ -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
|
||||
@@ -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
@@ -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 ..
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user