mirror of
https://github.com/QuasarApp/QuasarAppCI.git
synced 2025-04-26 13:54:31 +00:00
init commit
This commit is contained in:
parent
d3130e3460
commit
f4640306b7
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
gitpoller-work/
|
||||
*.tac
|
||||
*.log*
|
||||
*.sqlite
|
||||
*.swp
|
||||
gitpoller-workdir/
|
||||
*.pid
|
||||
*.user
|
||||
*__pycache__*
|
||||
*.pyc
|
20
BuildBotLib/BuildBot.pyproject
Normal file
20
BuildBotLib/BuildBot.pyproject
Normal file
@ -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"
|
||||
]
|
||||
}
|
6
BuildBotLib/README.md
Normal file
6
BuildBotLib/README.md
Normal file
@ -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;
|
35
BuildBotLib/basemodule.py
Normal file
35
BuildBotLib/basemodule.py
Normal file
@ -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;
|
36
BuildBotLib/buildBotChangeSource.py
Normal file
36
BuildBotLib/buildBotChangeSource.py
Normal file
@ -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
|
||||
),
|
||||
]
|
||||
|
14
BuildBotLib/buildBotDB.py
Normal file
14
BuildBotLib/buildBotDB.py
Normal file
@ -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",
|
||||
}
|
42
BuildBotLib/buildBotIdentity.py
Normal file
42
BuildBotLib/buildBotIdentity.py
Normal file
@ -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"))
|
||||
])
|
||||
|
9
BuildBotLib/buildBotModule.py
Normal file
9
BuildBotLib/buildBotModule.py
Normal file
@ -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
|
24
BuildBotLib/buildBotServices.py
Normal file
24
BuildBotLib/buildBotServices.py
Normal file
@ -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)
|
37
BuildBotLib/buildBotShedulers.py
Normal file
37
BuildBotLib/buildBotShedulers.py
Normal file
@ -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();
|
||||
|
29
BuildBotLib/buildBotWorkers.py
Normal file
29
BuildBotLib/buildBotWorkers.py
Normal file
@ -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}}
|
||||
|
95
BuildBotLib/buildbot.py
Normal file
95
BuildBotLib/buildbot.py
Normal file
@ -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
|
317
BuildBotLib/qmake.py
Normal file
317
BuildBotLib/qmake.py
Normal file
@ -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"
|
||||
),
|
||||
|
||||
]
|
443
BuildBotLib/qtUpdater.py
Normal file
443
BuildBotLib/qtUpdater.py
Normal file
@ -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
|
||||
)
|
||||
]
|
44
BuildBotLib/quasarAppCoin.py
Normal file
44
BuildBotLib/quasarAppCoin.py
Normal file
@ -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',
|
||||
)
|
||||
]
|
3
BuildBotLib/stepsLib.py
Normal file
3
BuildBotLib/stepsLib.py
Normal file
@ -0,0 +1,3 @@
|
||||
import sys
|
||||
from buildbot.plugins import util
|
||||
from buildbot.plugins.steps import *
|
18
BuildBotLib/testmodule.py
Normal file
18
BuildBotLib/testmodule.py
Normal file
@ -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 []
|
21
master.cfg
Normal file
21
master.cfg
Normal file
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user