forked from mysensors/MySensors
-
Notifications
You must be signed in to change notification settings - Fork 0
298 lines (247 loc) · 10.2 KB
/
build.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
name: Build Arduino Project
on:
push:
branches:
- main
- master
- development
- dev_actions
pull_request:
branches:
- main
- master
- development
- dev_actions
# Allows you to run this workflow manually from the Actions tab for every branch
workflow_dispatch:
jobs:
get_commits:
runs-on: ubuntu-latest
outputs:
commits: ${{ steps.get_commits.outputs.commits }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get list of commits
id: get_commits
run: |
# Use `--no-merges` if you want to exclude merge commits
commits=$(git rev-list --reverse --format="format:%H" --no-merges ${{ github.event.before }}..${{ github.sha }} | grep -v "^commit ")
# Convert the list of hashes into a JSON array
commits_json=$(echo "$commits" | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "commits=$commits_json" >> $GITHUB_OUTPUT
#### ToDo: Check if the output is correct
echo "C"
echo "$commits_json"
echo "D"
commit-msg-tests:
runs-on: ubuntu-latest
strategy:
matrix:
commit: ${{ fromJson(needs.get_commits.outputs.commits || '[]') }}
needs: get_commits
steps:
#### ToDo: Check if the output is correct
- name: Debug commits output
run: |
echo "Commits: ${{ matrix.commit }}"
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ matrix.commit }}
- name: Set execute permissions for shell scripts
run: chmod +x ./.github/workflows/.ci_scripts/*.sh
- name: Check commit message format
run: ./.github/workflows/.ci_scripts/check-commit-message.sh
static-code-tests:
if: false # This will deactivate the job
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set execute permissions for shell scripts
run: chmod +x ./.github/workflows/.ci_scripts/*.sh
- name: Check missing keywords and keywords format
run: ./.github/workflows/.ci_scripts/check-missing-keywords.sh
- name: Install astyle
run: sudo apt-get install -y astyle
- name: Check wellformed code style with astyle app
id: check_astyle
run: ./.github/workflows/.ci_scripts/check-astyle-code.sh
continue-on-error: true
- name: Upload astyle restyling.patch file if exists
if: ${{ steps.check_astyle.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: restyling.patch
path: restyling.patch
- name: End job execution on astyle error
if: ${{ steps.check_astyle.outcome == 'failure' }}
run: |
# End job execution with error.
echo "::error::Code style is not wellformed. Find the Git restyling.patch in Artifacts section below."
exit 1
- name: Install cppcheck
run: sudo apt-get install -y cppcheck
- name: Run static code analysis with cppcheck
id: cppcheck_avr
run: ./.github/workflows/.ci_scripts/check-static-cpp-code.sh
continue-on-error: true
- name: Upload cppcheck reports artifact
if: ${{ steps.cppcheck_avr.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: cppcheck-avr.xml
path: cppcheck-avr.xml
- name: Upload cppcheck reports folder
if: ${{ steps.cppcheck_avr.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: cppcheck_reports_folder
path: cppcheck-avr_cppcheck_reports/
- name: End job execution on cppcheck error
if: ${{ steps.cppcheck_avr.outcome == 'failure' }}
run: |
# End job execution with error.
echo "::error::C++ Code with errors detected. See detailed report in Artifacts section below."
exit 1
build-arduino-AVR:
#needs: static-code-tests
if: false # This will deactivate the job
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set execute permissions for shell scripts
run: chmod +x ./.github/workflows/.ci_scripts/*.sh
- name: Set up Arduino CLI
uses: arduino/setup-arduino-cli@master
- name: Add library symlink to this MySensors repository
run: |
mkdir -p "$HOME/Arduino/libraries"
ln -s "$PWD" "$HOME/Arduino/libraries/."
- name: Install dependencies
run: |
arduino-cli core update-index
arduino-cli core install arduino:avr
arduino-cli lib install "Ethernet"
#### Example of compiling a single sketch
#- name: Compile a single and specific sketch
# run: |
# arduino-cli compile --fqbn arduino:avr:uno ./examples/LightSensor/LightSensor.ino
# Arduino AVR UNO
- name: Compile ArduinoUno (tests)
run: |
# Fully Qualified Board Name (FQBN) of the board to compile for
FQBN="arduino:avr:uno"
# path to the Arduino sketches directory
SKETCHES="./tests"
# Define the path to the blacklist file
EXCLUDES="./.github/workflows/.ci_scripts/Arduino-AVR-excludes"
# Run the script to compile all sketches
./.github/workflows/.ci_scripts/compile-arduino-sketches.sh $FQBN $SKETCHES $EXCLUDES
- name: Compile ArduinoUno (examples)
run: |
FQBN="arduino:avr:uno"
SKETCHES="./examples"
EXCLUDES="./.github/workflows/.ci_scripts/Arduino-AVR-excludes"
./.github/workflows/.ci_scripts/compile-arduino-sketches.sh $FQBN $SKETCHES $EXCLUDES
# Arduino AVR MEGA
- name: Compile ArduinoMega (tests)
run: |
FQBN="arduino:avr:mega:cpu=atmega2560"
SKETCHES="./tests"
EXCLUDES="./.github/workflows/.ci_scripts/Arduino-AVR-excludes"
./.github/workflows/.ci_scripts/compile-arduino-sketches.sh $FQBN $SKETCHES $EXCLUDES
- name: Compile ArduinoMega (examples)
run: |
FQBN="arduino:avr:mega:cpu=atmega2560"
SKETCHES="./examples"
EXCLUDES="./.github/workflows/.ci_scripts/Arduino-AVR-excludes"
./.github/workflows/.ci_scripts/compile-arduino-sketches.sh $FQBN $SKETCHES $EXCLUDES
build-arduino-ESP32:
#needs: static-code-tests
if: false # This will deactivate the job
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set execute permissions for shell scripts
run: chmod +x ./.github/workflows/.ci_scripts/*.sh
- name: Set up Arduino CLI
uses: arduino/setup-arduino-cli@master
- name: Add library symlink to this MySensors repository
run: |
mkdir -p "$HOME/Arduino/libraries"
ln -s "$PWD" "$HOME/Arduino/libraries/."
- name: Install dependencies
run: |
#arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
arduino-cli core update-index
arduino-cli core install esp32:esp32
#arduino-cli lib install "Ethernet"
- name: Compile ESP32 (tests)
run: |
FQBN="esp32:esp32:esp32:PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none"
SKETCHES="./tests"
EXCLUDES="./.github/workflows/.ci_scripts/Arduino-ESP32-excludes"
./.github/workflows/.ci_scripts/compile-arduino-sketches.sh $FQBN $SKETCHES $EXCLUDES
- name: Compile ESP32 (examples)
run: |
FQBN="esp32:esp32:esp32:PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none"
SKETCHES="./examples"
EXCLUDES="./.github/workflows/.ci_scripts/Arduino-ESP32-excludes"
./.github/workflows/.ci_scripts/compile-arduino-sketches.sh $FQBN $SKETCHES $EXCLUDES
build-arduino-MySensors:
#needs: static-code-tests
if: true # false # This will deactivate the job
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set execute permissions for shell scripts
run: chmod +x ./.github/workflows/.ci_scripts/*.sh
- name: Set up Arduino CLI
uses: arduino/setup-arduino-cli@master
- name: Add library symlink to this MySensors repository
run: |
mkdir -p "$HOME/Arduino/libraries"
ln -s "$PWD" "$HOME/Arduino/libraries/."
- name: Install dependencies
run: |
arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/mysensors/ArduinoBoards/master/package_mysensors.org_index.json
arduino-cli core update-index
arduino-cli core install arduino:avr
arduino-cli core install arduino:samd
arduino-cli core install MySensors:avr
arduino-cli core install MySensors:samd
arduino-cli lib install "Ethernet"
# MySensors AVR MysensorsMicro
- name: Compile MysensorsMicro (tests)
run: |
FQBN="MySensors:avr:MysensorsMicro:cpu=1Mhz"
SKETCHES="./tests"
EXCLUDES="./.github/workflows/.ci_scripts/Arduino-AVR-excludes"
./.github/workflows/.ci_scripts/compile-arduino-sketches.sh $FQBN $SKETCHES $EXCLUDES
- name: Compile MysensorsMicro (examples)
run: |
FQBN="MySensors:avr:MysensorsMicro:cpu=1Mhz"
SKETCHES="./examples"
EXCLUDES="./.github/workflows/.ci_scripts/Arduino-AVR-excludes"
./.github/workflows/.ci_scripts/compile-arduino-sketches.sh $FQBN $SKETCHES $EXCLUDES
# MySensors AVR MySensorsGW
- name: Compile MySensorsGW (tests)
run: |
FQBN="MySensors:samd:mysensors_gw_native"
SKETCHES="./tests"
EXCLUDES="./.github/workflows/.ci_scripts/Arduino-AVR-excludes"
./.github/workflows/.ci_scripts/compile-arduino-sketches.sh $FQBN $SKETCHES $EXCLUDES
- name: Compile MySensorsGW (examples)
run: |
FQBN="MySensors:samd:mysensors_gw_native"
SKETCHES="./examples"
EXCLUDES="./.github/workflows/.ci_scripts/Arduino-AVR-excludes"
./.github/workflows/.ci_scripts/compile-arduino-sketches.sh $FQBN $SKETCHES $EXCLUDES