Skip to content

Commit

Permalink
Merge pull request #65 from owncloud/improve_ci
Browse files Browse the repository at this point in the history
Improve ci
  • Loading branch information
Vincent Petry authored Sep 5, 2018
2 parents 1dff281 + d44a11e commit c11fdcb
Show file tree
Hide file tree
Showing 16 changed files with 340 additions and 129 deletions.
94 changes: 93 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ pipeline:
pull: true
version: ${OC_VERSION}
exclude: apps/configreport
db_type: ${DB_TYPE}
db_name: ${DB_NAME}
db_host: ${DB_HOST}
db_username: autotest
db_password: owncloud

code-compliance-check:
image: owncloudci/php:${PHP_VERSION}
Expand All @@ -18,14 +23,16 @@ pipeline:
# currently fails since we rely on OC_Util
# - make test-php-codecheck
- make test-php-lint
- make test-php-style

unit-tests:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- COVERAGE=${COVERAGE}
commands:
- make test-php-unit
- if [ -z "${COVERAGE}" ]; then make test-php-unit; fi
- if [ "${COVERAGE}" = "true" ]; then make test-php-unit-dbg; fi

codecov:
image: plugins/codecov:2
Expand All @@ -50,12 +57,76 @@ pipeline:
status: [ failure, changed ]
event: [ push, tag ]

services:
mysql:
image: mysql:5.5
environment:
- MYSQL_USER=autotest
- MYSQL_PASSWORD=owncloud
- MYSQL_DATABASE=${DB_NAME}
- MYSQL_ROOT_PASSWORD=owncloud
when:
matrix:
DB_HOST: mysql

mysqlmb4:
image: mysql:5.7
environment:
- MYSQL_USER=autotest
- MYSQL_PASSWORD=owncloud
- MYSQL_DATABASE=${DB_NAME}
- MYSQL_ROOT_PASSWORD=owncloud
when:
matrix:
DB_HOST: mysqlmb4

pgsql:
image: postgres:9.4
environment:
- POSTGRES_USER=autotest
- POSTGRES_PASSWORD=owncloud
- POSTGRES_DB=${DB_NAME}
when:
matrix:
DB_HOST: pgsql

oci:
image: deepdiver/docker-oracle-xe-11g
environment:
- ORACLE_USER=system
- ORACLE_PASSWORD=oracle
- ORACLE_DB=${DB_NAME}
when:
matrix:
DB_HOST: oci

matrix:
include:

#master
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
DB_HOST: oci
DB_TYPE: oci
DB_NAME: XE

- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
DB_HOST: pgsql
DB_TYPE: pgsql
DB_NAME: owncloud

- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
DB_HOST: mysql
DB_TYPE: mysql
DB_NAME: owncloud

- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
DB_HOST: mysqlmb4
DB_TYPE: mysql
DB_NAME: owncloud

- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
Expand All @@ -66,6 +137,27 @@ matrix:

- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
DB_HOST: oci
DB_TYPE: oci
DB_NAME: XE

- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
DB_HOST: pgsql
DB_TYPE: pgsql
DB_NAME: owncloud

- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
DB_HOST: mysql
DB_TYPE: mysql
DB_NAME: owncloud

- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
DB_HOST: mysqlmb4
DB_TYPE: mysql
DB_NAME: owncloud

- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
.idea/
tests/output
tests/output
vendor/
vendor-bin/**/vendor
vendor-bin/**/composer.lock
.php_cs.cache
10 changes: 10 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
$config = new OC\CodingStandard\Config();
$config
->setUsingCache(true)
->getFinder()
->exclude('templates')
->exclude('vendor')
->exclude('vendor-bin')
->in(__DIR__);
return $config;
74 changes: 70 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,85 @@
SHELL := /bin/bash

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 definitions
app_name=$(notdir $(CURDIR))
project_directory=$(CURDIR)/../$(app_name)

occ=$(CURDIR)/../../occ



# bin file definitions
PHPUNIT=php -d zend.enable_gc=0 ../../lib/composer/bin/phpunit
PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "../../lib/composer/bin/phpunit"
PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer
PHPLINT=php -d zend.enable_gc=0 ../../lib/composer/bin/parallel-lint

.DEFAULT_GOAL := help

help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'



##
## Tests
##--------------------------------------

.PHONY: test-php-unit
test-php-unit: ## Run php unit tests
test-php-unit:
$(PHPUNIT) --configuration ./tests/unit/phpunit.xml

.PHONY: test-php-unit-dbg
test-php-unit-dbg: ## Run php unit tests using phpdbg
test-php-unit-dbg:
$(PHPUNITDBG) --configuration ./tests/unit/phpunit.xml

.PHONY: test-php-codecheck
test-php-codecheck: ## Run occ app code checks
test-php-codecheck:
$(occ) app:check-code $(app_name) -c private -c strong-comparison
$(occ) app:check-code $(app_name) -c deprecation

.PHONY: test-php-lint
test-php-lint: ## Run parallel-lint
test-php-lint:
../../lib/composer/bin/parallel-lint . --exclude 3rdparty --exclude build .
$(PHPLINT) . --exclude 3rdparty --exclude build .

.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

.PHONY: test-php-unit
test-php-unit:
./tests/run-unit.sh
.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

##
## Dependency management
##--------------------------------------

.PHONY: install-php-deps
install-php-deps: ## Install PHP dependencies
install-php-deps: vendor composer.json composer.lock

vendor: composer.lock
$(COMPOSER_BIN) install --no-dev

composer.lock:
$(COMPOSER_BIN) install

vendor/bamarni/composer-bin-plugin: composer.lock
$(COMPOSER_BIN) install

vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock
$(COMPOSER_BIN) bin owncloud-codestyle install --no-progress

vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json
@echo owncloud-codestyle composer.lock is not up to date.
21 changes: 11 additions & 10 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@
namespace OCA\ConfigReport\AppInfo;

use OCP\AppFramework\App;

$application = new Application('configreport');

$application->registerRoutes(
$this,
[
'routes' => [
[
'name' => 'Report#getReport',
'url' => '/report',
'verb' => 'GET',
],
],
]
$this,
[
'routes' => [
[
'name' => 'Report#getReport',
'url' => '/report',
'verb' => 'GET',
],
],
]
);
18 changes: 18 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "owncloud/configreport",
"config" : {
"platform": {
"php": "5.6.37"
}
},
"require": {
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.2"
},
"extra": {
"bamarni-bin": {
"bin-links": false
}
}
}
60 changes: 60 additions & 0 deletions composer.lock

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

6 changes: 2 additions & 4 deletions lib/AdminPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
use OCP\Settings\ISettings;
use OCP\Template;

class AdminPanel implements ISettings
{
class AdminPanel implements ISettings {

/** @var IURLGenerator */
protected $urlGenerator;
Expand All @@ -49,5 +48,4 @@ public function getPriority() {
public function getSectionID() {
return 'general';
}

}
}
Loading

0 comments on commit c11fdcb

Please sign in to comment.