mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-10 00:58:43 +08:00
77 lines
1.8 KiB
YAML
77 lines
1.8 KiB
YAML
name: Formatting
|
|
|
|
on:
|
|
push:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup clang-format Docker alias
|
|
run: |
|
|
# Create a wrapper script for clang-format that uses Docker
|
|
cat << 'SCRIPT' | sudo tee /usr/local/bin/clang-format
|
|
#!/bin/bash
|
|
# Use Docker to run clang-format 18.1.8
|
|
docker run --rm -i -v "$PWD":"$PWD" -w "$PWD" silkeh/clang:18 clang-format "$@"
|
|
SCRIPT
|
|
sudo chmod +x /usr/local/bin/clang-format
|
|
# Verify version
|
|
clang-format --version
|
|
|
|
- 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.8.1'
|
|
|
|
- name: Check dart format version
|
|
run: |
|
|
dart format --version
|
|
|
|
- name: Format
|
|
run: |
|
|
./formatters/format-cpp.sh
|
|
./formatters/format-csharp.sh
|
|
./formatters/format-dart.sh
|
|
./formatters/format-haxe.sh
|
|
./formatters/format-java.sh
|
|
./formatters/format-ts.sh
|
|
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 |