-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (44 loc) · 1.41 KB
/
code-formatting-check.yml
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
47
48
49
50
51
52
53
name: Code Formatting Check
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
check-formatting:
runs-on: ubuntu-latest
env:
CLANG_FORMAT_VERSION: 14.0.0
steps:
- name: Set environment variables
run: |
echo "CLANG_FORMAT_INSTALL_PATH=${{ runner.temp }}/clang-format" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
- name: Download ClangFormat
id: download
uses: MrOctopus/[email protected]
with:
repository: arduino/clang-static-binaries
tag: ${{ env.CLANG_FORMAT_VERSION }}
asset: clang-format_${{ env.CLANG_FORMAT_VERSION }}_Linux_64bit.tar.bz2
target: ${{ env.CLANG_FORMAT_INSTALL_PATH }}
- name: Install ClangFormat
run: |
cd "${{ env.CLANG_FORMAT_INSTALL_PATH }}"
tar --extract --file="${{ steps.download.outputs.name }}"
echo "${{ env.CLANG_FORMAT_INSTALL_PATH }}/clang_Linux_64bit" >> "$GITHUB_PATH"
- name: Format examples
run: |
chmod +x ./formatter.sh
./formatter.sh
- name: Check formatting
run: |
if ! git diff --color --exit-code src/; then
echo "Please do an Auto Format on the sketches:"
echo "Arduino IDE: Tools > Auto Format"
echo "Arduino Web Editor: Ctrl + B"
exit 1
fi