Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only] Update .drone.star from activity app #397

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 109 additions & 34 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,16 @@ config = {
"branches": [
"master",
],
"codestyle": {
"ordinary": {
"phpVersions": [
"7.2",
"7.3",
"7.4",
],
},
},
"codestyle": True,
"javascript": True,
"phpunit": {
"allDatabases": {
"phpVersions": [
"7.2",
"7.3",
],
},
"reducedDatabases": {
"phpVersions": [
"7.3",
"7.4",
],
"databases": [
Expand All @@ -44,12 +35,11 @@ config = {
"phpintegration": {
"allDatabases": {
"phpVersions": [
"7.2",
"7.3",
],
},
"reducedDatabases": {
"phpVersions": [
"7.3",
"7.4",
],
"databases": [
Expand Down Expand Up @@ -97,7 +87,7 @@ def main(ctx):
return before + coverageTests + afterCoverageTests + nonCoverageTests + stages + after

def beforePipelines(ctx):
return codestyle(ctx) + jscodestyle(ctx) + checkForRecentBuilds(ctx) + phpstan(ctx) + phan(ctx) + checkStarlark()
return codestyle(ctx) + jscodestyle(ctx) + checkForRecentBuilds(ctx) + phpstan(ctx) + phan(ctx) + phplint(ctx) + checkStarlark()

def coveragePipelines(ctx):
# All unit test pipelines that have coverage or other test analysis reported
Expand Down Expand Up @@ -144,7 +134,7 @@ def codestyle(ctx):
return pipelines

default = {
"phpVersions": ["7.2"],
"phpVersions": ["7.3"],
}

if "defaults" in config:
Expand Down Expand Up @@ -309,9 +299,10 @@ def phpstan(ctx):
return pipelines

default = {
"phpVersions": ["7.2"],
"phpVersions": ["7.3"],
"logLevel": "2",
"extraApps": {},
"enableApp": True,
}

if "defaults" in config:
Expand Down Expand Up @@ -351,7 +342,7 @@ def phpstan(ctx):
"steps": installCore(ctx, "daily-master-qa", "sqlite", False) +
installApp(ctx, phpVersion) +
installExtraApps(phpVersion, params["extraApps"]) +
setupServerAndApp(ctx, phpVersion, params["logLevel"]) +
setupServerAndApp(ctx, phpVersion, params["logLevel"], False, params["enableApp"]) +
[
{
"name": "phpstan",
Expand Down Expand Up @@ -385,7 +376,7 @@ def phan(ctx):
return pipelines

default = {
"phpVersions": ["7.2", "7.3", "7.4"],
"phpVersions": ["7.3", "7.4"],
}

if "defaults" in config:
Expand Down Expand Up @@ -456,7 +447,7 @@ def build(ctx):
return pipelines

default = {
"phpVersions": ["7.2"],
"phpVersions": ["7.3"],
"commands": [
"make dist",
],
Expand Down Expand Up @@ -553,6 +544,7 @@ def javascript(ctx, withCoverage):
"extraCommandsBeforeTestRun": [],
"extraTeardown": [],
"skip": False,
"enableApp": True,
}

if "defaults" in config:
Expand Down Expand Up @@ -594,12 +586,12 @@ def javascript(ctx, withCoverage):
},
"steps": installCore(ctx, "daily-master-qa", "sqlite", False) +
installApp(ctx, "7.4") +
setupServerAndApp(ctx, "7.4", params["logLevel"]) +
setupServerAndApp(ctx, "7.4", params["logLevel"], False, params["enableApp"]) +
params["extraSetup"] +
[
{
"name": "js-tests",
"image": "owncloudci/php:8.0",
"image": "owncloudci/nodejs:%s" % getNodeJsVersion(),
"pull": "always",
"environment": params["extraEnvironment"],
"commands": params["extraCommandsBeforeTestRun"] + [
Expand Down Expand Up @@ -654,7 +646,7 @@ def phpTests(ctx, testType, withCoverage):
errorFound = False

default = {
"phpVersions": ["7.2", "7.3", "7.4"],
"phpVersions": ["7.3", "7.4"],
"databases": [
"sqlite",
"mariadb:10.2",
Expand All @@ -674,6 +666,7 @@ def phpTests(ctx, testType, withCoverage):
"extraApps": {},
"extraTeardown": [],
"skip": False,
"enableApp": True,
}

if "defaults" in config:
Expand Down Expand Up @@ -766,7 +759,7 @@ def phpTests(ctx, testType, withCoverage):
"steps": installCore(ctx, "daily-master-qa", db, False) +
installApp(ctx, phpVersion) +
installExtraApps(phpVersion, params["extraApps"]) +
setupServerAndApp(ctx, phpVersion, params["logLevel"]) +
setupServerAndApp(ctx, phpVersion, params["logLevel"], False, params["enableApp"]) +
setupCeph(params["cephS3"]) +
setupScality(params["scalityS3"]) +
params["extraSetup"] +
Expand Down Expand Up @@ -850,7 +843,7 @@ def acceptance(ctx):
default = {
"servers": ["daily-master-qa", "latest"],
"browsers": ["chrome"],
"phpVersions": ["7.2"],
"phpVersions": ["7.4"],
"databases": ["mariadb:10.2"],
"esVersions": ["none"],
"federatedServerNeeded": False,
Expand Down Expand Up @@ -880,6 +873,7 @@ def acceptance(ctx):
"debugSuites": [],
"skipExceptParts": [],
"earlyFail": True,
"enableApp": True,
}

if "defaults" in config:
Expand Down Expand Up @@ -930,7 +924,7 @@ def acceptance(ctx):
params["extraSetup"] = [
{
"name": "configure-app",
"image": "owncloudci/php:7.2",
"image": "owncloudci/php:7.4",
"pull": "always",
"commands": [
"cd /var/www/owncloud/server/apps/files_primary_s3",
Expand Down Expand Up @@ -1096,7 +1090,7 @@ def acceptance(ctx):
(installFederated(testConfig["server"], testConfig["phpVersion"], testConfig["logLevel"], testConfig["database"], federationDbSuffix) + owncloudLog("federated") if testConfig["federatedServerNeeded"] else []) +
installApp(ctx, testConfig["phpVersion"]) +
installExtraApps(testConfig["phpVersion"], testConfig["extraApps"]) +
setupServerAndApp(ctx, testConfig["phpVersion"], testConfig["logLevel"], testConfig["federatedServerNeeded"]) +
setupServerAndApp(ctx, testConfig["phpVersion"], testConfig["logLevel"], testConfig["federatedServerNeeded"], params["enableApp"]) +
owncloudLog("server") +
setupCeph(testConfig["cephS3"]) +
setupScality(testConfig["scalityS3"]) +
Expand Down Expand Up @@ -1393,10 +1387,11 @@ def elasticSearchService(esVersion):

return [{
"name": "elasticsearch",
"image": "webhippie/elasticsearch:%s" % esVersion,
"image": "owncloudops/elasticsearch:%s" % esVersion,
"pull": "always",
"environment": {
"ELASTICSEARCH_PLUGINS_INSTALL": "ingest-attachment",
"ELASTICSEARCH_ROOT_LOG_LEVEL": "warn",
"ELASTICSEARCH_BOOTSTRAP_MEMORY_LOCK": "false",
},
}]

Expand Down Expand Up @@ -1509,6 +1504,13 @@ def getDbDatabase(db):

return "owncloud"

def getNodeJsVersion():
if "nodeJsVersion" not in config:
# We use nodejs 14 as the default
return "14"
else:
return config["nodeJsVersion"]

def cacheRestore():
return [{
"name": "cache-restore",
Expand Down Expand Up @@ -1625,7 +1627,23 @@ def installApp(ctx, phpVersion):
if "appInstallCommand" not in config:
return []

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

return [
{
"name": "install-app-js-%s" % config["app"],
"image": "owncloudci/nodejs:%s" % getNodeJsVersion(),
"pull": "always",
"commands": [
"cd /var/www/owncloud/server/apps/%s" % config["app"],
"make install-js-deps",
"make build-dev",
],
},
] if installJsDeps else [] + [{
"name": "install-app-%s" % ctx.repo.name,
"image": "owncloudci/php:%s" % phpVersion,
"pull": "always",
Expand All @@ -1635,15 +1653,15 @@ def installApp(ctx, phpVersion):
],
}]

def setupServerAndApp(ctx, phpVersion, logLevel, federatedServerNeeded = False):
def setupServerAndApp(ctx, phpVersion, logLevel, federatedServerNeeded = False, enableApp = True):
return [{
"name": "setup-server-%s" % ctx.repo.name,
"image": "owncloudci/php:%s" % phpVersion,
"pull": "always",
"commands": [
"cd %s" % dir["server"],
"php occ a:l",
"php occ a:e %s" % ctx.repo.name,
"php occ a:e %s" % ctx.repo.name if enableApp else "",
"php occ a:e testing",
"php occ a:l",
"php occ config:system:set trusted_domains 1 --value=server",
Expand All @@ -1670,7 +1688,7 @@ def setupCeph(serviceParams):

return [{
"name": "setup-ceph",
"image": "owncloudci/php:7.2",
"image": "owncloudci/php:7.4",
"pull": "always",
"commands": setupCommands + ([
"./apps/files_primary_s3/tests/drone/create-bucket.sh",
Expand Down Expand Up @@ -1698,7 +1716,7 @@ def setupScality(serviceParams):

return [{
"name": "setup-scality",
"image": "owncloudci/php:7.2",
"image": "owncloudci/php:7.4",
"pull": "always",
"commands": setupCommands + ([
"php occ s3:create-bucket owncloud --accept-warning",
Expand All @@ -1713,7 +1731,7 @@ def setupElasticSearch(esVersion):

return [{
"name": "setup-es",
"image": "owncloudci/php:7.2",
"image": "owncloudci/php:7.4",
"pull": "always",
"commands": [
"cd %s" % dir["server"],
Expand Down Expand Up @@ -1952,3 +1970,60 @@ def checkStarlark():
],
},
}]

def phplint(ctx):
pipelines = []

if "phplint" not in config:
return pipelines

if type(config["phplint"]) == "bool":
if not config["phplint"]:
return pipelines

result = {
"kind": "pipeline",
"type": "docker",
"name": "lint-test",
"workspace": {
"base": "/var/www/owncloud",
"path": "server/apps/%s" % ctx.repo.name,
},
"steps": installNPM() +
lintTest(),
"depends_on": [],
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/**",
"refs/pull/**",
],
},
}

for branch in config["branches"]:
result["trigger"]["ref"].append("refs/heads/%s" % branch)

pipelines.append(result)

return pipelines

def installNPM():
return [{
"name": "npm-install",
"image": "owncloudci/nodejs:%s" % getNodeJsVersion(),
"pull": "always",
"commands": [
"yarn install --frozen-lockfile",
],
}]

def lintTest():
return [{
"name": "lint-test",
"image": "owncloudci/php:7.4",
"pull": "always",
"commands": [
"make test-lint",
],
}]
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
# },

COMPOSER_BIN := $(shell command -v composer 2> /dev/null)
ifndef COMPOSER_BIN
$(error composer is not available on your system, please install composer)
endif

app_name=$(notdir $(CURDIR))
build_tools_directory=$(CURDIR)/build/tools
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "owncloud/notes",
"config" : {
"platform": {
"php": "7.1"
"php": "7.3"
}
},
"require": {
"php": ">=7.1"
"php": ">=7.3"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4"
Expand Down
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading