clang-format: Show changes as diff in workflow

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2024-05-17 02:12:39 +09:00
parent 387cc2ecec
commit c8afe3412e
2 changed files with 5 additions and 2 deletions

View file

@ -27,7 +27,7 @@ jobs:
rm -f ~/.cargo/bin/cargo-fmt rm -f ~/.cargo/bin/cargo-fmt
rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade
- name: install clang-format-17 - name: install clang-format-18
run: | run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
@ -36,5 +36,8 @@ jobs:
- name: Run format-check - name: Run format-check
run: | run: |
make format CLANG_FORMAT=clang-format-18
git diff
git reset --hard
make format-check CLANG_FORMAT=clang-format-18 make format-check CLANG_FORMAT=clang-format-18
make rustfmt-check make rustfmt-check

View file

@ -176,7 +176,7 @@ clean:
format: format:
$(CLANG_FORMAT) -i src/*.c src/dcp/*.c src/math/*.c src/*.h src/dcp/*.h src/math/*.h sysinc/*.h $(CLANG_FORMAT) -i src/*.c src/dcp/*.c src/math/*.c src/*.h src/dcp/*.h src/math/*.h sysinc/*.h
format-check: format-check:
$(CLANG_FORMAT) --dry-run --Werror src/*.c src/*.h src/dcp/*.c src/dcp/*.h sysinc/*.h $(CLANG_FORMAT) --dry-run --Werror src/*.c src/dcp/*.c src/math/*.c src/*.h src/dcp/*.h src/math/*.h sysinc/*.h
rustfmt: rustfmt:
cd rust && cargo fmt cd rust && cargo fmt
rustfmt-check: rustfmt-check: