1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-12 19:10:19 +03:00

Bsongis/sonar (#5382)

Sonar integration
This commit is contained in:
Sonar agent 2017-11-19 15:27:49 +01:00 committed by Bertrand Songis
parent 90e58e4a5f
commit ab4b159d06
4 changed files with 40 additions and 13 deletions

View file

@ -73,5 +73,21 @@ install:
fi fi
- sudo apt-get install --yes --force-yes -qq qt${QT_BASE}base qt${QT_BASE}multimedia qt${QT_BASE}svg qt${QT_BASE}tools; source /opt/qt${QT_BASE}/bin/qt${QT_BASE}-env.sh - sudo apt-get install --yes --force-yes -qq qt${QT_BASE}base qt${QT_BASE}multimedia qt${QT_BASE}svg qt${QT_BASE}tools; source /opt/qt${QT_BASE}/bin/qt${QT_BASE}-env.sh
addons:
sonarcloud:
organization: "opentx-github"
token:
secure: "BuQrGRijNpL2V/IQNcOxvjChj8PScfCdiv403EE73Nqb4+sB8YL92Fnzrnw9bC8wF7BVSDJVpYF0gbdaTzuCmaeZfM8NJK0TOJAbH6+B8bhIrU/V1SBuVjHQnndV/wysieruKnK/KxYJZqItgSlnPo+PmiFxtXJNlas0Kstb2O4="
github_token:
secure: "Qkmp4VrQJtKgZ/pz65SNnCDiF4slgFfQS/3whyLXLcDbFb1Hv1oj7Hqz9EVDUSO2eEhgQGaOKkRc0CfAAOBwW6OvhE0xh7P1CJEjzOp6+3gI/LyZUNsqa+awVRZTsfm1YZaOPaPWJ7cI0uz3/OoSUeIecs4PDWPrQMGRlsrq7Q8="
branches:
- "2.2"
script: script:
- ./tools/commit-tests.sh - build-wrapper-linux-x86-64 --out-dir bw_output ./tools/commit-tests.sh
- sonar-scanner
cache:
directories:
- '$HOME/.sonar/cache'

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import print_function
import os import os
import sys import sys
import subprocess import subprocess
@ -205,7 +206,7 @@ def build_firmware(path):
file(outpath, "a").write("\n".join(cmd) + output + error) file(outpath, "a").write("\n".join(cmd) + output + error)
else: else:
file(errpath, "w").write(output + error) file(errpath, "w").write(output + error)
print filename print(filename)
exit(COMPILATION_ERROR) exit(COMPILATION_ERROR)
# Launch make # Launch make
@ -216,7 +217,7 @@ def build_firmware(path):
file(outpath, "a").write(output + error) file(outpath, "a").write(output + error)
else: else:
file(errpath, "w").write(output + error) file(errpath, "w").write(output + error)
print filename print(filename)
exit(COMPILATION_ERROR) exit(COMPILATION_ERROR)
if what == "firmware": if what == "firmware":
@ -233,11 +234,11 @@ def build_firmware(path):
shutil.move(target, path) shutil.move(target, path)
if os.path.isfile(errpath): if os.path.isfile(errpath):
print filename print(filename)
exit(COMPILATION_ERROR) exit(COMPILATION_ERROR)
if os.path.isfile(path): if os.path.isfile(path):
print filename print(filename)
exit(0) exit(0)
lockpath = path + ".lock" lockpath = path + ".lock"
@ -247,8 +248,8 @@ try:
if not os.path.isfile(path): if not os.path.isfile(path):
build_firmware(path) build_firmware(path)
except filelock.Timeout: except filelock.Timeout:
print filename print(filename)
exit(COMPILATION_ERROR) exit(COMPILATION_ERROR)
print filename print(filename)
exit(0) exit(0)

View file

@ -6,6 +6,7 @@
# on 2.2 release: cmake -DPCB=9X -DTELEMETRY=FRSKY -DAUDIO=YES -DVOICE=YES -DHELI=YES -DTEMPLATES=YES ~/git/opentx # on 2.2 release: cmake -DPCB=9X -DTELEMETRY=FRSKY -DAUDIO=YES -DVOICE=YES -DHELI=YES -DTEMPLATES=YES ~/git/opentx
# => 64828 (program) + 3236 (data) # => 64828 (program) + 3236 (data)
from __future__ import print_function
import os import os
import sys import sys
import subprocess import subprocess
@ -26,7 +27,7 @@ while 1:
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = proc.communicate() output, error = proc.communicate()
if proc.returncode != 0: if proc.returncode != 0:
print "HEAD~%d git reset failed" % index print("HEAD~%d git reset failed" % index)
continue continue
os.chdir(buildir) os.chdir(buildir)
@ -34,14 +35,14 @@ while 1:
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = proc.communicate() output, error = proc.communicate()
if proc.returncode != 0: if proc.returncode != 0:
print "HEAD~%d cmake failed" % index print("HEAD~%d cmake failed" % index)
continue continue
cmd = ["make", "-j4", "firmware"] cmd = ["make", "-j4", "firmware"]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = proc.communicate() output, error = proc.communicate()
if proc.returncode != 0: if proc.returncode != 0:
print "HEAD~%d make firmware failed" % index print("HEAD~%d make firmware failed" % index)
continue continue
if os.path.isfile("firmware.bin"): if os.path.isfile("firmware.bin"):
@ -50,11 +51,11 @@ while 1:
oldsize = int(subprocess.check_output('avr-size -A firmware.hex | grep Total | cut -f2- -d " "', shell=True)) oldsize = int(subprocess.check_output('avr-size -A firmware.hex | grep Total | cut -f2- -d " "', shell=True))
if size: if size:
if size > oldsize: if size > oldsize:
print "HEAD~%d %d: increase by %d bytes" % (index-1, size, size-oldsize) print("HEAD~%d %d: increase by %d bytes" % (index-1, size, size-oldsize))
elif size < oldsize: elif size < oldsize:
print "HEAD~%d %d: decrease by %d bytes" % (index-1, size, oldsize-size) print("HEAD~%d %d: decrease by %d bytes" % (index-1, size, oldsize-size))
else: else:
print "HEAD~%d %d" % (index-1, size) print("HEAD~%d %d" % (index-1, size))
size = oldsize size = oldsize

9
sonar-project.properties Normal file
View file

@ -0,0 +1,9 @@
sonar.host.url = https://sonarcloud.io
sonar.projectKey = OpenTX
sonar.organization = opentx-github
sonar.projectName = OpenTX
sonar.projectVersion = 2.2
sonar.sources = .
sonar.exclusions = sound/**, build/**, radio/src/thirdparty/**
sonar.cfamily.build-wrapper-output = bw_output