2020-04-12 11:16:57 -04:00
|
|
|
on: [pull_request]
|
|
|
|
name: clang-format
|
|
|
|
jobs:
|
|
|
|
check-clang-format:
|
2022-06-12 19:51:03 -04:00
|
|
|
runs-on: ubuntu-22.04
|
2020-04-12 11:16:57 -04:00
|
|
|
steps:
|
2021-01-28 15:47:11 -05:00
|
|
|
- name: install clang-format
|
2022-06-12 19:51:03 -04:00
|
|
|
run: sudo apt install clang-format-14
|
2020-07-23 06:05:19 -04:00
|
|
|
- uses: actions/checkout@main
|
2020-04-12 11:16:57 -04:00
|
|
|
- name: fetch target ref
|
|
|
|
run:
|
|
|
|
|
|
|
|
|
refs=($(git log -1 --format=%s))
|
|
|
|
git fetch --depth=1 origin "${refs[3]}"
|
2020-04-28 09:34:47 -04:00
|
|
|
- name: configure clang-format
|
|
|
|
run:
|
|
|
|
|
|
2021-01-06 16:22:00 -05:00
|
|
|
git config clangformat.binary $PWD/utils/clang-format-xs/clang-format-xs
|
2020-04-28 09:34:47 -04:00
|
|
|
git config clangformat.extensions c,h,xs
|
2020-04-12 11:16:57 -04:00
|
|
|
- name: run git-clang-format and Check if no changes are needed
|
|
|
|
run:
|
|
|
|
|
|
2022-06-12 19:51:03 -04:00
|
|
|
CLANG_FORMAT=clang-format-14 git-clang-format-14 --diff FETCH_HEAD HEAD | tee git-clang-format.diff
|
2020-04-14 03:47:41 -04:00
|
|
|
cmp -s <(echo no modified files to format) git-clang-format.diff || cmp -s <(echo -n) git-clang-format.diff
|
2020-04-12 11:16:57 -04:00
|
|
|
- uses: actions/upload-artifact@v1
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: git-clang-format.diff
|
|
|
|
path: git-clang-format.diff
|