Reduce build log output and add "/Wall" build jobs.
Workaround for Arduino mDNS output noise using IPTABLES.
See https://forum.arduino.cc/index.php?topic=469428.0
See https://github.com/per1234/arduino-ci-script/issues/1
Arduino IDE adds a lot of noise caused by network traffic (mDNS?),
because it's listening for network-attached devices.
Firewall it in the TravisCI environment to cleanup logs.
Allow jobs with all warnings enabled to fail.
This enables the build to occur, and review of warnings,
without requiring these builds to be clean of warnings.
Also, only outputs the error logs (not full build logs)
for these build options. This is a critical step
towards getting to 100% warning-free builds, without
interrupting current processes.
This commit is contained in:
1 parent
3a54ca3e7d
commit
6031e4f2cc
2 files changed
+89
-7
No files matched your search
+55
-3
@@ -8,6 +8,13 @@ travis = False
|
||||
if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true":
|
||||
travis = True
|
||||
|
||||
all_warnings = False
|
||||
if "ALL_WARNINGS" in os.environ and os.environ["ALL_WARNINGS"] == "true":
|
||||
all_warnings = True
|
||||
|
||||
ENV_VARIABLE_NAME = 'VARIANT'
|
||||
|
||||
|
||||
exit_status = 0
|
||||
success_count = 0
|
||||
fail_count = 0
|
||||
@@ -21,6 +28,25 @@ variants_dict = {
|
||||
'feather52832': 'Feather nRF52832'
|
||||
}
|
||||
|
||||
# STDERR receives output that starts with the following text, none of which should be considered a warning or error...
|
||||
output_to_ignore = (
|
||||
'Picked up JAVA_TOOL_OPTIONS:',
|
||||
'Loading configuration...',
|
||||
'Initializing packages...',
|
||||
'Preparing boards...',
|
||||
'Verifying...',
|
||||
)
|
||||
|
||||
def errorOutputFilter(line):
|
||||
if len(line) == 0:
|
||||
return False
|
||||
if line.isspace(): # Note: empty string does not match here!
|
||||
return False
|
||||
if line.startswith(output_to_ignore): # alternatively, can trim() each line, but that would create lots of short-lived strings...
|
||||
return False
|
||||
# TODO: additional items to remove?
|
||||
return True
|
||||
|
||||
|
||||
def build_examples(variant):
|
||||
global exit_status, success_count, fail_count, build_format, build_separator
|
||||
@@ -33,6 +59,10 @@ def build_examples(variant):
|
||||
print(build_separator)
|
||||
subprocess.run("arduino --board adafruit:nrf52:{}:softdevice={},debug=l0 --save-prefs".format(variant, 's140v6' if variant != 'feather52832' else 's132v6'), shell=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
if all_warnings:
|
||||
subprocess.run("arduino --pref 'compiler.warning_level=all' --save-prefs", shell=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
for sketch in glob.iglob('libraries/**/*.ino', recursive=True):
|
||||
start_time = time.monotonic()
|
||||
@@ -40,11 +70,28 @@ def build_examples(variant):
|
||||
if os.path.exists(os.path.dirname(sketch) + '/.skip') or os.path.exists(os.path.dirname(sketch) + '/.skip.' + variant):
|
||||
success = "skipped"
|
||||
else:
|
||||
build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
# TODO - preferably, would have STDERR show up in **both** STDOUT and STDERR.
|
||||
# preferably, would use Python logging handler to get both distinct outputs and one merged output
|
||||
# for now, split STDERR when building with all warnings enabled, so can detect warning/error output.
|
||||
if all_warnings:
|
||||
build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
else:
|
||||
build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
# get stderr into a form where len(warningLines) indicates a true warning was output to stderr
|
||||
warningLines = [];
|
||||
if all_warnings and build_result.stderr:
|
||||
tmpWarningLines = build_result.stderr.decode("utf-8").splitlines()
|
||||
warningLines = list(filter(errorOutputFilter, (tmpWarningLines)))
|
||||
|
||||
if build_result.returncode != 0:
|
||||
exit_status = build_result.returncode
|
||||
success = "\033[31mfailed\033[0m "
|
||||
fail_count += 1
|
||||
elif len(warningLines) != 0:
|
||||
exit_status = -1
|
||||
success = "\033[31mwarnings\033[0m "
|
||||
fail_count += 1
|
||||
else:
|
||||
success = "\033[32msucceeded\033[0m"
|
||||
success_count += 1
|
||||
@@ -58,6 +105,12 @@ def build_examples(variant):
|
||||
|
||||
if build_result.returncode != 0:
|
||||
print(build_result.stdout.decode("utf-8"))
|
||||
if (build_result.stderr):
|
||||
print(build_result.stderr.decode("utf-8"))
|
||||
|
||||
if len(warningLines) != 0:
|
||||
for line in warningLines:
|
||||
print(line)
|
||||
|
||||
if travis:
|
||||
print('travis_fold:end:build-{}\\r'.format(sketch))
|
||||
@@ -65,7 +118,6 @@ def build_examples(variant):
|
||||
|
||||
build_time = time.monotonic()
|
||||
|
||||
ENV_VARIABLE_NAME = 'VARIANT'
|
||||
|
||||
# build only one variant if the environment variable is specified
|
||||
if (ENV_VARIABLE_NAME in os.environ):
|
||||
@@ -74,7 +126,7 @@ if (ENV_VARIABLE_NAME in os.environ):
|
||||
if (variant in variants_dict):
|
||||
build_examples(variant)
|
||||
else:
|
||||
print('\033[31failed\033[0m - invalid variant name "{}"'.format(variant))
|
||||
print('\033[31INTERNAL ERR\033[0m - invalid variant name "{}"'.format(variant))
|
||||
fail_count += 1
|
||||
exit_status = -1
|
||||
|
||||
|
||||
Reference in new issue
Block a user