Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Format

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
clang-format:
Comment thread
project516-review-bot[bot] marked this conversation as resolved.

runs-on: ubuntu-latest
permissions:
contents: read
Comment thread
Project516 marked this conversation as resolved.

steps:
- uses: actions/checkout@v7

Comment thread
project516-review-bot[bot] marked this conversation as resolved.
Comment thread
project516-review-bot[bot] marked this conversation as resolved.
# Pinned so a new clang-format release cannot reformat the tree in CI.
- name: Install clang-format
Comment thread
project516-review-bot[bot] marked this conversation as resolved.
run: sudo apt-get install -y clang-format-18

- name: Check formatting
env:
CLANG_FORMAT: clang-format-18
run: ./format.sh --check
16 changes: 16 additions & 0 deletions format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
Comment thread
project516-review-bot[bot] marked this conversation as resolved.

# Formats the shader sources in place with clang-format.
# Pass --check to report problems without writing.
# Set CLANG_FORMAT to pick a version, e.g. CLANG_FORMAT=clang-format-18.

: "${CLANG_FORMAT:=clang-format}"

if [ "$1" = "--check" ]; then
shift
set -- --dry-run --Werror "$@"
else
set -- -i "$@"
fi

find shaders -type f \( -name '*.fsh' -o -name '*.vsh' -o -name '*.glsl' \) -exec "$CLANG_FORMAT" "$@" -- {} +
Loading