Skip to content

Commit 81aa9cb

Browse files
authored
Merge pull request espressif#97 from adafruit/add-wall
add optional --wall option for ci
2 parents 4e069bd + 6ff9f70 commit 81aa9cb

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

build_platform.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,26 @@
55
import subprocess
66
import collections
77

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+
814
# add user bin to path!
915
BUILD_DIR = ''
1016
# add user bin to path!
1117
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
1619
BUILD_DIR = os.environ["GITHUB_WORKSPACE"]
1720
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
1928

2029
os.environ["PATH"] += os.pathsep + BUILD_DIR + "/bin"
2130
print("build dir:", BUILD_DIR)
@@ -89,7 +98,9 @@
8998
"clue" : "adafruit:nrf52:cluenrf52840:softdevice=s140v6,debug=l0",
9099
# RP2040 (Philhower)
91100
"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",
92102
"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",
93104
# groupings
94105
"main_platforms" : ("uno", "leonardo", "mega2560", "zero",
95106
"esp8266", "esp32", "metro_m4", "trinket_m0"),
@@ -220,14 +231,17 @@ def test_examples_in_folder(folderpath):
220231
ColorPrint.print_warn("skipping")
221232
continue
222233

223-
cmd = ['arduino-cli', 'compile', '--fqbn', fqbn, examplepath]
234+
cmd = ['arduino-cli', 'compile', '--warnings', 'all', '--fqbn', fqbn, examplepath]
224235
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
225236
stderr=subprocess.PIPE)
226237
r = proc.wait()
227238
out = proc.stdout.read()
228239
err = proc.stderr.read()
229-
if r == 0:
240+
if r == 0 and not (err and BUILD_WALL == True):
230241
ColorPrint.print_pass(CHECK)
242+
if err:
243+
# also print out warning message
244+
ColorPrint.print_fail(err.decode("utf-8"))
231245
else:
232246
ColorPrint.print_fail(CROSS)
233247
ColorPrint.print_fail(out.decode("utf-8"))
@@ -243,7 +257,7 @@ def test_examples_in_learningrepo(folderpath):
243257
continue
244258
if not projectpath.endswith(".ino"):
245259
continue
246-
# found an INO!
260+
# found an INO!
247261
print('\t'+projectpath, end=' ')
248262
# check if we should SKIP
249263
skipfilename = folderpath+"/."+platform+".test.skip"
@@ -254,15 +268,18 @@ def test_examples_in_learningrepo(folderpath):
254268
elif glob.glob(folderpath+"/.*.test.only") and not os.path.exists(onlyfilename):
255269
ColorPrint.print_warn("skipping")
256270
continue
257-
258-
cmd = ['arduino-cli', 'compile', '--fqbn', fqbn, projectpath]
271+
272+
cmd = ['arduino-cli', 'compile', '--warnings', 'all', '--fqbn', fqbn, projectpath]
259273
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
260274
stderr=subprocess.PIPE)
261275
r = proc.wait()
262276
out = proc.stdout.read()
263277
err = proc.stderr.read()
264278
if r == 0:
265279
ColorPrint.print_pass(CHECK)
280+
if err:
281+
# also print out warning message
282+
ColorPrint.print_fail(err.decode("utf-8"))
266283
else:
267284
ColorPrint.print_fail(CROSS)
268285
ColorPrint.print_fail(out.decode("utf-8"))

0 commit comments

Comments
 (0)