-
Notifications
You must be signed in to change notification settings - Fork 141
46 lines (43 loc) · 1.25 KB
/
formatting-check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Formatting check
on:
pull_request:
types:
- "opened"
- "reopened"
- "synchronize"
- "labeled"
- "unlabeled"
jobs:
cpp_formatting_check:
name: C++ Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: clang-format style check
run: |
git clang-format-14 --diff -q origin/main | tee format_diff.txt
if [ -s format_diff.txt ]; then exit 1; fi
python_formatting_check:
# There might be differences how the formatter refactors the code locally
# and in the CI. If there is a problem with CI formatter mismatch, consider
# wrapping a troublesome python code with comments:
# "# fmt: off"
# "<Python code we don't want to format>"
# "# fmt: on"
name: Python Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: black style check
run: |
pip3 install git+https://github.com/psf/black
black .
git diff -q | tee format_diff.txt
if [ -s format_diff.txt ]; then exit 1; fi