Merge pull request #548 from evo-lua/wgpu-update-latest #1200
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Autoformat | |
on: | |
pull_request: | |
paths-ignore: | |
- "README.MD" | |
types: [opened, synchronize, reopened, ready_for_review] | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "README.MD" | |
- '.gitignore' | |
jobs: | |
check-format: | |
name: Enforce consistent formatting | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
# MSYS needs to be available before running any git commands | |
- name: Install clang-format (via MSYS) | |
if: runner.os == 'Windows' | |
uses: msys2/setup-msys2@v2 | |
with: | |
install: git mingw-w64-x86_64-clang | |
- name: Disable autocrlf # Messes up everything on Windows since the formatter applies \n | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Set up StyLua | |
uses: JohnnyMorganz/stylua-action@v3.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --check . --verbose | |
version: v0.20.0 | |
# The preinstalled version is positively antique; replace with the latest and greatest (to match MSYS) | |
- name: Install clang-format (via APT) | |
if: runner.os == 'Linux' | |
run: ./deps/install-clang-format.sh | |
- name: Install clang-format (via Homebrew) | |
if: runner.os == 'macOS' | |
run: brew install clang-format | |
- name: Run autoformat | |
run: ./autoformat.sh | |
- name: Check for inconsistent formatting | |
run: git --no-pager diff --exit-code -b . #The -b is for inconsistent newlines, which we ignore (for now) |