name: Formatting on: push: workflow_dispatch: jobs: build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - name: Check pre-installed versions run: | echo "=== Pre-installed tool versions ===" echo "clang-format versions available:" apt list clang-format* 2>/dev/null | grep clang-format || true echo "" echo "Default clang-format:" which clang-format || echo "Not found" clang-format --version || echo "Not installed" echo "" echo "Dart:" which dart || echo "Not found" dart --version || echo "Not installed" # clang-format-18 is already pre-installed on Ubuntu 24.04 # No need to install it - name: Install dotnet uses: actions/setup-dotnet@v3 with: dotnet-version: "8.0.x" - name: Install Node and dependencies uses: actions/setup-node@v3 with: node-version: "24" # NOTE: typescript-formatter is installed by npm in spine-ts - name: Install JDK uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: "16" - name: Install Haxe uses: krdlab/setup-haxe@v1 with: haxe-version: '4.3.2' - run: haxelib install formatter - name: Install Dart uses: dart-lang/setup-dart@v1 with: sdk: '3.7.2' - name: Debug formatter versions run: | echo "=== Tool versions ===" echo "clang-format version:" clang-format --version echo "clang-format-18 version:" clang-format-18 --version echo "clang-format path:" which clang-format which clang-format-18 echo "" echo "dart version:" dart --version echo "dart format help:" dart format --help | grep -A2 -B2 "page-width" || true echo "" echo "Testing clang-format behavior:" echo 'class Test { Test() {}; };' | clang-format --style=file:formatters/.clang-format echo 'class Test { Test() {}; };' | clang-format-18 --style=file:formatters/.clang-format echo "" echo "Testing dart format behavior:" echo 'final x = SpineWidgetController(onInitialized: (c) {print("test");});' | dart format --page-width 120 - name: Format run: | echo "=== Running formatters ===" echo "Running format-cpp.sh..." ./formatters/format-cpp.sh echo "Running format-csharp.sh..." ./formatters/format-csharp.sh echo "Running format-dart.sh..." ./formatters/format-dart.sh echo "Running format-haxe.sh..." ./formatters/format-haxe.sh echo "Running format-java.sh..." ./formatters/format-java.sh echo "Running format-ts.sh..." ./formatters/format-ts.sh echo "=== Checking differences ===" git diff --stat git diff > format-diff.txt - name: Archive formatting result uses: actions/upload-artifact@v4 with: name: format-diff path: format-diff.txt - name: Fail on format changes run: | git ls-files -m if [[ `git ls-files -m` ]]; then echo "Detected formatting errors!" & exit 1; fi