GitHub Action to check for formatting errors.

This commit is contained in:
Mario Zechner 2021-08-18 18:55:33 +02:00
parent f13ad0d983
commit ce036f446c
3 changed files with 61 additions and 68 deletions

60
.github/workflows/format-check.yml vendored Normal file
View File

@ -0,0 +1,60 @@
name: Check format
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install OS dependencies (needed for act on ubuntu-latest)
run: |
apt update
apt install -y --force-yes curl xz-utils libicu-dev git
- name: Cache Clang
id: cache-clang
uses: actions/cache@v2
with:
path: clang
key: ${{ runner.os }}-clang
- name: Install Clang
if: steps.cache-clang.outputs.cache-hit != 'true'
run: |
curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/clang+llvm-12.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz --output clang.tar.xz
tar -xf clang.tar.xz
mv clang+llvm-12.0.1-x86_64-linux-gnu-ubuntu- clang
- name: Install dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
include-prerelease: true
- run: dotnet tool install -g dotnet-format
- uses: actions/checkout@v1
- name: Install Node and dependenceis
uses: actions/setup-node@v1
with:
node-version: "16"
- run: npm install -g typescript typescript-formatter
- name: Install JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: "16"
- name: Format
run: |
export PATH=$PATH:`pwd`/clang/bin/
export PATH="$PATH:/root/.dotnet/tools"
./formatters/format.sh
- name: Fail on format changes
run: |
git status --porcelain
if [[ `git status --porcelain` ]]; then echo "detected format changes!" & exit 1; fi

View File

@ -26,7 +26,7 @@ spotless {
'spine-sfml/**/*.h',
'spine-ue4/**/*.cpp',
'spine-ue4/**/*.h'
clangFormat('12.0.1').style('file')
clangFormat("12.0.1").style('file')
}
typescript {

View File

@ -1,67 +0,0 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 8
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SortIncludes: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: ForContinuationAndIndentation