Skip to content

Commit

Permalink
Merge pull request #240 from owncloud/waitForBrowserService
Browse files Browse the repository at this point in the history
[tests-only] Update CI to latest .drone.star
  • Loading branch information
phil-davis authored Oct 28, 2021
2 parents 64a055d + a8af863 commit 77049c5
Showing 1 changed file with 59 additions and 28 deletions.
87 changes: 59 additions & 28 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ dir = {
}

config = {
"app": "twofactor_totp",
"rocketchat": {
"channel": "builds",
"from_secret": "private_rocketchat",
},
"branches": [
"master",
],
"appInstallCommand": "make vendor",
"appInstallCommandPhp": "make vendor",
"codestyle": True,
"phpstan": True,
"javascript": False,
Expand Down Expand Up @@ -259,7 +258,7 @@ def jscodestyle(ctx):
"steps": [
{
"name": "coding-standard-js",
"image": "owncloudci/php:8.0",
"image": "owncloudci/nodejs:14",
"pull": "always",
"commands": [
"make test-js-style",
Expand Down Expand Up @@ -381,7 +380,7 @@ def phpstan(ctx):
"path": "server/apps/%s" % ctx.repo.name,
},
"steps": installCore(ctx, "daily-master-qa", "sqlite", False) +
installApp(ctx, phpVersion) +
installAppPhp(ctx, phpVersion) +
installExtraApps(phpVersion, params["extraApps"]) +
setupServerAndApp(ctx, phpVersion, params["logLevel"], False, params["enableApp"]) +
[
Expand Down Expand Up @@ -626,7 +625,7 @@ def javascript(ctx, withCoverage):
"path": "server/apps/%s" % ctx.repo.name,
},
"steps": installCore(ctx, "daily-master-qa", "sqlite", False) +
installApp(ctx, "7.4") +
installAppJavaScript(ctx) +
setupServerAndApp(ctx, "7.4", params["logLevel"], False, params["enableApp"]) +
params["extraSetup"] +
[
Expand Down Expand Up @@ -798,7 +797,7 @@ def phpTests(ctx, testType, withCoverage):
"path": "server/apps/%s" % ctx.repo.name,
},
"steps": installCore(ctx, "daily-master-qa", db, False) +
installApp(ctx, phpVersion) +
installAppPhp(ctx, phpVersion) +
installExtraApps(phpVersion, params["extraApps"]) +
setupServerAndApp(ctx, phpVersion, params["logLevel"], False, params["enableApp"]) +
setupCeph(params["cephS3"]) +
Expand Down Expand Up @@ -1129,7 +1128,8 @@ def acceptance(ctx):
"steps": installCore(ctx, testConfig["server"], testConfig["database"], testConfig["useBundledApp"]) +
installTestrunner(ctx, "7.4", testConfig["useBundledApp"]) +
(installFederated(testConfig["server"], testConfig["phpVersion"], testConfig["logLevel"], testConfig["database"], federationDbSuffix) + owncloudLog("federated") if testConfig["federatedServerNeeded"] else []) +
installApp(ctx, testConfig["phpVersion"]) +
installAppPhp(ctx, testConfig["phpVersion"]) +
installAppJavaScript(ctx) +
installExtraApps(testConfig["phpVersion"], testConfig["extraApps"]) +
setupServerAndApp(ctx, testConfig["phpVersion"], testConfig["logLevel"], testConfig["federatedServerNeeded"], params["enableApp"]) +
owncloudLog("server") +
Expand All @@ -1138,6 +1138,7 @@ def acceptance(ctx):
setupElasticSearch(testConfig["esVersion"]) +
testConfig["extraSetup"] +
fixPermissions(testConfig["phpVersion"], testConfig["federatedServerNeeded"]) +
waitForBrowserService(testConfig["phpVersion"], isWebUI) +
[
({
"name": "acceptance-tests",
Expand Down Expand Up @@ -1396,6 +1397,18 @@ def browserService(browser):

return []

def waitForBrowserService(phpVersion, isWebUi):
if isWebUi:
return [{
"name": "wait-for-selenium",
"image": "owncloudci/php:%s" % phpVersion,
"pull": "always",
"commands": [
"wait-for-it -t 600 selenium:4444",
],
}]
return []

def emailService(emailNeeded):
if emailNeeded:
return [{
Expand Down Expand Up @@ -1664,35 +1677,53 @@ def installExtraApps(phpVersion, extraApps):
"commands": commandArray,
}]

def installApp(ctx, phpVersion):
if "appInstallCommand" not in config:
def installAppPhp(ctx, phpVersion):
if "appInstallCommandPhp" not in config:
return []

if "buildJsDeps" not in config:
installJsDeps = False
else:
installJsDeps = config["buildJsDeps"]

# config["appInstallCommandPhp"] must be the command that is needed to
# install just the PHP-related part of the app. The docker image has PHP
# and "base" tools. But it does not have JavaScript tools like nodejs,
# npm, yarn etc.
return [
{
"name": "install-app-js-%s" % config["app"],
"image": "owncloudci/nodejs:%s" % getNodeJsVersion(),
"name": "install-app-php-%s" % ctx.repo.name,
"image": "owncloudci/php:%s" % phpVersion,
"pull": "always",
"commands": [
"cd /var/www/owncloud/server/apps/%s" % config["app"],
"make install-js-deps",
"make build-dev",
"cd %s/apps/%s" % (dir["server"], ctx.repo.name),
config["appInstallCommandPhp"],
],
},
] if installJsDeps else [] + [{
"name": "install-app-%s" % ctx.repo.name,
"image": "owncloudci/php:%s" % phpVersion,
"pull": "always",
"commands": [
"cd %s/apps/%s" % (dir["server"], ctx.repo.name),
config["appInstallCommand"],
],
}]
]

def installAppJavaScript(ctx):
nothingToDo = True
commandArray = [
"cd %s/apps/%s" % (dir["server"], ctx.repo.name),
]

if "appInstallCommandJavaScript" in config:
nothingToDo = False
commandArray.append(config["appInstallCommandJavaScript"])

if "buildJsDeps" in config:
if config["buildJsDeps"]:
nothingToDo = False
commandArray.append("make install-js-deps")
commandArray.append("make build-dev")

if (nothingToDo):
return []

return [
{
"name": "install-app-js-%s" % ctx.repo.name,
"image": "owncloudci/nodejs:%s" % getNodeJsVersion(),
"pull": "always",
"commands": commandArray,
},
]

def setupServerAndApp(ctx, phpVersion, logLevel, federatedServerNeeded = False, enableApp = True):
return [{
Expand Down

0 comments on commit 77049c5

Please sign in to comment.