added separate builders

This commit is contained in:
Andrei Yankovich 2020-01-31 14:55:49 +03:00
parent f3372b9d41
commit 68fe5db62d
8 changed files with 98 additions and 74 deletions

View File

@ -0,0 +1,46 @@
# This Python file uses the following encoding: utf-8
from BuildBotLib.qmake import QMake
from BuildBotLib.secretManager import SecretManager
class CrossplatformQmake (QMake):
def __init__(self, platform):
QMake.__init__(self, platform)
def linuxXmakeCmd(self, props):
command = [
'qmake-linux',
"-r",
"CONFIG+=qtquickcompiler",
'ONLINE="~/repo"'
]
return command
def windowsXmakeCmd(self, props):
command = [
'qmake-windows',
'-spec', 'win32-g++',
"-r",
"CONFIG+=qtquickcompiler",
'ONLINE="~/repo"'
]
return command
def androidXmakeCmd(self, props):
secret = SecretManager(self.home + "/buildBotSecret/secret.json")
command = [
'qmake-android',
'-spec', 'android-clang',
"-r",
"CONFIG+=qtquickcompiler",
'SIGN_PATH="' + secret.getValue('SIGPATH') + '"',
'SIGN_ALIES="quasarapp"',
'SIGN_STORE_PASSWORD="' + secret.getValue('SIGPASS') + '"'
]
return command

View File

@ -8,18 +8,23 @@ from pathlib import Path
class BaseModule: class BaseModule:
def __init__(self): P_Windows = 'Windows'
P_Linux = 'Linux'
P_Android = 'Android'
def __init__(self, platform):
self.MULTIPLE_SH_COMMAND = ["/bin/bash", "-c"] self.MULTIPLE_SH_COMMAND = ["/bin/bash", "-c"]
self.home = str(Path.home()) self.home = str(Path.home())
self.platform = platform
def isWin(self, step): def isWin(self, step):
return step.getProperty('Windows') return self.platform == BaseModule.P_Windows
def isLinux(self, step): def isLinux(self, step):
return step.getProperty('Linux') return self.platform == BaseModule.P_Linux
def isAndroid(self, step): def isAndroid(self, step):
return step.getProperty('Android') return self.platform == BaseModule.P_Android
def generateCmd(self, bashString): def generateCmd(self, bashString):
@ -47,23 +52,6 @@ class BaseModule:
def getPropertyes(self): def getPropertyes(self):
return [ 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
),
] ]
def copyRegExp(self, source, dist): def copyRegExp(self, source, dist):

View File

@ -26,9 +26,12 @@ class BuildBotShedulers(BuildBotModule):
self.masterConf['schedulers'] = self.shedulers + [ self.masterConf['schedulers'] = self.shedulers + [
schedulers.AnyBranchScheduler( schedulers.AnyBranchScheduler(
name='github-tester', name='github',
change_filter=util.ChangeFilter(project_re="qmake-*"), change_filter=util.ChangeFilter(project_re="qmake-*"),
builderNames=['github-tester'], builderNames=['LinuxBuilder',
'AndroidBuilder',
'WindowBuilder',
],
properties={ properties={
'clean': True, 'clean': True,
'test': True, 'test': True,

View File

@ -2,6 +2,7 @@
from BuildBotLib.buildBotModule import BuildBotModule from BuildBotLib.buildBotModule import BuildBotModule
from buildbot.plugins import worker from buildbot.plugins import worker
from BuildBotLib.secretManager import SecretManager
class BuildBotWorkers(BuildBotModule): class BuildBotWorkers(BuildBotModule):
@ -14,13 +15,14 @@ class BuildBotWorkers(BuildBotModule):
# a Worker object, specifying a unique worker # a Worker object, specifying a unique worker
# name and password. The same # name and password. The same
# worker name and password must be configured on the worker. # worker name and password must be configured on the worker.
self.masterConf['workers'] = [ secret = SecretManager(self.home + "/buildBotSecret/secret.json")
worker.Worker("github-worker", "pass"),
worker.Worker("github-tester", "pass"),
worker.Worker("qtBuilder", "pass"),
worker.Worker("NPM", "pass"),
worker.Worker("assets-builder", "pass")
password = secret.getValue('WorkerPass')
self.masterConf['workers'] = [
worker.Worker("AndroidBuilder", password),
worker.Worker("LinuxBuilder", password),
worker.Worker("WindowBuilder", password),
] ]
# 'protocols' contains information # 'protocols' contains information

View File

@ -11,8 +11,8 @@ from BuildBotLib.secretManager import *
class CMake(Make): class CMake(Make):
def __init__(self): def __init__(self, platform):
Make.__init__(self); Make.__init__(self, platform);
def linuxXmakeCmd(self, props): def linuxXmakeCmd(self, props):
secret = SecretManager(self.home + "/buildBotSecret/secret.json") secret = SecretManager(self.home + "/buildBotSecret/secret.json")

View File

@ -8,8 +8,8 @@ from BuildBotLib.secretManager import SecretManager
class Make(BaseModule): class Make(BaseModule):
def __init__(self): def __init__(self, platform):
BaseModule.__init__(self) BaseModule.__init__(self, platform)
def isClean(self, step): def isClean(self, step):
return step.getProperty('clean') return step.getProperty('clean')
@ -90,25 +90,19 @@ class Make(BaseModule):
def generateStep(self, cmd, platform, desc, checkFunc): def generateStep(self, cmd, platform, desc, checkFunc):
platformCgek = {
'linux': self.isLinux,
'windows': self.isWin,
'android': self.isAndroid,
}
@util.renderer @util.renderer
def envWraper(step): def envWraper(step):
platformEnv = { platformEnv = {
'linux': self.linuxXmakeEnv, BaseModule.P_Linux: self.linuxXmakeEnv,
'windows': self.windowsXmakeEnv, BaseModule.P_Windows: self.windowsXmakeEnv,
'android': self.androidXmakeEnv, BaseModule.P_Android: self.androidXmakeEnv,
} }
return platformEnv[platform](step) return platformEnv[platform](step)
def dustepIf(step): def dustepIf(step):
return checkFunc(step) and platformCgek[platform](step) return checkFunc(step)
res = steps.Compile( res = steps.Compile(
command=self.getWraper(cmd), command=self.getWraper(cmd),
@ -126,9 +120,9 @@ class Make(BaseModule):
def generatePlatformSteps(self, platform): def generatePlatformSteps(self, platform):
platformXcmd = { platformXcmd = {
'linux': self.linuxXmakeCmd, BaseModule.P_Linux: self.linuxXmakeCmd,
'windows': self.windowsXmakeCmd, BaseModule.P_Windows: self.windowsXmakeCmd,
'android': self.androidXmakeCmd, BaseModule.P_Android: self.androidXmakeCmd,
} }
res = [] res = []
@ -185,9 +179,7 @@ class Make(BaseModule):
) )
) )
factory.addSteps(self.generatePlatformSteps('linux')) factory.addSteps(self.generatePlatformSteps(self.platform))
factory.addSteps(self.generatePlatformSteps('windows'))
factory.addSteps(self.generatePlatformSteps('android'))
factory.addStep( factory.addStep(
steps.DirectoryUpload( steps.DirectoryUpload(

View File

@ -6,12 +6,15 @@ from BuildBotLib.secretManager import SecretManager
class QMake(Make): class QMake(Make):
def __init__(self): def __init__(self, platform):
Make.__init__(self) Make.__init__(self)
def linuxXmakeCmd(self, props): def makePrefix(self):
return "Q"
def mainCmd(self):
command = [ command = [
'qmake-linux', 'qmake',
"-r", "-r",
"CONFIG+=qtquickcompiler", "CONFIG+=qtquickcompiler",
'ONLINE="~/repo"' 'ONLINE="~/repo"'
@ -19,22 +22,17 @@ class QMake(Make):
return command return command
def linuxXmakeCmd(self, props):
return self.mainCmd()
def windowsXmakeCmd(self, props): def windowsXmakeCmd(self, props):
command = [ return self.mainCmd()
'qmake-windows',
'-spec', 'win32-g++',
"-r",
"CONFIG+=qtquickcompiler",
'ONLINE="~/repo"'
]
return command
def androidXmakeCmd(self, props): def androidXmakeCmd(self, props):
secret = SecretManager(self.home + "/buildBotSecret/secret.json") secret = SecretManager(self.home + "/buildBotSecret/secret.json")
command = [ command = [
'qmake-android', 'qmake',
'-spec', 'android-clang', '-spec', 'android-clang',
"-r", "-r",
"CONFIG+=qtquickcompiler", "CONFIG+=qtquickcompiler",
@ -45,8 +43,3 @@ class QMake(Make):
] ]
return command return command
def androidXmakeEnv(self, props):
return {'ANDROID_NDK_ROOT': self.home + '/Android/ndk-bundle',
'JAVA_HOME': '/usr',
'ANDROID_HOME': self.home + '/Android'}

View File

@ -8,6 +8,7 @@ from BuildBotLib.cmake import CMake
from BuildBotLib.qmake import QMake from BuildBotLib.qmake import QMake
from BuildBotLib.asssetsinstaller import AsssetsInstaller from BuildBotLib.asssetsinstaller import AsssetsInstaller
from BuildBotLib.qtUpdater import QtUpdater from BuildBotLib.qtUpdater import QtUpdater
from BuildBotLib.basemodule import BaseModule
# This is a sample buildmaster config file. It must be installed as # This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory. # 'master.cfg' in your buildmaster's base directory.
@ -18,14 +19,13 @@ from BuildBotLib.qtUpdater import QtUpdater
bot = BuildBot() bot = BuildBot()
qmake = QMake() qmakeLinux = QMake(BaseModule.P_Linux)
asssetsinstaller = AsssetsInstaller() qmakeWindows = QMake(BaseModule.P_Windows)
qtUpdater = QtUpdater() qmakeAndroid = QMake(BaseModule.P_Android)
bot.addBuilder("github-worker", qmake) bot.addBuilder("LinuxBuilder", qmakeLinux)
bot.addBuilder("github-tester", qmake) bot.addBuilder("WindowBuilder", qmakeWindows)
bot.addBuilder("qtBuilder", qtUpdater) bot.addBuilder("AndroidBuilder", qmakeAndroid)
bot.addBuilder("assets-builder", asssetsinstaller)
c = BuildmasterConfig = bot.getMaster() c = BuildmasterConfig = bot.getMaster()