Ver Fonte

Merge branch 'formatting-gha' into 4.0

Mario Zechner há 4 anos atrás
pai
commit
2aced034d3
3 ficheiros alterados com 61 adições e 68 exclusões
  1. 60 0
      .github/workflows/format-check.yml
  2. 1 1
      formatters/build.gradle
  3. 0 67
      formatters/cpp.clang-format

+ 60 - 0
.github/workflows/format-check.yml

@@ -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

+ 1 - 1
formatters/build.gradle

@@ -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 {

+ 0 - 67
formatters/cpp.clang-format

@@ -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