5
5
import subprocess
6
6
import collections
7
7
8
+ # optional wall option cause build failed if has warnings
9
+ BUILD_WALL = False
10
+ if "--wall" in sys .argv :
11
+ BUILD_WALL = True
12
+ sys .argv .remove ("--wall" )
13
+
8
14
# add user bin to path!
9
15
BUILD_DIR = ''
10
16
# add user bin to path!
11
17
try :
12
- BUILD_DIR = os .environ ["TRAVIS_BUILD_DIR" ]
13
- except KeyError :
14
- pass # ok maybe we're on actions?
15
- try :
18
+ # If we're on actions
16
19
BUILD_DIR = os .environ ["GITHUB_WORKSPACE" ]
17
20
except KeyError :
18
- pass # ok maybe we're on travis?
21
+ try :
22
+ # If we're on travis
23
+ BUILD_DIR = os .environ ["TRAVIS_BUILD_DIR" ]
24
+ except KeyError :
25
+ # If we're running on local machine
26
+ BUILD_DIR = os .path .abspath ("." )
27
+ pass
19
28
20
29
os .environ ["PATH" ] += os .pathsep + BUILD_DIR + "/bin"
21
30
print ("build dir:" , BUILD_DIR )
89
98
"clue" : "adafruit:nrf52:cluenrf52840:softdevice=s140v6,debug=l0" ,
90
99
# RP2040 (Philhower)
91
100
"pico_rp2040" : "rp2040:rp2040:rpipico:freq=125,flash=2097152_0" ,
101
+ "pico_rp2040_tinyusb" : "rp2040:rp2040:rpipico:flash=2097152_0,freq=125,dbgport=Disabled,dbglvl=None,usbstack=tinyusb" ,
92
102
"feather_rp2040" : "rp2040:rp2040:adafruitfeather:freq=125,flash=8388608_0" ,
103
+ "feather_rp2040_tinyusb" : "rp2040:rp2040:adafruit_feather:flash=8388608_0,freq=125,dbgport=Disabled,dbglvl=None,usbstack=tinyusb" ,
93
104
# groupings
94
105
"main_platforms" : ("uno" , "leonardo" , "mega2560" , "zero" ,
95
106
"esp8266" , "esp32" , "metro_m4" , "trinket_m0" ),
@@ -220,14 +231,17 @@ def test_examples_in_folder(folderpath):
220
231
ColorPrint .print_warn ("skipping" )
221
232
continue
222
233
223
- cmd = ['arduino-cli' , 'compile' , '--fqbn' , fqbn , examplepath ]
234
+ cmd = ['arduino-cli' , 'compile' , '--warnings' , 'all' , '-- fqbn' , fqbn , examplepath ]
224
235
proc = subprocess .Popen (cmd , stdout = subprocess .PIPE ,
225
236
stderr = subprocess .PIPE )
226
237
r = proc .wait ()
227
238
out = proc .stdout .read ()
228
239
err = proc .stderr .read ()
229
- if r == 0 :
240
+ if r == 0 and not ( err and BUILD_WALL == True ) :
230
241
ColorPrint .print_pass (CHECK )
242
+ if err :
243
+ # also print out warning message
244
+ ColorPrint .print_fail (err .decode ("utf-8" ))
231
245
else :
232
246
ColorPrint .print_fail (CROSS )
233
247
ColorPrint .print_fail (out .decode ("utf-8" ))
@@ -243,7 +257,7 @@ def test_examples_in_learningrepo(folderpath):
243
257
continue
244
258
if not projectpath .endswith (".ino" ):
245
259
continue
246
- # found an INO!
260
+ # found an INO!
247
261
print ('\t ' + projectpath , end = ' ' )
248
262
# check if we should SKIP
249
263
skipfilename = folderpath + "/." + platform + ".test.skip"
@@ -254,15 +268,18 @@ def test_examples_in_learningrepo(folderpath):
254
268
elif glob .glob (folderpath + "/.*.test.only" ) and not os .path .exists (onlyfilename ):
255
269
ColorPrint .print_warn ("skipping" )
256
270
continue
257
-
258
- cmd = ['arduino-cli' , 'compile' , '--fqbn' , fqbn , projectpath ]
271
+
272
+ cmd = ['arduino-cli' , 'compile' , '--warnings' , 'all' , '-- fqbn' , fqbn , projectpath ]
259
273
proc = subprocess .Popen (cmd , stdout = subprocess .PIPE ,
260
274
stderr = subprocess .PIPE )
261
275
r = proc .wait ()
262
276
out = proc .stdout .read ()
263
277
err = proc .stderr .read ()
264
278
if r == 0 :
265
279
ColorPrint .print_pass (CHECK )
280
+ if err :
281
+ # also print out warning message
282
+ ColorPrint .print_fail (err .decode ("utf-8" ))
266
283
else :
267
284
ColorPrint .print_fail (CROSS )
268
285
ColorPrint .print_fail (out .decode ("utf-8" ))
0 commit comments