Skip to content

Commit 916a385

Browse files
committed
install library deps, only print output of compile on failure
1 parent d52d214 commit 916a385

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

.github/workflows/githubci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ jobs:
1111
- uses: actions/checkout@v1
1212
- uses: actions/setup-python@v1
1313
with:
14-
python-version: '3.x' # Version range or exact version of a Python version to use, using semvers version range syntax.
15-
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
14+
python-version: '3.x'
1615
- name: pre-install
17-
run: |
18-
bash ./actions_install.sh
16+
run: bash ./actions_install.sh
1917
- name: test platforms
2018
run: |
2119
python3 build_platform.py uno leonardo mega2560 zero esp8266 esp32

build_platform.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import glob
33
import time
44
import os
5+
import subprocess
56
from clint.textui import colored
67

78
# add user bin to path!
@@ -84,9 +85,23 @@ def run_or_die(cmd, error):
8485
# link test library folder to the arduino libraries folder
8586
os.symlink(BUILD_DIR, os.environ['HOME']+'/Arduino/libraries/Adafruit_Test_Library')
8687

88+
################################ Install dependancies
89+
try:
90+
libprop = open(BUILD_DIR+'/library.properties')
91+
for line in libprop:
92+
if line.startswith("depends="):
93+
deps = line.replace("depends=", "").split(",")
94+
for dep in deps:
95+
dep = dep.strip()
96+
run_or_die('arduino-cli lib install "'+dep+'"',
97+
"FAILED to install dependancy "+dep)
98+
except OSError:
99+
pass # no library properties
87100

88101
################################ Test platforms
89102
platforms = sys.argv[1:]
103+
success = 0
104+
90105
for platform in platforms:
91106
fqbn = ALL_PLATFORMS[platform]
92107
#print("building", platform, "full name", fqbn)
@@ -99,9 +114,21 @@ def run_or_die(cmd, error):
99114
for filename in os.listdir(exampledir+"/"+example):
100115
if filename.endswith(".ino"):
101116
print('\t'+filename, end=' ')
102-
r = os.system('arduino-cli compile --fqbn '+fqbn+" "+exampledir+"/"+example+"/"+filename+' > /dev/null')
117+
cmd = ['arduino-cli', 'compile', '--fqbn', fqbn,
118+
exampledir+"/"+example+"/"+filename]
119+
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
120+
stderr=subprocess.PIPE)
121+
r = proc.wait()
122+
err = proc.stderr.read()
123+
out = proc.stdout.read()
124+
#print("OUTPUT: ", out)
125+
#print("ERROUT: ", err)
126+
103127
if r == 0:
104128
print(colored.green(CHECK))
105129
else:
106130
print(colored.red(CROSS))
107-
131+
print(colored.red(err.decode("utf-8")))
132+
success = 1
133+
134+
exit(success)

0 commit comments

Comments
 (0)