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][CI] Update drone.star file to the latest version from activity app #170

Merged
merged 2 commits into from
Jun 14, 2021
Merged
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
52 changes: 42 additions & 10 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ def main(ctx):

dependsOn(before, coverageTests)

nonCoverageTests = nonCoveragePipelines(ctx)
if (nonCoverageTests == False):
print('Errors detected in nonCoveragePipelines. Review messages above.')
return []

dependsOn(before, nonCoverageTests)

stages = stagePipelines(ctx)
if (stages == False):
print('Errors detected. Review messages above.')
Expand All @@ -60,18 +67,28 @@ def main(ctx):
dependsOn(coverageTests, afterCoverageTests)

after = afterPipelines(ctx)
dependsOn(afterCoverageTests + stages, after)
dependsOn(afterCoverageTests + nonCoverageTests + stages, after)

return before + coverageTests + afterCoverageTests + stages + after
return before + coverageTests + afterCoverageTests + nonCoverageTests + stages + after

def beforePipelines():
return codestyle() + jscodestyle() + phpstan() + phan()

def coveragePipelines(ctx):
# All pipelines that might have coverage or other test analysis reported
jsPipelines = javascript(ctx)
phpUnitPipelines = phpTests(ctx, 'phpunit')
phpIntegrationPipelines = phpTests(ctx, 'phpintegration')
# All unit test pipelines that have coverage or other test analysis reported
jsPipelines = javascript(ctx, True)
phpUnitPipelines = phpTests(ctx, 'phpunit', True)
phpIntegrationPipelines = phpTests(ctx, 'phpintegration', True)
if (jsPipelines == False) or (phpUnitPipelines == False) or (phpIntegrationPipelines == False):
return False

return jsPipelines + phpUnitPipelines + phpIntegrationPipelines

def nonCoveragePipelines(ctx):
# All unit test pipelines that do not have coverage or other test analysis reported
jsPipelines = javascript(ctx, False)
phpUnitPipelines = phpTests(ctx, 'phpunit', False)
phpIntegrationPipelines = phpTests(ctx, 'phpintegration', False)
if (jsPipelines == False) or (phpUnitPipelines == False) or (phpIntegrationPipelines == False):
return False

Expand Down Expand Up @@ -447,7 +464,7 @@ def build():

return pipelines

def javascript(ctx):
def javascript(ctx, withCoverage):
pipelines = []

if 'javascript' not in config:
Expand Down Expand Up @@ -485,6 +502,14 @@ def javascript(ctx):
if params['skip']:
return pipelines

# if we only want pipelines with coverage, and this pipeline does not do coverage, then do not include it
if withCoverage and not params['coverage']:
return pipelines

# if we only want pipelines without coverage, and this pipeline does coverage, then do not include it
if not withCoverage and params['coverage']:
return pipelines

result = {
'kind': 'pipeline',
'type': 'docker',
Expand Down Expand Up @@ -547,7 +572,7 @@ def javascript(ctx):

return [result]

def phpTests(ctx, testType):
def phpTests(ctx, testType, withCoverage):
pipelines = []

if testType not in config:
Expand Down Expand Up @@ -600,6 +625,14 @@ def phpTests(ctx, testType):
if params['skip']:
continue

# if we only want pipelines with coverage, and this pipeline does not do coverage, then do not include it
if withCoverage and not params['coverage']:
continue

# if we only want pipelines without coverage, and this pipeline does coverage, then do not include it
if not withCoverage and params['coverage']:
continue

cephS3Params = params['cephS3']
if type(cephS3Params) == "bool":
cephS3Needed = cephS3Params
Expand Down Expand Up @@ -786,7 +819,7 @@ def acceptance(ctx):
suites[suite] = suite
else:
suites = matrix['suites']

if 'debugSuites' in matrix and len(matrix['debugSuites']) != 0:
if type(matrix['debugSuites']) == "list":
suites = {}
Expand Down Expand Up @@ -1183,7 +1216,6 @@ def ldapService(ldapNeeded):
'LDAP_ORGANISATION': 'owncloud',
'LDAP_ADMIN_PASSWORD': 'admin',
'LDAP_TLS_VERIFY_CLIENT': 'never',
'HOSTNAME': 'ldap',
}
}]

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ nbproject
/build/
/l10n/.transifexrc
.php_cs.cache
.php-cs-fixer.cache

# Composer
vendor/
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ test-php-unit-dbg: vendor/bin/phpunit
.PHONY: test-php-style
test-php-style: ## Run php-cs-fixer and check owncloud code-style
test-php-style: vendor-bin/owncloud-codestyle/vendor
$(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes --dry-run
$(PHP_CS_FIXER) fix -v --diff --allow-risky yes --dry-run

.PHONY: test-php-style-fix
test-php-style-fix: ## Run php-cs-fixer and fix code style issues
test-php-style-fix: vendor-bin/owncloud-codestyle/vendor
$(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes
$(PHP_CS_FIXER) fix -v --diff --allow-risky yes

.PHONY: test-php-phan
test-php-phan: ## Run phan
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

class PageController extends Controller {
/** @var int */
const PAGE_LIMIT = 5;
public const PAGE_LIMIT = 5;

/** @var INotificationManager */
protected $notificationManager;
Expand Down
4 changes: 2 additions & 2 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public function prepare(INotification $notification, $languageCode) {
}

$notification->setParsedSubject(
(string) $l->t('%1$s announced “%2$s”', $params)
);
(string) $l->t('%1$s announced “%2$s”', $params)
);

return $notification;

Expand Down
6 changes: 3 additions & 3 deletions vendor-bin/owncloud-codestyle/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"owncloud/coding-standard": "^2.0"
}
"require": {
"owncloud/coding-standard": "^3.0"
}
}