From 0bfe23d177a410f7a7d8923b950e2965e3f4005c Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sat, 4 Sep 2021 20:16:55 +0545 Subject: [PATCH] Update .drone.star and drop PHP 7.2 --- .drone.star | 140 ++++++++++++++++++++++++++++++--------- composer.json | 2 +- composer.lock | 6 +- sonar-project.properties | 2 +- 4 files changed, 113 insertions(+), 37 deletions(-) diff --git a/.drone.star b/.drone.star index 7fa7ddc43..6f9ce3106 100644 --- a/.drone.star +++ b/.drone.star @@ -14,15 +14,7 @@ config = { "branches": [ "master", ], - "codestyle": { - "ordinary": { - "phpVersions": [ - "7.2", - "7.3", - "7.4", - ], - }, - }, + "codestyle": True, "javascript": { "extraCommandsBeforeTestRun": [ "apt update -y", @@ -35,12 +27,11 @@ config = { "phpunit": { "allDatabases": { "phpVersions": [ - "7.2", + "7.3", ], }, "reducedDatabases": { "phpVersions": [ - "7.3", "7.4", ], "databases": [ @@ -87,7 +78,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 @@ -134,7 +125,7 @@ def codestyle(ctx): return pipelines default = { - "phpVersions": ["7.2"], + "phpVersions": ["7.3"], } if "defaults" in config: @@ -299,9 +290,10 @@ def phpstan(ctx): return pipelines default = { - "phpVersions": ["7.2"], + "phpVersions": ["7.3"], "logLevel": "2", "extraApps": {}, + "enableApp": True, } if "defaults" in config: @@ -341,7 +333,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", @@ -375,7 +367,7 @@ def phan(ctx): return pipelines default = { - "phpVersions": ["7.2", "7.3", "7.4"], + "phpVersions": ["7.3", "7.4"], } if "defaults" in config: @@ -446,7 +438,7 @@ def build(ctx): return pipelines default = { - "phpVersions": ["7.2"], + "phpVersions": ["7.3"], "commands": [ "make dist", ], @@ -543,6 +535,7 @@ def javascript(ctx, withCoverage): "extraCommandsBeforeTestRun": [], "extraTeardown": [], "skip": False, + "enableApp": True, } if "defaults" in config: @@ -584,12 +577,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"] + [ @@ -644,7 +637,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", @@ -664,6 +657,7 @@ def phpTests(ctx, testType, withCoverage): "extraApps": {}, "extraTeardown": [], "skip": False, + "enableApp": True, } if "defaults" in config: @@ -756,7 +750,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"] + @@ -840,7 +834,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, @@ -870,6 +864,7 @@ def acceptance(ctx): "debugSuites": [], "skipExceptParts": [], "earlyFail": True, + "enableApp": True, } if "defaults" in config: @@ -920,7 +915,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", @@ -1086,7 +1081,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"]) + @@ -1383,10 +1378,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", }, }] @@ -1499,6 +1495,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", @@ -1615,7 +1618,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", @@ -1625,7 +1644,7 @@ 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, @@ -1633,7 +1652,7 @@ def setupServerAndApp(ctx, phpVersion, logLevel, federatedServerNeeded = False): "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", @@ -1660,7 +1679,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", @@ -1688,7 +1707,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", @@ -1703,7 +1722,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"], @@ -1942,3 +1961,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", + ], + }] diff --git a/composer.json b/composer.json index 67e5e9e16..8ce6c4526 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "owncloud/calendar", "config" : { "platform": { - "php": "7.1" + "php": "7.3" } }, "require": { diff --git a/composer.lock b/composer.lock index e8d3d414b..adea4e71e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4636c9c08a2c646192cb39ebcb9b312e", + "content-hash": "a11541f24ef060ed1480ee1f0cfaa656", "packages": [], "packages-dev": [ { @@ -66,7 +66,7 @@ "platform": [], "platform-dev": [], "platform-overrides": { - "php": "7.1" + "php": "7.3" }, - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.1.0" } diff --git a/sonar-project.properties b/sonar-project.properties index df42e45a4..d3b2991e7 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -29,5 +29,5 @@ sonar.pullrequest.branch=${env.SONAR_PULL_REQUEST_BRANCH} sonar.pullrequest.key=${env.SONAR_PULL_REQUEST_KEY} # Properties specific to language plugins: -sonar.php.coverage.reportPaths=results/clover-phpunit-php7.2-mariadb10.2.xml,results/clover-phpunit-php7.2-mysql8.0.xml,results/clover-phpunit-php7.2-postgres9.4.xml,results/clover-phpunit-php7.2-oracle.xml,results/clover-phpunit-php7.2-sqlite.xml +sonar.php.coverage.reportPaths=results/clover-phpunit-php7.3-mariadb10.2.xml,results/clover-phpunit-php7.3-mysql8.0.xml,results/clover-phpunit-php7.3-postgres9.4.xml,results/clover-phpunit-php7.3-oracle.xml,results/clover-phpunit-php7.3-sqlite.xml sonar.javascript.lcov.reportPaths=results/lcov.info