-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (133 loc) · 4.61 KB
/
reviewdog.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: reviewdog
on:
pull_request:
jobs:
check-formatting:
runs-on: ubuntu-latest
env:
# See: https://github.com/arduino/arduino-ide/blob/main/arduino-ide-extension/package.json
CLANG_FORMAT_VERSION: 14.0.0
steps:
- name: Set environment variables
run: |
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
echo "CLANG_FORMAT_INSTALL_PATH=${{ runner.temp }}/clang-format" >> "$GITHUB_ENV"
echo "REVIEWDOG_INSTALL_PATH=${{ runner.temp }}/reviewdog" >> "$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 }}"
# Add installation to PATH:
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
echo "${{ env.CLANG_FORMAT_INSTALL_PATH }}/clang_Linux_64bit" >> "$GITHUB_PATH"
- name: Format examples
run: |
find \
\( \
-name '*.c' -or \
-name '*.cpp' -or \
-name '*.h' -or \
-name '*.ino' -or \
-name '*.ipp' -or \
-name '*.tpp' \
\) \
-type f \
-exec \
clang-format \
--assume-filename=foo.cpp \
-i \
--style=file \
{} \;
- name: Install Reviewdog
run: |
wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b ${{ env.REVIEWDOG_INSTALL_PATH }}
echo "${{ env.REVIEWDOG_INSTALL_PATH }}" >> "$GITHUB_PATH"
- name: Check formatting
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! git diff --color --exit-code; then
git diff | reviewdog -f=diff -name="format-check" -reporter=github-pr-review
echo "Please do an Auto Format on the sketches:"
echo "Arduino IDE: Tools > Auto Format"
echo "Arduino Web Editor: Ctrl + B"
exit 1
fi
cpplint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-cpplint@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
flags: --linelength=50 # Optional
filter: "-readability/braces\
,-whitespace/braces\
,-whitespace/comments\
,-whitespace/indent\
,-whitespace/newline\
,-whitespace/operators\
,-whitespace/parens\
" # Optional
build:
name: ${{ matrix.code.source }}
runs-on: ubuntu-latest
env:
UNIVERSAL_LIBRARIES: |
- ""
UNIVERSAL_SKETCH_PATHS: |
- ""
strategy:
fail-fast: false
matrix:
code:
- source: main
libraries: |
- name: Servo
sketch-paths: |
- Main
board:
vendor: rp2040
arch: rp2040
name: rpipico
- source: valve
libraries: |
- name: Servo
sketch-paths: |
- Valve
board:
vendor: rp2040
arch: rp2040
name: rpipico
include:
- code:
board:
vendor: rp2040
arch: rp2040
index: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compile examples
uses: arduino/compile-sketches@v1
with:
fqbn: ${{matrix.code.board.vendor}}:${{matrix.code.board.arch}}:${{matrix.code.board.name}}
platforms: |
- name: ${{matrix.code.board.vendor}}:${{matrix.code.board.arch}}
source-url: ${{matrix.index}}
libraries: |
${{ env.UNIVERSAL_LIBRARIES }}
${{ env.UNIVERSAL_SKETCH_PATHS }}
${{ matrix.code.libraries }}
${{ matrix.code.sketch-paths }}