4
0
mirror of https://github.com/QuasarApp/QuasarAppCI.git synced 2025-05-09 03:39:34 +00:00

first step of refactor

This commit is contained in:
Andrei Yankovich 2019-10-06 19:15:02 +03:00
parent a096fd6379
commit 1f297f4907
8 changed files with 398 additions and 954 deletions

@ -7,6 +7,7 @@
"testmodule.py",
"qmake.py",
"cmake.py",
"make.py",
"stepsLib.py",
"quasarAppCoin.py",
"buildBotWorkers.py",

@ -4,32 +4,36 @@ import multiprocessing
import glob
import shutil
def getFactory():
return util.BuildFactory()
class BaseModule:
def __init__(self):
self;
def getRepo():
return "";
def getFactory(self):
return util.BuildFactory()
def getPropertyes():
return []
def getRepo(self):
return "";
@util.renderer
def makeCommand(props):
command = ['make']
cpus = multiprocessing.cpu_count()
def getPropertyes(self):
return []
if cpus:
command.extend(['-j', str(cpus)])
else:
command.extend(['-j', '1'])
return command
def copyRegExp(self, source, dist):
def copyRegExp(source, dist):
res = []
res = []
for file in glob.glob(source):
res.append(file)
shutil.copy(file, dist)
for file in glob.glob(source):
res.append(file)
shutil.copy(file, dist)
return res;
return res;
@util.renderer
def makeCommand(self, props):
command = ['make']
cpus = multiprocessing.cpu_count()
if cpus:
command.extend(['-j', str(cpus)])
else:
command.extend(['-j', '1'])
return command

@ -2,7 +2,6 @@ from buildbot.plugins import util
import logging
import importlib
import sys
from BuildBotLib.testmodule import *
import os
from buildbot.changes.gitpoller import GitPoller
@ -27,9 +26,9 @@ class BuildBot:
builders = []
def importWithReload(self, name):
module = importlib.import_module(name);
return module;
# def importWithReload(self, name):
# module = importlib.import_module(name);
# return module;
def __init__(self):
self.masterConf = BuildmasterConfig = {}
@ -54,15 +53,15 @@ class BuildBot:
def addBuilder(self, worker, factory):
module = self.importWithReload(factory);
# module = self.importWithReload(factory);
self.masterConf['builders'].append(
util.BuilderConfig(
name = worker,
workernames = [worker],
factory = module.getFactory()
factory = factory.getFactory()
)
)
self.shedulers.addScheduler(module.getPropertyes(), worker)
self.shedulers.addScheduler(factory.getPropertyes(), worker)
self.builders.append(worker);

@ -1,6 +1,6 @@
# This Python file uses the following encoding: utf-8
import BuildBotLib.basemodule as base
import BuildBotLib.make as Make
from buildbot.plugins import secrets, util, steps
from pathlib import Path
import datetime
@ -8,367 +8,62 @@ import os
import subprocess
from BuildBotLib.secretManager import *
def isClean(step):
return step.getProperty('clean');
def isDeploy(step):
return step.getProperty('deploy');
class QMake(Make):
def __init__(self):
Make.__init__(self);
def isRelease(step):
return step.getProperty('release');
@util.renderer
def linuxXmakeCmd(self, props):
secret = SecretManager("/home/andrei/buildBotSecret/secret.json")
QT_Dir = subprocess.getoutput(['qmake-android -query QT_HOST_PREFIX'])
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');
def destDirPrivate(props):
repo = str(props.getProperty('repository'));
now = datetime.datetime.now().strftime("(%H_%M)_%m-%d-%Y")
return repo[repo.rfind('/'): len(repo) - 4] + "/" + now;
@util.renderer
def destDir(props):
home = str(Path.home())
return home + '/shared/' + destDirPrivate(props);
@util.renderer
def destDirUrl(props):
path = destDirPrivate(props);
return "http://quasarapp.ddns.net:3031" + path;
@util.renderer
def permission(props):
home = str(Path.home())
return ["chmod", "-R", "775", home + '/shared']
@util.renderer
def androidCmake(props):
secret = SecretManager("/home/andrei/buildBotSecret/secret.json")
QT_Dir = subprocess.getoutput(['qmake-android -query QT_HOST_PREFIX'])
command = [
'cmake', '-DCMAKE_PREFIX_PATH=' + QT_Dir,
'-DSPEC_X=android-clang',
'-DSIGN_PATH="' + secret.getValue('SIGPATH') + '"',
'-DSIGN_ALIES="quasarapp"',
'-DSIGN_STORE_PASSWORD="' + secret.getValue('SIGPASS') + '"'
]
return command
@util.renderer
def windowsCmake(props):
secret = SecretManager("/home/andrei/buildBotSecret/secret.json")
QT_Dir = subprocess.getoutput(['qmake-android -query QT_HOST_PREFIX'])
command = [
'cmake', '-DCMAKE_PREFIX_PATH=' + QT_Dir,
'-DSPEC_X=win64-g++',
'-DSIGN_PATH="' + secret.getValue('SIGPATH') + '"',
'-DSIGN_ALIES="quasarapp"',
'-DSIGN_STORE_PASSWORD="' + secret.getValue('SIGPASS') + '"'
]
return command
@util.renderer
def linuxCmake(props):
secret = SecretManager("/home/andrei/buildBotSecret/secret.json")
QT_Dir = subprocess.getoutput(['qmake-android -query QT_HOST_PREFIX'])
command = [
'cmake', '-DCMAKE_PREFIX_PATH=' + QT_Dir,
'-DSPEC_X=linux-g++',
'-DSIGN_PATH="' + secret.getValue('SIGPATH') + '"',
'-DSIGN_ALIES="quasarapp"',
'-DSIGN_STORE_PASSWORD="' + secret.getValue('SIGPASS') + '"'
]
return command
def LinuxSteps() :
list = [
steps.ShellCommand(
command = [
'qmake-linux',
"-r",
"CONFIG+=qtquickcompiler",
'ONLINE="~/repo"'
],
haltOnFailure = True,
doStepIf = lambda step : isLinux(step),
'cmake', '-DCMAKE_PREFIX_PATH=' + QT_Dir,
'-DSPEC_X=linux-g++',
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),
'-DSIGN_PATH="' + secret.getValue('SIGPATH') + '"',
'-DSIGN_ALIES="quasarapp"',
'-DSIGN_STORE_PASSWORD="' + secret.getValue('SIGPASS') + '"'
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 command
]
@util.renderer
def windowsXmakeCmd(self, props):
secret = SecretManager("/home/andrei/buildBotSecret/secret.json")
return list;
QT_Dir = subprocess.getoutput(['qmake-android -query QT_HOST_PREFIX'])
def AndroidSteps() :
list = [
steps.ShellCommand(
command = androidQmake,
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++',
"-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),
'cmake', '-DCMAKE_PREFIX_PATH=' + QT_Dir,
'-DSPEC_X=win64-g++',
description = 'run make for project',
),
steps.ShellCommand(
command= ['make', 'deploy'],
doStepIf = lambda step : isDeploy(step) and isWin(step),
name = 'deploy Windows',
haltOnFailure = True,
'-DSIGN_PATH="' + secret.getValue('SIGPATH') + '"',
'-DSIGN_ALIES="quasarapp"',
'-DSIGN_STORE_PASSWORD="' + secret.getValue('SIGPASS') + '"'
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;
return command
@util.renderer
def androidXmakeCmd(self, props):
secret = SecretManager("/home/andrei/buildBotSecret/secret.json")
def getFactory():
factory = base.getFactory();
QT_Dir = subprocess.getoutput(['qmake-android -query QT_HOST_PREFIX'])
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',
)
);
command = [
'cmake', '-DCMAKE_PREFIX_PATH=' + QT_Dir,
'-DSPEC_X=android-clang',
factory.addSteps(LinuxSteps());
factory.addSteps(WinSteps());
factory.addSteps(AndroidSteps());
'-DSIGN_PATH="' + secret.getValue('SIGPATH') + '"',
'-DSIGN_ALIES="quasarapp"',
'-DSIGN_STORE_PASSWORD="' + secret.getValue('SIGPASS') + '"'
factory.addStep(
steps.DirectoryUpload(
workersrc = util.Interpolate('%(prop:copyFolder)s'),
masterdest = destDir,
url = destDirUrl,
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"
),
]
return command

@ -1,6 +1,7 @@
# This Python file uses the following encoding: utf-8
import BuildBotLib.basemodule as base
import BuildBotLib.basemodule as BaseModule
from buildbot.plugins import secrets, util, steps
from pathlib import Path
import datetime
@ -8,298 +9,337 @@ import os
import subprocess
from BuildBotLib.secretManager import *
def isClean(step):
return step.getProperty('clean');
def isDeploy(step):
return step.getProperty('deploy');
class Make(BaseModule):
def __init__(self):
BaseModule.__init__(self);
def isRelease(step):
return step.getProperty('release');
def isTest(step):
return step.getProperty('test');
def isClean(self, step):
return step.getProperty('clean');
def isWin(step):
return step.getProperty('Windows');
def isDeploy(self, step):
return step.getProperty('deploy');
def isLinux(step):
return step.getProperty('Linux');
def isRelease(self, step):
return step.getProperty('release');
def isAndroid(step):
return step.getProperty('Android');
def isTest(self, step):
return step.getProperty('test');
def destDirPrivate(props):
repo = str(props.getProperty('repository'));
now = datetime.datetime.now().strftime("(%H_%M)_%m-%d-%Y")
def isWin(self, step):
return step.getProperty('Windows');
return repo[repo.rfind('/'): len(repo) - 4] + "/" + now;
def isLinux(self, step):
return step.getProperty('Linux');
@util.renderer
def destDir(props):
home = str(Path.home())
def isAndroid(self, step):
return step.getProperty('Android');
return home + '/shared/' + destDirPrivate(props);
def destDirPrivate(self, props):
repo = str(props.getProperty('repository'));
now = datetime.datetime.now().strftime("(%H_%M)_%m-%d-%Y")
@util.renderer
def destDirUrl(props):
path = destDirPrivate(props);
return "http://quasarapp.ddns.net:3031" + path;
return repo[repo.rfind('/'): len(repo) - 4] + "/" + now;
@util.renderer
def permission(props):
home = str(Path.home())
return ["chmod", "-R", "775", home + '/shared']
@util.renderer
def destDir(self, props):
home = str(Path.home())
def LinuxXMake() :
return home + '/shared/' + destDirPrivate(props);
return steps.ShellCommand(
@util.renderer
def destDirUrl(self, props):
path = destDirPrivate(props);
return "http://quasarapp.ddns.net:3031" + path;
@util.renderer
def permission(self, props):
home = str(Path.home())
return ["chmod", "-R", "775", home + '/shared']
@util.renderer
def linuxXmakeCmd(self, props):
command = [
'qmake-linux',
"-r",
"CONFIG+=qtquickcompiler",
'ONLINE="~/repo"'
],
haltOnFailure = True,
doStepIf = lambda step : isLinux(step),
];
name = 'QMake Linux',
description = 'create a make files for projects',
)
return command;
def WindowsXMake() :
@util.renderer
def windowsXmakeCmd(self, props):
command = [
'qmake-windows',
'-spec', 'win32-g++',
"-r",
"CONFIG+=qtquickcompiler",
'ONLINE="~/repo"'
];
return steps.ShellCommand(
command = [
'qmake-windows',
'-spec', 'win32-g++',
"-r",
"CONFIG+=qtquickcompiler",
'ONLINE="~/repo"'
],
return command;
@util.renderer
def androidXmakeCmd(self, props):
secret = SecretManager("/home/andrei/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;
def LinuxSteps(self) :
list = [
steps.ShellCommand(
command = self.linuxXmakeCmd ,
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 : self.isClean(step) and self.isLinux(step),
name = 'clean Linux',
description = 'clean old build data',
),
steps.Compile(
command = self.makeCommand,
name = 'Build Linux',
doStepIf = lambda step : self.isLinux(step),
haltOnFailure = True,
description = 'run make for project',
),
steps.ShellCommand(
command= ['make', 'deploy'],
doStepIf = lambda step : self.isDeploy(step) and self.isLinux(step),
name = 'deploy Linux',
haltOnFailure = True,
description = 'deploy project ',
),
steps.Compile(
command= ['make', 'test'],
doStepIf = lambda step : self.isTest(step) and self.isLinux(step),
name = 'tests ',
haltOnFailure = True,
description = 'run autotests of project',
),
steps.ShellCommand(
command= ['make', 'release'],
doStepIf = lambda step : self.isRelease(step) and self.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 : self.isLinux(step),
name = 'clean Linux makefiles',
description = 'clean old makefiles ',
),
]
return list;
def AndroidSteps(self) :
list = [
steps.ShellCommand(
command = androidQmake,
haltOnFailure = True,
doStepIf = lambda step : self.isAndroid(step),
name = 'QMake Android',
description = 'create a make files for projects',
),
steps.ShellCommand(
command = ['make', 'clean'],
doStepIf = lambda step : self.isClean(step) and self.isAndroid(step),
name = 'clean Android',
description = 'clean old build data',
),
steps.Compile(
command = self.makeCommand,
name = 'Build Android',
doStepIf = lambda step : self.isAndroid(step),
haltOnFailure = True,
description = 'run make for project',
),
steps.ShellCommand(
command= ['make', 'deploy'],
doStepIf = lambda step : self.isDeploy(step) and self.isAndroid(step),
name = 'deploy Android',
haltOnFailure = True,
description = 'deploy project ',
),
steps.ShellCommand(
command= ['make', 'release'],
doStepIf = lambda step : self.isRelease(step) and self.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 : self.isAndroid(step),
name = 'clean Android makefiles',
description = 'clean old makefiles ',
),
]
return list;
def WinSteps(self) :
list = [
steps.ShellCommand(
command = self.windowsXmakeCmd,
name = 'QMake Windows',
haltOnFailure = True,
doStepIf = lambda step : isWin(step),
description = 'create a make files for projects',
)
@util.renderer
def androidQmake(props):
secret = SecretManager("/home/andrei/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
def AndroidXMake() :
return steps.ShellCommand(
command = androidQmake,
),
steps.ShellCommand(
command = ['make', 'clean'],
doStepIf = lambda step : self.isClean(step) and self.isWin(step),
name = 'clean Windows',
description = 'clean old build data',
),
steps.Compile(
command = self.makeCommand,
name = 'Build Windows',
haltOnFailure = True,
doStepIf = lambda step : isAndroid(step),
doStepIf = lambda step : self.isWin(step),
name = 'QMake Android',
description = 'create a make files for projects',
description = 'run make for project',
),
steps.ShellCommand(
command= ['make', 'deploy'],
doStepIf = lambda step : self.isDeploy(step) and self.isWin(step),
name = 'deploy Windows',
haltOnFailure = True,
description = 'deploy project ',
),
steps.ShellCommand(
command= ['make', 'release'],
doStepIf = lambda step : self.isRelease(step) and self.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 : self.isWin(step),
name = 'clean Windows makefiles',
description = 'clean old makefiles ',
),
]
return list;
def getFactory(self):
factory = self.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(self.LinuxSteps());
factory.addSteps(self.WinSteps());
factory.addSteps(self.AndroidSteps());
factory.addStep(
steps.DirectoryUpload(
workersrc = util.Interpolate('%(prop:copyFolder)s'),
masterdest = destDir,
url = destDirUrl,
doStepIf = lambda step : self.isDeploy(step),
name = 'copy buildet files',
description = 'copy buildet files to shared folder',
)
);
factory.addStep(
steps.ShellCommand(
command= self.permission,
name = 'set permission',
haltOnFailure = True,
description = 'set permission for shared folder',
)
);
return factory
def LinuxSteps() :
def getPropertyes():
return [
util.BooleanParameter(
name = 'Windows',
label = 'Windows version project',
default = True
),
list = [
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),
util.BooleanParameter(
name = 'Linux',
label = 'Linux version project',
default = True
),
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 ',
),
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"
),
]
return list;
def AndroidSteps() :
list = [
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 = ['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():
return base.getFactory();
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"
),
]
]

@ -1,6 +1,6 @@
# This Python file uses the following encoding: utf-8
import BuildBotLib.basemodule as base
import BuildBotLib.make as Make
from buildbot.plugins import secrets, util, steps
from pathlib import Path
import datetime
@ -8,327 +8,48 @@ import os
import subprocess
from BuildBotLib.secretManager import *
def isClean(step):
return step.getProperty('clean');
def isDeploy(step):
return step.getProperty('deploy');
class QMake(Make):
def __init__(self):
Make.__init__(self);
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');
def destDirPrivate(props):
repo = str(props.getProperty('repository'));
now = datetime.datetime.now().strftime("(%H_%M)_%m-%d-%Y")
return repo[repo.rfind('/'): len(repo) - 4] + "/" + now;
@util.renderer
def destDir(props):
home = str(Path.home())
return home + '/shared/' + destDirPrivate(props);
@util.renderer
def destDirUrl(props):
path = destDirPrivate(props);
return "http://quasarapp.ddns.net:3031" + path;
@util.renderer
def permission(props):
home = str(Path.home())
return ["chmod", "-R", "775", home + '/shared']
def LinuxSteps() :
list = [
steps.ShellCommand(
@util.renderer
def linuxXmakeCmd(self, props):
command = [
'qmake-linux',
"-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),
return command;
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;
@util.renderer
def androidQmake(props):
secret = SecretManager("/home/andrei/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
def AndroidSteps() :
list = [
steps.ShellCommand(
command = androidQmake,
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(
@util.renderer
def windowsXmakeCmd(self, props):
command = [
'qmake-windows',
'-spec', 'win32-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,
return command;
description = 'deploy project ',
),
steps.ShellCommand(
command= ['make', 'release'],
doStepIf = lambda step : isRelease(step) and isWin(step),
name = 'release Windows',
haltOnFailure = True,
@util.renderer
def androidXmakeCmd(self, props):
secret = SecretManager("/home/andrei/buildBotSecret/secret.json")
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;
command = [
'qmake-android',
'-spec', 'android-clang',
"-r",
"CONFIG+=qtquickcompiler",
'SIGN_PATH="' + secret.getValue('SIGPATH') + '"',
'SIGN_ALIES="quasarapp"',
'SIGN_STORE_PASSWORD="' + secret.getValue('SIGPASS') + '"'
];
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.DirectoryUpload(
workersrc = util.Interpolate('%(prop:copyFolder)s'),
masterdest = destDir,
url = destDirUrl,
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"
),
]
return command;

@ -1,18 +0,0 @@
# 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 []

@ -4,6 +4,8 @@
from buildbot.plugins import *
from BuildBotLib.buildbot import *
from buildbot.www import authz, auth
import BuildBotLib.cmake as CMake
import BuildBotLib.qmake as QMake
# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory.