From f4640306b7e91f647dfb0acfa529a05f1b7e9f52 Mon Sep 17 00:00:00 2001 From: "a.yankovich" <EndrIIMail@gmail.com> Date: Mon, 22 Jul 2019 10:20:59 +0300 Subject: [PATCH] init commit --- .gitignore | 10 + BuildBotLib/BuildBot.pyproject | 20 ++ BuildBotLib/README.md | 6 + BuildBotLib/basemodule.py | 35 +++ BuildBotLib/buildBotChangeSource.py | 36 +++ BuildBotLib/buildBotDB.py | 14 + BuildBotLib/buildBotIdentity.py | 42 +++ BuildBotLib/buildBotModule.py | 9 + BuildBotLib/buildBotServices.py | 24 ++ BuildBotLib/buildBotShedulers.py | 37 +++ BuildBotLib/buildBotWorkers.py | 29 ++ BuildBotLib/buildbot.py | 95 ++++++ BuildBotLib/qmake.py | 317 ++++++++++++++++++++ BuildBotLib/qtUpdater.py | 443 ++++++++++++++++++++++++++++ BuildBotLib/quasarAppCoin.py | 44 +++ BuildBotLib/stepsLib.py | 3 + BuildBotLib/testmodule.py | 18 ++ README.md | 2 +- master.cfg | 21 ++ 19 files changed, 1204 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 BuildBotLib/BuildBot.pyproject create mode 100644 BuildBotLib/README.md create mode 100644 BuildBotLib/basemodule.py create mode 100644 BuildBotLib/buildBotChangeSource.py create mode 100644 BuildBotLib/buildBotDB.py create mode 100644 BuildBotLib/buildBotIdentity.py create mode 100644 BuildBotLib/buildBotModule.py create mode 100644 BuildBotLib/buildBotServices.py create mode 100644 BuildBotLib/buildBotShedulers.py create mode 100644 BuildBotLib/buildBotWorkers.py create mode 100644 BuildBotLib/buildbot.py create mode 100644 BuildBotLib/qmake.py create mode 100644 BuildBotLib/qtUpdater.py create mode 100644 BuildBotLib/quasarAppCoin.py create mode 100644 BuildBotLib/stepsLib.py create mode 100644 BuildBotLib/testmodule.py create mode 100644 master.cfg diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6bb50a5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +gitpoller-work/ +*.tac +*.log* +*.sqlite +*.swp +gitpoller-workdir/ +*.pid +*.user +*__pycache__* +*.pyc diff --git a/BuildBotLib/BuildBot.pyproject b/BuildBotLib/BuildBot.pyproject new file mode 100644 index 0000000..6c959b5 --- /dev/null +++ b/BuildBotLib/BuildBot.pyproject @@ -0,0 +1,20 @@ +{ + "files": [ + "buildbot.py", + "basemodule.py", + "../master.cfg", + "README.md", + "testmodule.py", + "qmake.py", + "stepsLib.py", + "quasarAppCoin.py", + "buildBotWorkers.py", + "buildBotServices.py", + "buildBotIdentity.py", + "buildBotModule.py", + "buildBotDB.py", + "buildBotShedulers.py", + "buildBotChangeSource.py", + "qtUpdater.py" + ] +} diff --git a/BuildBotLib/README.md b/BuildBotLib/README.md new file mode 100644 index 0000000..977a848 --- /dev/null +++ b/BuildBotLib/README.md @@ -0,0 +1,6 @@ +# QmakeModule +For the module to work correctly, the project must support the following targets: +* test - run tests; +* deploy - deploy a project (collect dependencies in the distribution) use cqtdeployer; +* release - adding a new version to all supported sites, +or if there are none, add up everything in PWD/Release; diff --git a/BuildBotLib/basemodule.py b/BuildBotLib/basemodule.py new file mode 100644 index 0000000..5465676 --- /dev/null +++ b/BuildBotLib/basemodule.py @@ -0,0 +1,35 @@ +import sys +from buildbot.plugins import util +import multiprocessing +import glob +import shutil + +def getFactory(): + return util.BuildFactory() + +def getRepo(): + return ""; + +def getPropertyes(): + return [] + +@util.renderer +def makeCommand(props): + command = ['make'] + cpus = multiprocessing.cpu_count() + + if cpus: + command.extend(['-j', str(cpus)]) + else: + command.extend(['-j', '1']) + return command + +def copyRegExp(source, dist): + + res = [] + + for file in glob.glob(source): + res.append(file) + shutil.copy(file, dist) + + return res; diff --git a/BuildBotLib/buildBotChangeSource.py b/BuildBotLib/buildBotChangeSource.py new file mode 100644 index 0000000..ee8d879 --- /dev/null +++ b/BuildBotLib/buildBotChangeSource.py @@ -0,0 +1,36 @@ +# This Python file uses the following encoding: utf-8 +from BuildBotLib.buildBotModule import * +from buildbot.plugins import util +from buildbot.plugins import changes + +class buildBotChangeSource(BuildBotModule): + def __init__(self): + BuildBotModule.__init__(self) + + self.masterConf['change_source'] = [ + changes.GitPoller( + repourl = 'git@github.com:QuasarApp/Snake.git', + project = 'Snake', + branches = True, # получаем изменения со всех веток + pollInterval = 60 + ), + changes.GitPoller( + repourl = 'git@github.com:QuasarApp/Console-QtDeployer.git', + project = 'CQtDeployer', + branches = True, # получаем изменения со всех веток + pollInterval = 61 + ), + changes.GitPoller( + repourl = 'git@github.com:QuasarApp/Qt-Secret.git', + project = 'Qt-Secret', + branches = True, # получаем изменения со всех веток + pollInterval = 62 + ), + changes.GitPoller( + repourl = 'git@github.com:QuasarApp/Hanoi-Towers.git', + project = 'Hanoi-Towers', + branches = True, # получаем изменения со всех веток + pollInterval = 63 + ), + ] + diff --git a/BuildBotLib/buildBotDB.py b/BuildBotLib/buildBotDB.py new file mode 100644 index 0000000..f06af33 --- /dev/null +++ b/BuildBotLib/buildBotDB.py @@ -0,0 +1,14 @@ +# This Python file uses the following encoding: utf-8 +from BuildBotLib.buildBotModule import * + +class BuildBotDB(BuildBotModule): + def __init__(self): + BuildBotModule.__init__(self) + + ####### DB URL + + self.masterConf['db'] = { + # This specifies what database buildbot uses to store its state. You can leave + # this at its default for all but the largest installations. + 'db_url' : "sqlite:///state.sqlite", + } diff --git a/BuildBotLib/buildBotIdentity.py b/BuildBotLib/buildBotIdentity.py new file mode 100644 index 0000000..e294067 --- /dev/null +++ b/BuildBotLib/buildBotIdentity.py @@ -0,0 +1,42 @@ +# This Python file uses the following encoding: utf-8 +from buildbot.www import authz, auth +from buildbot.plugins import * +from BuildBotLib.buildBotModule import * + +####### PROJECT IDENTITY + +# the 'title' string will appear at the top of this buildbot installation's +# home pages (linked to the 'titleURL'). + +class buildBotIdentity(BuildBotModule): + def __init__(self): + self.masterConf['title'] = "QuasarApp CI" + self.masterConf['titleURL'] = "https://github.com/QuasarApp/Console-QtDeployer" + + # the 'buildbotURL' string should point to the location where the buildbot's + # internal web server is visible. This typically uses the port number set in + # the 'www' entry below, but with an externally-visible host name which the + # buildbot cannot figure out without some help. + + self.masterConf['buildbotURL'] = "http://quasarapp.ddns.net:8010/" + #c['buildbotURL'] = "http://192.168.100.2:8010/" + + + # minimalistic config to activate new web UI + self.masterConf['www'] = dict(port=8010, + plugins=dict(waterfall_view={}, console_view={}, grid_view={})) + + self.masterConf['www']['authz'] = util.Authz( + allowRules = [ + util.AnyEndpointMatcher(role="admins") + ], + roleMatchers = [ + util.RolesFromUsername(roles=['admins'], usernames=['EndrII']), + util.RolesFromUsername(roles=['admins'], usernames=['ZIG']) + ] + ) + self.masterConf['www']['auth'] = util.UserPasswordAuth([ + ('EndrII', util.Secret("ENDRII")), + ('ZIG', util.Secret("ZIG")) + ]) + diff --git a/BuildBotLib/buildBotModule.py b/BuildBotLib/buildBotModule.py new file mode 100644 index 0000000..bb30887 --- /dev/null +++ b/BuildBotLib/buildBotModule.py @@ -0,0 +1,9 @@ +# This Python file uses the following encoding: utf-8 + +class BuildBotModule: + masterConf = {} + def __init__(self): + masterConf = {} + + def getMasterConf(self): + return self.masterConf diff --git a/BuildBotLib/buildBotServices.py b/BuildBotLib/buildBotServices.py new file mode 100644 index 0000000..3aab6da --- /dev/null +++ b/BuildBotLib/buildBotServices.py @@ -0,0 +1,24 @@ +# This Python file uses the following encoding: utf-8 +from BuildBotLib.buildBotModule import * +from buildbot.plugins import reporters, util, secrets + +class buildBotServices(BuildBotModule): + def __init__(self): + BuildBotModule.__init__(self) + + ####### BUILDBOT SERVICES + + # 'services' is a list of BuildbotService items like reporter targets. The + # status of each build will be pushed to these targets. buildbot/reporters/*.py + # has a variety to choose from, like IRC bots. + + self.masterConf['services'] = [] + self.masterConf['secretsProviders'] = [ + secrets.SecretInAFile(dirname="/home/andrei/buildBotSecret") + ] + + gc = reporters.GitHubCommentPush(token=util.Secret("gitHub"), + startDescription='Build started.', + endDescription='Build done.') + + self.masterConf['services'].append(gc) diff --git a/BuildBotLib/buildBotShedulers.py b/BuildBotLib/buildBotShedulers.py new file mode 100644 index 0000000..5d7af52 --- /dev/null +++ b/BuildBotLib/buildBotShedulers.py @@ -0,0 +1,37 @@ +# This Python file uses the following encoding: utf-8 +from BuildBotLib.buildBotModule import * +from buildbot.schedulers import * +from buildbot.plugins import schedulers + +class buildBotShedulers(BuildBotModule): + codebases = {} + shedulers = [] + def __init__(self): + BuildBotModule.__init__(self) + + + def addScheduler(self , prop, worker): + shedulerName = 'force-' + worker; + + self.shedulers.append( + schedulers.ForceScheduler( + name = shedulerName, + properties = prop, + builderNames = [worker] + ) + ) + + + def getShedulers(self, builders, prop): + + self.masterConf['schedulers'] = self.shedulers + [ + schedulers.AnyBranchScheduler( + name='Tester', + builderNames=builders, + properties=prop, + treeStableTimer = None + ) + ] + + return self.getMasterConf(); + diff --git a/BuildBotLib/buildBotWorkers.py b/BuildBotLib/buildBotWorkers.py new file mode 100644 index 0000000..f2d7a1d --- /dev/null +++ b/BuildBotLib/buildBotWorkers.py @@ -0,0 +1,29 @@ +# This Python file uses the following encoding: utf-8 + +from buildbot.plugins import * +from BuildBotLib.buildBotModule import * + + +class buildBotWorkers(BuildBotModule): + def __init__(self): + BuildBotModule.__init__(self) + ####### WORKERS + + # The 'workers' list defines the set of recognized workers. Each element is + # a Worker object, specifying a unique worker name and password. The same + # worker name and password must be configured on the worker. + self.masterConf['workers'] = [ + worker.Worker("github-worker", "pass"), + worker.Worker("Tester", "pass"), + worker.Worker("qtBuilder", "pass") + + ] + + # 'protocols' contains information about protocols which master will use for + # communicating with workers. You must define at least 'port' option that workers + # could connect to your master with this protocol. + # 'port' must match the value configured into the workers (with their + # --master option) + + self.masterConf['protocols'] = {'pb': {'port': 9989}} + diff --git a/BuildBotLib/buildbot.py b/BuildBotLib/buildbot.py new file mode 100644 index 0000000..4cc94bb --- /dev/null +++ b/BuildBotLib/buildbot.py @@ -0,0 +1,95 @@ +from buildbot.plugins import util +import logging +import importlib +import sys +from BuildBotLib.testmodule import * +import os +from buildbot.changes.gitpoller import GitPoller + +from BuildBotLib.buildBotIdentity import * +from BuildBotLib.buildBotServices import * +from BuildBotLib.buildBotWorkers import * +from BuildBotLib.buildBotDB import * +from BuildBotLib.buildBotShedulers import * +from BuildBotLib.buildBotChangeSource import * + +dir_path = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(dir_path) + +class BuildBot: + masterConf = {} + workers = buildBotWorkers() + services = buildBotServices() + identity = buildBotIdentity() + db = BuildBotDB() + shedulers = buildBotShedulers() + sources = buildBotChangeSource() + builders = [] + + + def importWithReload(self, name): + module = importlib.import_module(name); + return module; + + def __init__(self): + self.masterConf = BuildmasterConfig = {} + self.masterConf['builders'] = [] + self.masterConf['schedulers'] = [] + self.masterConf['change_source'] = [] + + ####### WORKERS + self.masterConf.update(self.workers.getMasterConf()); + + ####### BUILDBOT SERVICES + self.masterConf.update(self.services.getMasterConf()); + + ####### PROJECT IDENTITY + self.masterConf.update(self.identity.getMasterConf()); + + ####### DB URL + self.masterConf.update(self.db.getMasterConf()); + + ####### change_source + self.masterConf.update(self.sources.getMasterConf()); + + + def addChangeSource(self, rep): + self.masterConf['change_source'].append(GitPoller( + rep, + workdir='gitpoller-workdir', branch='master', + pollInterval=300)) + + def addBuilder(self, worker, factory): + module = self.importWithReload(factory); + self.masterConf['builders'].append( + util.BuilderConfig( + name = worker, + workernames = [worker], + factory = module.getFactory() + ) + ) + self.shedulers.addScheduler(module.getPropertyes(), worker) + self.builders.append(worker); + +# self.addChangeSource(module.getRepo()) + + + def addService(self, service): + logging.error("addService not support!") + + def getMaster(self): + + prop = { + 'clean': True, + 'test': True, + 'release': False, + 'deploy': False, + 'Linux': True, + 'Windows': True, + 'Android': True + + } + + self.masterConf.update(self.shedulers.getShedulers(['Tester'], prop)); + + return self.masterConf diff --git a/BuildBotLib/qmake.py b/BuildBotLib/qmake.py new file mode 100644 index 0000000..309a43f --- /dev/null +++ b/BuildBotLib/qmake.py @@ -0,0 +1,317 @@ +# This Python file uses the following encoding: utf-8 + +import BuildBotLib.basemodule as base +from buildbot.plugins import util, steps +from pathlib import Path +import datetime +import os +import subprocess + +def isClean(step): + return step.getProperty('clean'); + +def isDeploy(step): + return step.getProperty('deploy'); + + +def isRelease(step): + return step.getProperty('release'); + + +def isTest(step): + return step.getProperty('test'); + +def isWin(step): + return step.getProperty('Windows'); + +def isLinux(step): + return step.getProperty('Linux'); + +def isAndroid(step): + return step.getProperty('Android'); + +@util.renderer +def destDir(props): + home = str(Path.home()) + repo = str(props.getProperty('repository')); + now = datetime.datetime.now().strftime("(%H %M) %m-%d-%Y") + + return home + '/shared/' + repo[repo.rfind('/'): len(repo) - 4] + "/" + now + +@util.renderer +def permission(props): + home = str(Path.home()) + return ["chmod", "-R", "775", home + '/shared'] + +def LinuxSteps() : + + list = [ + steps.ShellCommand( + command = [ + 'qmake-linux', + "QMAKE_CXX='ccache g++'", + "-r", + "CONFIG+=qtquickcompiler", + 'ONLINE="~/repo"' + ], + haltOnFailure = True, + doStepIf = lambda step : isLinux(step), + + name = 'QMake Linux', + description = 'create a make files for projects', + ), + steps.ShellCommand( + command = ['make', 'clean'], + doStepIf = lambda step : isClean(step) and isLinux(step), + name = 'clean Linux', + description = 'clean old build data', + ), + steps.Compile( + command = base.makeCommand, + name = 'Build Linux', + doStepIf = lambda step : isLinux(step), + + haltOnFailure = True, + description = 'run make for project', + ), + steps.ShellCommand( + command= ['make', 'deploy'], + doStepIf = lambda step : isDeploy(step) and isLinux(step), + name = 'deploy Linux', + haltOnFailure = True, + description = 'deploy project ', + ), + steps.Compile( + command= ['make', 'test'], + doStepIf = lambda step : isTest(step) and isLinux(step), + name = 'tests ', + haltOnFailure = True, + description = 'run autotests of project', + ), + steps.ShellCommand( + command= ['make', 'release'], + doStepIf = lambda step : isRelease(step) and isLinux(step), + name = 'release Linux', + haltOnFailure = True, + description = 'release project, like push to store or online repository', + ), + steps.ShellCommand( + command = ['make', 'distclean'], + doStepIf = lambda step : isLinux(step), + name = 'clean Linux makefiles', + description = 'clean old makefiles ', + ), + + + ] + + return list; + +def AndroidSteps() : +# !isEmpty( SIGN_PATH ): !isEmpty( SIGN_PASSWORD ): !isEmpty( SIGN_STORE_PASSWORD ) { +# 'ONLINE="~/repo"' + + list = [ + steps.ShellCommand( + command = [ + 'qmake-android', + '-spec', 'android-clang', + "-r", + "CONFIG+=qtquickcompiler", + 'SIGN_PATH="' + util.Secret("SIGPATH") + '"', + 'SIGN_ALIES="quasarapp"', + 'SIGN_STORE_PASSWORD="' + util.Secret("SIGPASS") + '"', + ], + haltOnFailure = True, + doStepIf = lambda step : isAndroid(step), + + name = 'QMake Android', + description = 'create a make files for projects', + ), + steps.ShellCommand( + command = ['make', 'clean'], + doStepIf = lambda step : isClean(step) and isAndroid(step), + name = 'clean Android', + description = 'clean old build data', + ), + steps.Compile( + command = base.makeCommand, + name = 'Build Android', + doStepIf = lambda step : isAndroid(step), + + haltOnFailure = True, + description = 'run make for project', + ), + steps.ShellCommand( + command= ['make', 'deploy'], + doStepIf = lambda step : isDeploy(step) and isAndroid(step), + name = 'deploy Android', + haltOnFailure = True, + description = 'deploy project ', + ), + steps.ShellCommand( + command= ['make', 'release'], + doStepIf = lambda step : isRelease(step) and isAndroid(step), + name = 'release Android', + haltOnFailure = True, + description = 'release project, like push to store or online repository', + ), + steps.ShellCommand( + command = ['make', 'distclean'], + doStepIf = lambda step : isAndroid(step), + name = 'clean Android makefiles', + description = 'clean old makefiles ', + ), + + + ] + + return list; + +def WinSteps() : + list = [ + steps.ShellCommand( + command = [ + 'qmake-windows', + '-spec', 'win32-g++', + "QMAKE_CXX='ccache x86_64-w64-mingw32-g++'", + "-r", + "CONFIG+=qtquickcompiler", + 'ONLINE="~/repo"' + ], + name = 'QMake Windows', + haltOnFailure = True, + doStepIf = lambda step : isWin(step), + description = 'create a make files for projects', + ), + steps.ShellCommand( + command = ['make', 'clean'], + doStepIf = lambda step : isClean(step) and isWin(step), + name = 'clean Windows', + description = 'clean old build data', + ), + steps.Compile( + command = base.makeCommand, + name = 'Build Windows', + haltOnFailure = True, + doStepIf = lambda step : isWin(step), + + description = 'run make for project', + ), + steps.ShellCommand( + command= ['make', 'deploy'], + doStepIf = lambda step : isDeploy(step) and isWin(step), + name = 'deploy Windows', + haltOnFailure = True, + + description = 'deploy project ', + ), + steps.ShellCommand( + command= ['make', 'release'], + doStepIf = lambda step : isRelease(step) and isWin(step), + name = 'release Windows', + haltOnFailure = True, + + description = 'release project, like push to store or online repository', + ), + steps.ShellCommand( + command = ['make', 'distclean'], + doStepIf = lambda step : isWin(step), + name = 'clean Windows makefiles', + description = 'clean old makefiles ', + ), + ] + return list; + + +def getFactory(): + factory = base.getFactory(); + + factory.addStep( + steps.Git( + repourl=util.Interpolate('%(prop:repository)s'), + branch=util.Interpolate('%(prop:branch)s'), + mode='full', + method = 'fresh', + submodules=True, + name = 'git operations', + description = 'operations of git like pull clone fetch', + ) + ); + + factory.addSteps(LinuxSteps()); + factory.addSteps(WinSteps()); + factory.addSteps(AndroidSteps()); + + factory.addStep( + steps.CopyDirectory( + src = util.Interpolate('build/%(prop:copyFolder)s'), + dest = destDir, + doStepIf = lambda step : isDeploy(step), + name = 'copy buildet files', + description = 'copy buildet files to shared folder', + ) + ); + + factory.addStep( + steps.ShellCommand( + command= permission, + name = 'set permission', + haltOnFailure = True, + + description = 'set permission for shared folder', + ) + ); + + return factory + +def getRepo(): + return ""; + +def getPropertyes(): + return [ + util.BooleanParameter( + name = 'Windows', + label = 'Windows version project', + default = True + ), + + util.BooleanParameter( + name = 'Linux', + label = 'Linux version project', + default = True + ), + + util.BooleanParameter( + name = 'Android', + label = 'Android version project', + default = True + ), + + util.BooleanParameter( + name = 'clean', + label = 'clean old build ', + default = True + ), + util.BooleanParameter( + name = 'deploy', + label = 'deploy project', + default = True + ), + util.BooleanParameter( + name = 'test', + label = 'test project ', + default = True + ), + util.BooleanParameter( + name = 'release', + label = 'release project', + default = False + ), + util.StringParameter( + name = 'copyFolder', + label = 'Folder with buildet data', + default = "Distro" + ), + + ] diff --git a/BuildBotLib/qtUpdater.py b/BuildBotLib/qtUpdater.py new file mode 100644 index 0000000..a4bdcd3 --- /dev/null +++ b/BuildBotLib/qtUpdater.py @@ -0,0 +1,443 @@ +# This Python file uses the following encoding: utf-8 + +import BuildBotLib.basemodule as base +from buildbot.plugins import util, steps +from pathlib import Path +import subprocess +import hashlib +import os +import datetime + + +# Windows build command +#./configure -opensource -confirm-license -release -nomake examples -nomake tests -skip qtactiveqt -skip qtwebglplugin -skip qtlocation -skip qtvirtualkeyboard -skip qtwinextras -opengl desktop -prefix ~/Qt/5.12.3/win64 -xplatform win32-g++ -device-option CROSS_COMPILE=x86_64-w64-mingw32- + +# Linux +# libclang-dev sudo apt install libclang-6.0-dev llvm-6.0 libxcomposite-dev и libwayland-dev +# '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev gperf bison flex +# ./configure -skip qtpim -opensource -confirm-license -release -qt-doubleconversion -qt-pcre -qt-zlib -qt-freetype -qt-harfbuzz -qt-libpng -qt-libjpeg -qt-assimp -qt-tiff -qt-webp -qt-webengine-icu -qt-webengine-ffmpeg -qt-webengine-opus -qt-webengine-webp -nomake examples -nomake tests -prefix ~/Qt/5.14.3/win64 + + +#android +# ./configure -opensource -confirm-license -release -xplatform android-clang --disable-rpath -nomake tests -nomake examples -android-ndk /home/andrei/Android/NDK/android-ndk-r19c -android-sdk /home/andrei/Android/SDK -skip qttranslations -skip qtserialport -no-warnings-are-errors -android-arch arm64-v8a -qt-doubleconversion -qt-pcre -qt-zlib -qt-freetype -qt-harfbuzz -qt-libpng -qt-libjpeg -qt-assimp -qt-tiff -qt-webp -qt-webengine-icu -qt-webengine-ffmpeg -qt-webengine-opus -qt-webengine-webp +# 10:47:23: The process "/home/andrei/Downloads/android-ndk-r19c-linux-x86_64/android-ndk-r19c/prebuilt/linux-x86_64/bin/make" exited normally. +# 10:47:23: Starting: "/media/D/Qt/5.12.4/android_arm64_v8a/bin/androiddeployqt" --input /media/D/own/build-SnakeMain-Android_for_arm64_v8a_Clang_Qt_5_12_4_for_Android_ARM64_v8a-Debug/Snake/android-libsnake.so-deployment-settings.json --output /media/D/own/build-SnakeMain-Android_for_arm64_v8a_Clang_Qt_5_12_4_for_Android_ARM64_v8a-Debug/android-build --android-platform android-29 --jdk /usr --gradle +# 15:41:18: The process "/home/andrei/Downloads/android-ndk-r19c-linux-x86_64/android-ndk-r19c/prebuilt/linux-x86_64/bin/make" exited normally. +# 15:41:18: Starting: "/media/D/Qt/5.12.4/android_arm64_v8a/bin/androiddeployqt" +# --input /media/D/own/build-SnakeMain-Android_for_arm64_v8a_Clang_Qt_5_12_4_for_Android_ARM64_v8a-Release/Snake/android-libsnake.so-deployment-settings.json +# --output /media/D/own/build-SnakeMain-Android_for_arm64_v8a_Clang_Qt_5_12_4_for_Android_ARM64_v8a-Release/android-build +# --android-platform android-29 +# --jdk /usr +# --gradle +# --sign '******' --storepass '******' --keypass '******' + +qtDefaultHelp = [[]] +LAST_TARGET_DIR = [""] + +def isWin(step): + return step.getProperty('Windows'); + +def isLinux(step): + return step.getProperty('Linux'); + +def isAndroid(step): + return step.getProperty('Android'); + + +def getArrayQtParams(text): + array = text.split('\n') + res = [] + + excludePlugins = ['freetype']; + + for item in array: + index = item.find('/qt') + if index <= -1 : + continue + + item = item.replace(" ", "") + lenngth = item.find('.') + + if (lenngth <= -1): + continue + + + value = "-qt" + item[0: lenngth] + + toContinue = False; + for plugin in excludePlugins : + toContinue = toContinue or (value.find(plugin) >= 0); + + if toContinue : + continue; + + res.append(value) + + + return res + + +@util.renderer +def getHelp(props): + + result = ""; + dirpath = props.getProperty("builddir"); + stdout = subprocess.getoutput([dirpath + '/build/configure -h']) + result = "QT HELP: + \n" + stdout; + + qtDefaultHelp[0] = getArrayQtParams(stdout); + + if (len(qtDefaultHelp[0]) <= 0): + result = "qt help is Empty. stdout= " + stdout; + else: + result += " ".join(qtDefaultHelp[0]); + + return ["echo", result]; + +@util.renderer +def lsLinux(props): + return ["ln", "-sf", LAST_TARGET_DIR[0] + "/bin/qmake", "/home/andrei/.local/bin/qmake-linux"]; + +@util.renderer +def lsWindows(props): + return ["ln", "-sf", LAST_TARGET_DIR[0] + "/bin/qmake", "/home/andrei/.local/bin/qmake-windows"]; + +@util.renderer +def lsAndroid(props): + return ["ln", "-sf", LAST_TARGET_DIR[0] + "/bin/qmake", "/home/andrei/.local/bin/qmake-android"]; + +@util.renderer +def cpGCCWindows(props): + if not isWin(props): + return ['echo', " "] + + resFiles = base.copyRegExp("/usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/*.dll", LAST_TARGET_DIR[0] + "/bin/") + return ['echo', " ".join(resFiles)]; + +@util.renderer +def cpThreadWindows(props): + if not isWin(props): + return ['echo', " "] + + resFiles = base.copyRegExp("/usr/x86_64-w64-mingw32/lib/*.dll", LAST_TARGET_DIR[0] + "/bin/") + return ['echo', " ".join(resFiles)]; + +@util.renderer +def cpIcuLinux(props): + if not isLinux(props): + return ['echo', " "] + + resFiles = base.copyRegExp("/usr/lib/x86_64-linux-gnu/libicu*", LAST_TARGET_DIR[0] + "/lib/") + return ['echo', " ".join(resFiles)]; + +def getGeneralConfigureOptions(props): + list = [ + "-opensource", + "-confirm-license", + "-release", + "-nomake", "examples", + "-nomake", "tests", + "-skip", "qtdocgallery", + "-skip", "qtpim", + "-ccache" + ]; + + list += qtDefaultHelp[0]; + return list; + +def getTargetDir(configureOptions, branch, platform): + + if (not len(branch)) : + branch = "Custom"; + + if (not len(platform)) : + branch = "Unknown"; + + LAST_TARGET_DIR[0] = "/home/andrei/Qt/Qt-" + branch + "/" + platform; + return ["-prefix", LAST_TARGET_DIR[0]]; + +@util.renderer +def getLinuxConfigOptions(props): + list = ['-fontconfig']; + list += getGeneralConfigureOptions(props); + list += getTargetDir(list, props.getProperty('branch'), "Linux"); + + return ["./configure"] + list; + + +@util.renderer +def getWindowsConfigOptions(props): + list = [ + "-skip", "qtactiveqt", + "-skip", "qtwebglplugin", + "-skip", "qtlocation", + "-skip", "qtvirtualkeyboard", + "-skip", "qtwinextras", + "-skip", "qtactiveqt", + "-opengl", "desktop", + "-xplatform","win32-g++", + "-device-option", "CROSS_COMPILE=x86_64-w64-mingw32-", + + ]; + + list += getGeneralConfigureOptions(props); + list += getTargetDir(list, props.getProperty('branch'), "Windows"); + + return ["./configure"] + list; + +@util.renderer +def getAndroidConfigOptions(props): + + list = [ + "-xplatform", "android-clang", + "--disable-rpath", + "-android-ndk", "/home/andrei/Android/NDK/android-ndk-r19c", + "-android-sdk", "/home/andrei/Android/SDK", + "-skip", "qttranslations", + "-skip", "qtserialport", + "-no-warnings-are-errors", + "-android-arch","arm64-v8a" + ]; + + list += getGeneralConfigureOptions(props); + list += getTargetDir(list, props.getProperty('branch'), "Android"); + + return ["./configure"] + list; + + +def windowsSteps(): + + list = [ + steps.ShellCommand( + command = ['git', 'clean', '-xdf'], + doStepIf = lambda step : isWin(step), + + name = 'clean for Windows', + description = 'clean old build data', + ), + steps.ShellCommand( + command = ['git', 'submodule', 'foreach', '--recursive', 'git', 'clean', '-xdf'], + doStepIf = lambda step :isWin(step), + + name = 'clean submodule for Windows', + description = 'clean submodule old build data', + ), + steps.ShellCommand( + command = getWindowsConfigOptions, + haltOnFailure = True, + doStepIf = lambda step : isWin(step), + + name = 'configure Windows', + description = 'create a make files for projects', + ), + steps.Compile( + command = base.makeCommand, + name = 'Build Qt for Windows', + haltOnFailure = True, + doStepIf = lambda step : isWin(step), + + description = 'run make for project', + ), + + steps.Compile( + command = ['make', 'install', '-j2'], + name = 'Install Qt for Windows', + haltOnFailure = True, + doStepIf = lambda step : isWin(step), + + description = 'run make for project', + ), + + steps.ShellCommand( + command = cpGCCWindows, + haltOnFailure = True, + doStepIf = lambda step : isWin(step), + name = 'Copy gcc libs for Windows', + description = 'Copy extra libs', + ), + + steps.ShellCommand( + command = cpThreadWindows, + haltOnFailure = True, + doStepIf = lambda step : isWin(step), + name = 'Copy thread libs for Windows', + description = 'Copy extra libs', + ), + steps.ShellCommand( + command = lsWindows, + haltOnFailure = True, + doStepIf = lambda step : isWin(step), + name = 'Create ls links for Windows', + description = 'deploy qt', + ), + + ] + + return list; + + +def linuxSteps(): + + list = [ + steps.ShellCommand( + command = ['git', 'clean', '-xdf'], + doStepIf = lambda step : isLinux(step), + name = 'clean for Linux', + description = 'clean old build data', + ), + steps.ShellCommand( + command = ['git', 'submodule', 'foreach', '--recursive', 'git', 'clean', '-xdf'], + doStepIf = lambda step :isLinux(step), + name = 'clean submodule for Linux', + description = 'clean submodule old build data', + ), + steps.ShellCommand( + command = getLinuxConfigOptions, + haltOnFailure = True, + doStepIf = lambda step : isLinux(step), + name = 'configure Linux', + description = 'create a make files for projects', + ), + steps.Compile( + command = base.makeCommand, + name = 'Build Qt for Linux', + haltOnFailure = True, + doStepIf = lambda step : isLinux(step), + + description = 'run make for project', + ), + + steps.Compile( + command = ['make', 'install', '-j2'], + name = 'Install Qt for Linux', + haltOnFailure = True, + doStepIf = lambda step : isLinux(step), + + description = 'run make for project', + ), + + steps.ShellCommand( + command = cpIcuLinux, + haltOnFailure = True, + doStepIf = lambda step : isLinux(step), + name = 'Copy ICU libs for Linux', + description = 'Copy extra libs', + ), + + steps.ShellCommand( + command = lsLinux, + haltOnFailure = True, + doStepIf = lambda step : isLinux(step), + name = 'Create ls links for Linux', + description = 'deploy qt', + ), + + ] + + return list; + + +def androidSteps(): + + list = [ + steps.ShellCommand( + command = ['git', 'clean', '-xdf'], + doStepIf = lambda step : isAndroid(step), + name = 'clean for Android', + description = 'clean old build data', + ), + steps.ShellCommand( + command = ['git', 'submodule', 'foreach', '--recursive', 'git', 'clean', '-xdf'], + doStepIf = lambda step :isAndroid(step), + name = 'clean submodule for Android', + description = 'clean submodule old build data', + ), + steps.ShellCommand( + command = getAndroidConfigOptions, + haltOnFailure = True, + doStepIf = lambda step : isAndroid(step), + name = 'configure Android', + description = 'create a make files for projects', + ), + steps.Compile( + command = base.makeCommand, + name = 'Build Qt for Android', + haltOnFailure = True, + doStepIf = lambda step : isAndroid(step), + + description = 'run make for project', + ), + + steps.Compile( + command = ['make', 'install', '-j2'], + name = 'Install Qt for Android', + haltOnFailure = True, + doStepIf = lambda step : isAndroid(step), + + description = 'run make for project', + ), + steps.ShellCommand( + command = lsAndroid, + haltOnFailure = True, + doStepIf = lambda step : isAndroid(step), + name = 'Create ls links for Android', + description = 'deploy qt', + ), + + ] + + return list; + +def getFactory(): + factory = base.getFactory(); + + factory.addStep( + steps.Git( + repourl="https://github.com/qt/qt5.git", + branch=util.Interpolate('%(prop:branch)s'), + mode='full', + method = 'fresh', + submodules=True, + name = 'git operations', + description = 'operations of git like pull clone fetch', + ) + ); + + factory.addStep( + steps.ShellCommand( + command= getHelp, + name = 'read help', + haltOnFailure = True, + description = 'read help for generate the configure command', + ) + ); + + factory.addSteps(linuxSteps()); + factory.addSteps(windowsSteps()); + factory.addSteps(androidSteps()); + + return factory + +def getRepo(): + return ""; + +def getPropertyes(): + return [ + util.BooleanParameter( + name = 'Windows', + label = 'Windows version Qt', + default = True + ), + + util.BooleanParameter( + name = 'Linux', + label = 'Linux version Qt', + default = True + ), + + util.BooleanParameter( + name = 'Android', + label = 'Android version Qt', + default = True + ) + ] diff --git a/BuildBotLib/quasarAppCoin.py b/BuildBotLib/quasarAppCoin.py new file mode 100644 index 0000000..8d4fb64 --- /dev/null +++ b/BuildBotLib/quasarAppCoin.py @@ -0,0 +1,44 @@ +# This Python file uses the following encoding: utf-8 + +import BuildBotLib.basemodule as base +from buildbot.plugins import util, steps + + +def getFactory(): + factory = base.getFactory(); + + list = [ + steps.Git( + repourl='https://github.com/QuasarApp/quasarAppCoin.git', + branch=util.Interpolate('%(prop:Branch)s'), + mode='incremental', + submodules=True + ), + steps.ShellCommand( + command= ['qmake'], + ), + steps.ShellCommand( + command= ['make', 'deploy'], + ), + steps.CopyDirectory( + src="build/Distro", + dest="~/shared/quasarAppCoin/" + ) + + ] + + factory.addSteps(list); + + return factory + +def getRepo(): + return "https://github.com/QuasarApp/quasarAppCoin.git"; + +def getPropertyes(): + return [ + util.StringParameter( + name = 'Branch', + label = 'Branch of project', + default = 'master', + ) + ] diff --git a/BuildBotLib/stepsLib.py b/BuildBotLib/stepsLib.py new file mode 100644 index 0000000..4112a53 --- /dev/null +++ b/BuildBotLib/stepsLib.py @@ -0,0 +1,3 @@ +import sys +from buildbot.plugins import util +from buildbot.plugins.steps import * diff --git a/BuildBotLib/testmodule.py b/BuildBotLib/testmodule.py new file mode 100644 index 0000000..b3c7c40 --- /dev/null +++ b/BuildBotLib/testmodule.py @@ -0,0 +1,18 @@ +# This Python file uses the following encoding: utf-8 + +import BuildBotLib.basemodule as base +from buildbot.plugins import util, steps + +def getFactory(): + factory = base.getFactory(); + + factory.addStep(steps.Git(repourl='git://github.com/buildbot/hello-world.git', mode='incremental')); + factory.addStep(steps.ShellCommand(command=["trial", "hello"], + env={"PYTHONPATH": "."})); + return factory + +def getRepo(): + return "git://github.com/buildbot/hello-world.git"; + +def getPropertyes(): + return [] diff --git a/README.md b/README.md index 065b8de..3cb01c8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# QuasarAppCI +# buildServer buildBot server of quasarapp diff --git a/master.cfg b/master.cfg new file mode 100644 index 0000000..49b63f5 --- /dev/null +++ b/master.cfg @@ -0,0 +1,21 @@ +# -*- python -*- +# ex: set filetype=python: + +from buildbot.plugins import * +from BuildBotLib.buildbot import * +from buildbot.www import authz, auth + +# This is a sample buildmaster config file. It must be installed as +# 'master.cfg' in your buildmaster's base directory. + +# This is the dictionary that the buildmaster pays attention to. We also use +# a shorter alias to save typing. + + +bot = BuildBot(); +bot.addBuilder("github-worker", "qmake"); +bot.addBuilder("Tester", "qmake"); +bot.addBuilder("qtBuilder", "qtUpdater"); + +c = BuildmasterConfig = bot.getMaster() +