|
12 | 12 | success_count = 0
|
13 | 13 | fail_count = 0
|
14 | 14 |
|
| 15 | +build_format = '| {:20} | {:30} | {:9} ' |
| 16 | +build_separator = '-' * 77 |
| 17 | + |
| 18 | + |
15 | 19 | def build_examples(variant):
|
16 |
| - global exit_status, success_count, fail_count |
| 20 | + global exit_status, success_count, fail_count, build_format, build_separator |
17 | 21 | for sketch in glob.iglob('libraries/**/*.ino', recursive=True):
|
18 |
| - if ( os.path.exists( os.path.dirname(sketch) + '/.skip.' + variant ) ): |
19 |
| - print("Build {} SKIP".format(sketch)) |
20 |
| - continue |
21 |
| - |
22 | 22 | start_time = time.monotonic()
|
23 |
| - build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
24 |
| - build_duration = time.monotonic() - start_time |
25 | 23 |
|
26 |
| - if build_result.returncode != 0: |
27 |
| - exit_status = build_result.returncode |
28 |
| - success = "\033[31mfailed\033[0m" |
29 |
| - fail_count += 1 |
| 24 | + if os.path.exists(os.path.dirname(sketch) + '/.skip.' + variant): |
| 25 | + success = "skipped" |
30 | 26 | else:
|
31 |
| - success = "\033[32msucceeded\033[0m" |
32 |
| - success_count += 1 |
| 27 | + build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| 28 | + if build_result.returncode != 0: |
| 29 | + exit_status = build_result.returncode |
| 30 | + success = "\033[31mfailed\033[0m" |
| 31 | + fail_count += 1 |
| 32 | + else: |
| 33 | + success = "\033[32msucceeded\033[0m" |
| 34 | + success_count += 1 |
| 35 | + |
| 36 | + build_duration = time.monotonic() - start_time |
33 | 37 |
|
34 | 38 | if travis:
|
35 | 39 | print('travis_fold:start:build-{}\\r'.format(sketch))
|
36 | 40 |
|
37 |
| - print("Build {} took {:.2f}s and {}".format(sketch, build_duration, success)) |
| 41 | + print((build_format + '| {:.2f}s |').format(sketch.split(os.path.sep)[1], os.path.basename(sketch), success, build_duration)) |
| 42 | + |
38 | 43 | if build_result.returncode != 0:
|
39 | 44 | print(build_result.stdout.decode("utf-8"))
|
40 | 45 |
|
41 | 46 | if travis:
|
42 | 47 | print('travis_fold:end:build-{}\\r'.format(sketch))
|
43 | 48 |
|
| 49 | + |
44 | 50 | build_time = time.monotonic()
|
45 | 51 |
|
46 |
| -print("-----------------------------") |
47 |
| -print("Set board to Feather nRF52840") |
48 |
| -print("-----------------------------") |
| 52 | +print(build_separator) |
| 53 | +print('| {:^73} |'.format('Feather nRF52840 Express')) |
| 54 | +print(build_separator) |
| 55 | +print((build_format + '| {:5} |').format('Library', 'Example', 'Result', 'Time')) |
| 56 | +print(build_separator) |
49 | 57 | subprocess.run("arduino --board adafruit:nrf52:feather52840:softdevice=s140v6,debug=l0 --save-prefs", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
50 | 58 | build_examples('feather52840')
|
51 | 59 |
|
52 |
| -print("-----------------------------") |
53 |
| -print("Set board to Feather nRF52832") |
54 |
| -print("-----------------------------") |
| 60 | +print('\r\n') |
| 61 | +print(build_separator) |
| 62 | +print('| {:^73} |'.format('Feather nRF52832')) |
| 63 | +print((build_format + '| {:5} |').format('Library', 'Example', 'Result', 'Time')) |
| 64 | +print(build_separator) |
55 | 65 | subprocess.run("arduino --board adafruit:nrf52:feather52832:softdevice=s132v6,debug=l0 --save-prefs", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
56 | 66 | build_examples('feather52832')
|
57 | 67 |
|
58 |
| -print("--------------") |
59 |
| -print("Build Sumamary") |
60 |
| -print("--------------") |
| 68 | +print(build_separator) |
61 | 69 | build_time = time.monotonic() - build_time
|
62 |
| -print("{} \033[32msucceeded\033[0m, {} \033[31mfailed\033[0m and took {:.2f}s".format(success_count, fail_count, build_time)) |
| 70 | +print("Build Sumamary: {} \033[32msucceeded\033[0m, {} \033[31mfailed\033[0m and took {:.2f}s".format(success_count, fail_count, build_time)) |
| 71 | +print(build_separator) |
| 72 | + |
63 | 73 | sys.exit(exit_status)
|
0 commit comments