From e58c757f6cd27d40de0cf2680739db58c1ef5dbb Mon Sep 17 00:00:00 2001 From: Dipak Acharya Date: Wed, 14 Nov 2018 15:05:40 +0545 Subject: [PATCH 1/9] Add CI tests to drone --- .drone.yml | 361 ++++++++++++++++++++ .gitignore | 4 + .php_cs.dist | 2 + Makefile | 88 +++++ composer.json | 8 + composer.lock | 46 ++- phpunit.xml | 26 ++ vendor-bin/owncloud-codestyle/composer.json | 10 + 8 files changed, 542 insertions(+), 3 deletions(-) create mode 100644 .drone.yml create mode 100644 phpunit.xml create mode 100644 vendor-bin/owncloud-codestyle/composer.json diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000000..68bc90479f --- /dev/null +++ b/.drone.yml @@ -0,0 +1,361 @@ +workspace: + base: /var/www/owncloud + path: apps/gallery + +branches: [master, release*, release/*] + +pipeline: + install-server: + image: owncloudci/core + version: ${OC_VERSION} + pull: true + db_type: ${DB_TYPE} + db_name: ${DB_NAME} + db_host: ${DB_TYPE} + db_username: autotest + db_password: owncloud + when: + matrix: + NEED_SERVER: true + + install-app: + image: owncloudci/php:${PHP_VERSION} + pull: true + commands: + - cd /var/www/owncloud/ + - php occ a:l + - php occ a:e gallery + - php occ a:e testing + - php occ a:l + - php occ config:system:set trusted_domains 1 --value=owncloud + - php occ log:manage --level 0 + when: + matrix: + NEED_INSTALL_APP: true + + fix-permissions: + image: owncloudci/php:${PHP_VERSION} + pull: true + commands: + - chown www-data /var/www/owncloud -R + - chmod 777 /var/www/owncloud/tests/acceptance/filesForUpload -R + - chmod +x /var/www/owncloud/tests/acceptance/run.sh + when: + matrix: + NEED_SERVER: true + + owncloud-log: + image: owncloud/ubuntu:16.04 + detach: true + pull: true + commands: + - tail -f /var/www/owncloud/data/owncloud.log + when: + matrix: + NEED_SERVER: true + + owncloud-coding-standard: + image: owncloudci/php:${PHP_VERSION} + pull: true + commands: + - make test-php-style + when: + matrix: + TEST_SUITE: owncloud-coding-standard + + phpunit-tests: + image: owncloudci/php:${PHP_VERSION} + pull: true + environment: + - COVERAGE=${COVERAGE} + commands: + - if [ -z "${COVERAGE}" ]; then make test-php-unit; fi + - if [ "${COVERAGE}" = "true" ]; then make test-php-unit-dbg; fi + when: + matrix: + TEST_SUITE: phpunit + + integration-tests: + image: owncloudci/php:${PHP_VERSION} + pull: true + environment: + - PHP_VERSION=${PHP_VERSION} + commands: + make test-php-integration + when: + matrix: + TEST_SUITE: integration + + acceptance-tests: + image: owncloudci/php:${PHP_VERSION} + pull: true + environment: + - BROWSER=chrome + - SELENIUM_HOST=selenium + - TEST_SERVER_URL=http://server + - SELENIUM_PORT=4444 + - PLATFORM=Linux + - MAILHOG_HOST=email + - PHP_VERSION=${PHP_VERSION} + commands: + - cd /var/www/owncloud/tests/acceptance/ + - touch /var/www/owncloud/saved-settings.sh + - . /var/www/owncloud/saved-settings.sh + - cd /var/www/owncloud/apps/gallery/ + - make test-acceptance + when: + matrix: + TEST_SUITE: acceptance + + codecov: + image: plugins/codecov:2 + secrets: [codecov_token] + pull: true + files: + - tests/_output/clover.xml + when: + matrix: + COVERAGE: true + + notify: + image: plugins/slack:1 + pull: true + secrets: [ slack_webhook ] + channel: builds + when: + 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_TYPE: mysql + + pgsql: + image: postgres:9.4 + environment: + - POSTGRES_USER=autotest + - POSTGRES_PASSWORD=owncloud + - POSTGRES_DB=${DB_NAME} + when: + matrix: + DB_TYPE: pgsql + + owncloud: + image: owncloudci/php:${PHP_VERSION} + pull: true + environment: + - APACHE_WEBROOT=/var/www/owncloud/ + command: [ "/usr/local/bin/apachectl", "-e", "debug", "-D", "FOREGROUND" ] + when: + matrix: + NEED_SERVER: true + + selenium: + image: selenium/standalone-chrome-debug:latest + pull: true + when: + matrix: + TEST_SUITE: selenium + +matrix: + include: + # owncloud-coding-standard + - PHP_VERSION: 7.2 + TEST_SUITE: owncloud-coding-standard + + # Unit Tests + - PHP_VERSION: 7.1 + OC_VERSION: daily-master-qa + TEST_SUITE: phpunit + DB_TYPE: sqlite + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.1 + OC_VERSION: daily-master-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.1 + OC_VERSION: daily-master-qa + TEST_SUITE: phpunit + DB_TYPE: pgsql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.2 + OC_VERSION: daily-master-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 5.6 + OC_VERSION: daily-stable10-qa + TEST_SUITE: phpunit + DB_TYPE: sqlite + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 5.6 + OC_VERSION: daily-stable10-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.0 + OC_VERSION: daily-stable10-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.0 + OC_VERSION: daily-stable10-qa + TEST_SUITE: phpunit + DB_TYPE: pgsql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + COVERAGE: true + + - PHP_VERSION: 7.1 + OC_VERSION: daily-stable10-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.2 + OC_VERSION: daily-stable10-qa + TEST_SUITE: phpunit + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + # integration testing + - PHP_VERSION: 5.6 + OC_VERSION: daily-stable10-qa + TEST_SUITE: integration + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.0 + OC_VERSION: daily-stable10-qa + TEST_SUITE: integration + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.1 + OC_VERSION: daily-stable10-qa + TEST_SUITE: integration + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.2 + OC_VERSION: daily-stable10-qa + TEST_SUITE: integration + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.1 + OC_VERSION: daily-master-qa + TEST_SUITE: integration + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.2 + OC_VERSION: daily-master-qa + TEST_SUITE: integration + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.1 + OC_VERSION: daily-master-qa + TEST_SUITE: integration + DB_TYPE: pgsql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + # acceptance tests + - PHP_VERSION: 7.1 + OC_VERSION: daily-master-qa + TEST_SUITE: acceptance + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.2 + OC_VERSION: daily-master-qa + TEST_SUITE: acceptance + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 5.6 + OC_VERSION: daily-stable10-qa + TEST_SUITE: acceptance + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.0 + OC_VERSION: daily-stable10-qa + TEST_SUITE: acceptance + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.1 + OC_VERSION: daily-stable10-qa + TEST_SUITE: acceptance + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + + - PHP_VERSION: 7.2 + OC_VERSION: daily-stable10-qa + TEST_SUITE: acceptance + DB_TYPE: mysql + DB_NAME: owncloud + NEED_SERVER: true + NEED_INSTALL_APP: true + diff --git a/.gitignore b/.gitignore index 1d349af55f..a90927ea33 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ vendor .php_cs.cache c3.php + +vendor-bin/**/composer.lock +tests/_output/ +tests/_support/_generated/ diff --git a/.php_cs.dist b/.php_cs.dist index 106b08f8b1..808f366be6 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -7,6 +7,8 @@ $config ->getFinder() ->exclude('l10n') ->notPath('/^c3.php/') + ->exclude('vendor') + ->exclude('vendor-bin') ->in(__DIR__); return $config; diff --git a/Makefile b/Makefile index 65041570d1..1ba7283a1a 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ app_name=$(notdir $(CURDIR)) project_directory=$(CURDIR)/../$(app_name) +build_dir=$(CURDIR)/build build_tools_directory=$(CURDIR)/build/tools source_build_directory=$(CURDIR)/build/artifacts/source source_package_name=$(source_build_directory)/$(app_name) @@ -26,12 +27,36 @@ endif endif endif +# composer +composer_deps=vendor +composer_dev_deps=vendor/php-cs-fixer +COMPOSER_BIN=$(build_dir)/composer.phar + +# +# Basic required tools +# +# + +.PHONY: all +all: $(composer_dev_deps) # Removes the appstore build .PHONY: clean clean: rm -rf ./build/artifacts +$(COMPOSER_BIN): + mkdir -p $(build_dir) + cd $(build_dir) && curl -sS https://getcomposer.org/installer | php +# +# ownCloud core PHP dependencies +# +$(composer_deps): $(COMPOSER_BIN) composer.json composer.lock + php $(COMPOSER_BIN) install --no-dev + +$(composer_dev_deps): $(COMPOSER_BIN) composer.json composer.lock + php $(COMPOSER_BIN) install --dev + # Builds the source and appstore package .PHONY: dist dist: @@ -79,3 +104,66 @@ else @echo $(sign_skip_msg) endif tar -czf $(appstore_package_name).tar.gz -C $(appstore_package_name)/../ $(app_name) + + +# bin file definitions +PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer +PHPUNIT=php -d zend.enable_gc=0 vendor/bin/phpunit +PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "./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 + +.PHONY: test-php-integration +test-php-integration: +test-php-integration: vendor/bin/codecept + php vendor/bin/codecept run integration + +.PHONY: test-acceptance +test-acceptance: +test-acceptance: vendor/bin/codecept + php vendor/bin/codecept run acceptance --env chrome + +.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 + + +.PHONY: test-php-unit +test-php-unit: ## Run php unit tests +test-php-unit: vendor/bin/phpunit + $(PHPUNIT) --configuration ./phpunit.xml --testsuite unit + +.PHONY: test-php-unit-dbg +test-php-unit-dbg: ## Run php unit tests with php dbg +test-php-unit-dbg: vendor/bin/phpunit + $(PHPUNITDBG) --configuration ./phpunit.xml --testsuite unit + +# +# Dependency management +#-------------------------------------- + composer.lock: composer.json + @echo composer.lock is not up to date. + + vendor: composer.lock + composer install --no-dev + + vendor/bin/phpunit: composer.lock + composer install + + vendor/bin/codecept: composer.lock + composer install + + vendor/bamarni/composer-bin-plugin: composer.lock + composer install + + vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock + composer 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. + diff --git a/composer.json b/composer.json index 7861536403..7e14466ba6 100644 --- a/composer.json +++ b/composer.json @@ -39,5 +39,13 @@ "jakub-onderka/php-parallel-lint": "1.*", "jakub-onderka/php-console-highlighter": "0.*", "owncloud/coding-standard": "^1.0" + }, + "extra": { + "bamarni-bin": { + "bin-links": false + } + }, + "require": { + "bamarni/composer-bin-plugin": "^1.2" } } diff --git a/composer.lock b/composer.lock index f1346fed35..5d9f6d0e46 100644 --- a/composer.lock +++ b/composer.lock @@ -1,11 +1,51 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b2d51d45fb23130f6ae07efe083779b7", - "packages": [], + "content-hash": "e5042e11f08e42e6cff6f64d48ee486e", + "packages": [ + { + "name": "bamarni/composer-bin-plugin", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/bamarni/composer-bin-plugin.git", + "reference": "62fef740245a85f00665e81ea8f0aa0b72afe6e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/62fef740245a85f00665e81ea8f0aa0b72afe6e7", + "reference": "62fef740245a85f00665e81ea8f0aa0b72afe6e7", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "require-dev": { + "composer/composer": "dev-master", + "symfony/console": "^2.5 || ^3.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Bamarni\\Composer\\Bin\\Plugin", + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Bamarni\\Composer\\Bin\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "time": "2017-09-11T13:13:58+00:00" + } + ], "packages-dev": [ { "name": "behat/gherkin", diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000000..3fe15832db --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,26 @@ + + + + ./tests/unit + + + + + ./ + + ./l10n + ./tests + + + + + + + + + diff --git a/vendor-bin/owncloud-codestyle/composer.json b/vendor-bin/owncloud-codestyle/composer.json new file mode 100644 index 0000000000..6e679afd9f --- /dev/null +++ b/vendor-bin/owncloud-codestyle/composer.json @@ -0,0 +1,10 @@ +{ + "config" : { + "platform": { + "php": "5.6.37" + } + }, + "require": { + "owncloud/coding-standard": "^1.0" + } + } From 57d62dead7f4de59437b06d1f2f0543cb90c1c1c Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 15 Nov 2018 20:05:47 +0545 Subject: [PATCH 2/9] Adjust gitignore and codestyle composer.json indent --- .gitignore | 1 + vendor-bin/owncloud-codestyle/composer.json | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index a90927ea33..188a5c324d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +build vendor .php_cs.cache c3.php diff --git a/vendor-bin/owncloud-codestyle/composer.json b/vendor-bin/owncloud-codestyle/composer.json index 6e679afd9f..322a2046b8 100644 --- a/vendor-bin/owncloud-codestyle/composer.json +++ b/vendor-bin/owncloud-codestyle/composer.json @@ -1,10 +1,10 @@ { - "config" : { - "platform": { - "php": "5.6.37" - } - }, - "require": { - "owncloud/coding-standard": "^1.0" + "config" : { + "platform": { + "php": "5.6.37" } + }, + "require": { + "owncloud/coding-standard": "^1.0" } +} From 102f0015e56931086d6de2e0a042988ab9b455e2 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 15 Nov 2018 20:27:18 +0545 Subject: [PATCH 3/9] Remove owncloud/coding-standard from top-level composer files --- composer.json | 3 +-- composer.lock | 51 +-------------------------------------------------- 2 files changed, 2 insertions(+), 52 deletions(-) diff --git a/composer.json b/composer.json index 7e14466ba6..2c4eed654f 100644 --- a/composer.json +++ b/composer.json @@ -37,8 +37,7 @@ "codeception/c3": "2.*", "flow/jsonpath": "^0.3.1", "jakub-onderka/php-parallel-lint": "1.*", - "jakub-onderka/php-console-highlighter": "0.*", - "owncloud/coding-standard": "^1.0" + "jakub-onderka/php-console-highlighter": "0.*" }, "extra": { "bamarni-bin": { diff --git a/composer.lock b/composer.lock index 5d9f6d0e46..4b3c9e21b3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "e5042e11f08e42e6cff6f64d48ee486e", + "content-hash": "c5454f320ec2d918031cde9cbc74934b", "packages": [ { "name": "bamarni/composer-bin-plugin", @@ -1208,55 +1208,6 @@ ], "time": "2017-10-19T19:58:43+00:00" }, - { - "name": "owncloud/coding-standard", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/owncloud/coding-standard.git", - "reference": "548ba3b83e590e946a5aa1da33f7f4c8a55e61c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/owncloud/coding-standard/zipball/548ba3b83e590e946a5aa1da33f7f4c8a55e61c5", - "reference": "548ba3b83e590e946a5aa1da33f7f4c8a55e61c5", - "shasum": "" - }, - "require": { - "friendsofphp/php-cs-fixer": "^2.11" - }, - "type": "library", - "autoload": { - "psr-4": { - "OC\\CodingStandard\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "AGPL-3.0" - ], - "authors": [ - { - "name": "Thomas Müller", - "email": "thomas.mueller@tmit.eu" - }, - { - "name": "Patrick Jahns", - "email": "github@patrickjahns.de" - } - ], - "description": "ownCloud Coding Standard", - "homepage": "http://www.owncloud.org", - "keywords": [ - "code", - "coding", - "owncloud", - "php-cs-fixer", - "standard", - "style" - ], - "time": "2018-05-16T13:47:45+00:00" - }, { "name": "paragonie/random_compat", "version": "v2.0.17", From cad3ae2e21fdfbff59b6507206a11b8b8c73f47d Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 15 Nov 2018 20:35:13 +0545 Subject: [PATCH 4/9] Remove php-cs-fixer from top-level composer.lock and Travis --- .travis.yml | 1 - composer.lock | 147 -------------------------------------------------- 2 files changed, 148 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7bbaf8b366..1e489be1de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -101,7 +101,6 @@ before_script: script: # Test lint - php vendor/bin/parallel-lint --exclude vendor/composer/autoload_static.php --exclude travis --exclude vendor . vendor/composer vendor/symfony/yaml vendor/autoload.php - - vendor/bin/php-cs-fixer fix -v --diff --diff-format udiff --dry-run --allow-risky yes # Acceptance tests, using Firefox, without code coverage - php vendor/bin/codecept run acceptance --env firefox diff --git a/composer.lock b/composer.lock index 4b3c9e21b3..872ed0d974 100644 --- a/composer.lock +++ b/composer.lock @@ -750,102 +750,6 @@ "description": "JSONPath implementation for parsing, searching and flattening arrays", "time": "2016-09-06T17:43:18+00:00" }, - { - "name": "friendsofphp/php-cs-fixer", - "version": "v2.13.0", - "source": { - "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "7136aa4e0c5f912e8af82383775460d906168a10" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/7136aa4e0c5f912e8af82383775460d906168a10", - "reference": "7136aa4e0c5f912e8af82383775460d906168a10", - "shasum": "" - }, - "require": { - "composer/semver": "^1.4", - "composer/xdebug-handler": "^1.2", - "doctrine/annotations": "^1.2", - "ext-json": "*", - "ext-tokenizer": "*", - "php": "^5.6 || >=7.0 <7.3", - "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.2 || ^4.0", - "symfony/event-dispatcher": "^3.0 || ^4.0", - "symfony/filesystem": "^3.0 || ^4.0", - "symfony/finder": "^3.0 || ^4.0", - "symfony/options-resolver": "^3.0 || ^4.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0", - "symfony/stopwatch": "^3.0 || ^4.0" - }, - "conflict": { - "hhvm": "*" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", - "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.1", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.1", - "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.0.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", - "phpunitgoodpractices/traits": "^1.5.1", - "symfony/phpunit-bridge": "^4.0" - }, - "suggest": { - "ext-mbstring": "For handling non-UTF8 characters in cache signature.", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." - }, - "bin": [ - "php-cs-fixer" - ], - "type": "application", - "extra": { - "branch-alias": { - "dev-master": "2.13-dev" - } - }, - "autoload": { - "psr-4": { - "PhpCsFixer\\": "src/" - }, - "classmap": [ - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationCaseFactory.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php", - "tests/Test/IntegrationCaseFactoryInterface.php", - "tests/Test/InternalIntegrationCaseFactory.php", - "tests/TestCase.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "A tool to automatically fix PHP code style", - "time": "2018-08-23T13:15:44+00:00" - }, { "name": "guzzlehttp/guzzle", "version": "6.3.3", @@ -1257,57 +1161,6 @@ ], "time": "2018-07-04T16:31:37+00:00" }, - { - "name": "php-cs-fixer/diff", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3", - "symfony/process": "^3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "SpacePossum" - } - ], - "description": "sebastian/diff v2 backport support for PHP5.6", - "homepage": "https://github.com/PHP-CS-Fixer", - "keywords": [ - "diff" - ], - "time": "2018-02-15T16:58:55+00:00" - }, { "name": "phpdocumentor/reflection-common", "version": "1.0.1", From b80fc97d9e78b274ef5006003e41261fd45c5558 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 15 Nov 2018 20:57:49 +0545 Subject: [PATCH 5/9] Put bamarni/composer-bin-plugin into require-dev --- composer.json | 10 +++++----- composer.lock | 9 ++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 2c4eed654f..0fe62dbd67 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ ], "config" : { "platform": { - "php": "5.6" + "php": "5.6.37" } }, "support": { @@ -28,6 +28,8 @@ "wiki": "https://github.com/owncloud/gallery/wiki", "source": "https://github.com/owncloud/gallery" }, + "require": { + }, "require-dev": { "guzzlehttp/guzzle": "^5.0|^6.2", "phpunit/phpunit": "^5.5", @@ -37,14 +39,12 @@ "codeception/c3": "2.*", "flow/jsonpath": "^0.3.1", "jakub-onderka/php-parallel-lint": "1.*", - "jakub-onderka/php-console-highlighter": "0.*" + "jakub-onderka/php-console-highlighter": "0.*", + "bamarni/composer-bin-plugin": "^1.2" }, "extra": { "bamarni-bin": { "bin-links": false } - }, - "require": { - "bamarni/composer-bin-plugin": "^1.2" } } diff --git a/composer.lock b/composer.lock index 872ed0d974..5516cf14f4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,9 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "c5454f320ec2d918031cde9cbc74934b", - "packages": [ + "content-hash": "8e2d3f90f768bab5128bd07568d76719", + "packages": [], + "packages-dev": [ { "name": "bamarni/composer-bin-plugin", "version": "v1.2.0", @@ -44,9 +45,7 @@ "MIT" ], "time": "2017-09-11T13:13:58+00:00" - } - ], - "packages-dev": [ + }, { "name": "behat/gherkin", "version": "v4.5.1", From aabdb76f1b2b2c3c9b4c4c2d8066e78b4e436bf1 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 15 Nov 2018 21:35:38 +0545 Subject: [PATCH 6/9] Remove composer_deps composer_dev_deps definitions --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 1ba7283a1a..f2d7c008e2 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,10 @@ # later. See the COPYING file. # @author Ilja Neumann +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)) project_directory=$(CURDIR)/../$(app_name) @@ -11,8 +15,6 @@ source_build_directory=$(CURDIR)/build/artifacts/source source_package_name=$(source_build_directory)/$(app_name) appstore_build_directory=$(CURDIR)/build/artifacts/appstore appstore_package_name=$(appstore_build_directory)/$(app_name) -npm=$(shell which npm 2> /dev/null) -composer=$(shell which composer 2> /dev/null) occ=$(CURDIR)/../../occ private_key=$(HOME)/.owncloud/certificates/$(app_name).key @@ -28,9 +30,8 @@ endif endif # composer -composer_deps=vendor -composer_dev_deps=vendor/php-cs-fixer -COMPOSER_BIN=$(build_dir)/composer.phar +composer_deps= +composer_dev_deps= # # Basic required tools From ed4f7cce151a35c12f2e05fc8abdfbe2b3672904 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 15 Nov 2018 21:59:42 +0545 Subject: [PATCH 7/9] Use notPath regex for c3.php --- .php_cs.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.php_cs.dist b/.php_cs.dist index 808f366be6..b39856d30d 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -6,9 +6,9 @@ $config ->setUsingCache(true) ->getFinder() ->exclude('l10n') - ->notPath('/^c3.php/') ->exclude('vendor') ->exclude('vendor-bin') + ->notPath('/^c3.php/') ->in(__DIR__); return $config; From 6ce71fa8b2d696be426355640219bc18caf8ed3d Mon Sep 17 00:00:00 2001 From: Dipak Acharya Date: Mon, 19 Nov 2018 16:18:47 +0545 Subject: [PATCH 8/9] Fix acceptance test make target --- .drone.yml | 4 ++-- Makefile | 2 +- tests/acceptance.suite.yml | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 68bc90479f..16865fb304 100644 --- a/.drone.yml +++ b/.drone.yml @@ -92,7 +92,7 @@ pipeline: environment: - BROWSER=chrome - SELENIUM_HOST=selenium - - TEST_SERVER_URL=http://server + - TEST_SERVER_URL=http://owncloud - SELENIUM_PORT=4444 - PLATFORM=Linux - MAILHOG_HOST=email @@ -163,7 +163,7 @@ services: pull: true when: matrix: - TEST_SUITE: selenium + TEST_SUITE: acceptance matrix: include: diff --git a/Makefile b/Makefile index f2d7c008e2..61430dc3e8 100644 --- a/Makefile +++ b/Makefile @@ -126,7 +126,7 @@ test-php-integration: vendor/bin/codecept .PHONY: test-acceptance test-acceptance: test-acceptance: vendor/bin/codecept - php vendor/bin/codecept run acceptance --env chrome + php vendor/bin/codecept run acceptance .PHONY: test-php-style-fix test-php-style-fix: ## Run php-cs-fixer and fix code style issues diff --git a/tests/acceptance.suite.yml b/tests/acceptance.suite.yml index 0d9e46030b..9d9ce797af 100644 --- a/tests/acceptance.suite.yml +++ b/tests/acceptance.suite.yml @@ -10,8 +10,10 @@ modules: - \Helper\Acceptance - \Helper\DataSetup - WebDriver: - url: 'http://localhost:8000' - browser: phantomjs + url: 'http://owncloud' + browser: chrome + host: selenium + port: 4444 window_size: 960x1080 capabilities: unexpectedAlertBehaviour: 'accept' From bd675797e1c69c20059069045953ede70261e209 Mon Sep 17 00:00:00 2001 From: Dipak Acharya Date: Tue, 20 Nov 2018 11:41:04 +0545 Subject: [PATCH 9/9] Add lint tests and remove travis --- .drone.yml | 13 +++++ .travis.yml | 142 ---------------------------------------------------- Makefile | 8 +++ 3 files changed, 21 insertions(+), 142 deletions(-) delete mode 100644 .travis.yml diff --git a/.drone.yml b/.drone.yml index 16865fb304..3241e84379 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,6 +26,7 @@ pipeline: - php occ a:l - php occ a:e gallery - php occ a:e testing + - php occ a:d firstrunwizard - php occ a:l - php occ config:system:set trusted_domains 1 --value=owncloud - php occ log:manage --level 0 @@ -63,6 +64,15 @@ pipeline: matrix: TEST_SUITE: owncloud-coding-standard + php-lint-tests: + image: owncloudci/php:${PHP_VERSION} + pull: true + commands: + - make test-php-lint + when: + matrix: + TEST_SUITE: php-lint + phpunit-tests: image: owncloudci/php:${PHP_VERSION} pull: true @@ -171,6 +181,9 @@ matrix: - PHP_VERSION: 7.2 TEST_SUITE: owncloud-coding-standard + - PHP_VERSION: 7.2 + TEST_SUITE: php-lint + # Unit Tests - PHP_VERSION: 7.1 OC_VERSION: daily-master-qa diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1e489be1de..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,142 +0,0 @@ -sudo: false -language: php -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - -addons: - apt: - packages: - - graphviz - - gdb - firefox: latest - -env: - global: - - CORE_BRANCH=stable10 - - APP_NAME=gallery - - GH_REF: github.com/owncloud/gallery.git - - secure: "cLmMqrbVZrvn2GAoVs6JWa5h70tzrAISjPZUfENjl0KYT6B84z3B94W/dGU+I2mxwvyBqEP+x83Bih2CxEflqc7tJmdqC+MM/ZZiigPX7RCjq5XHbzUpPpMbC8MFxT2K3jcFXUitfwZvNaZXJIiK3ZQJU4ayKaegLvI91x1SqH0=" - - COVERAGE: '' - matrix: -# - DB=sqlite COVERAGE="--coverage --coverage-xml --coverage-html" - - DB=mysql - - DB=sqlite - -branches: - only: - - master - - /^stable\d+(\.\d+)?$/ - -cache: - directories: - # ${TRAVIS_BUILD_DIR} is /home/travis/build/owncloud/gallery/ - - ${TRAVIS_BUILD_DIR}/travis/php-cache - - ${TRAVIS_BUILD_DIR}/travis/lib-cache - - $HOME/.composer/cache - -before_cache: - # Archive the vendor folder. Watch closely! - - cp -r ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME/vendor ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum` - -before_install: - - php --modules - - # Setup Selenium - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - - sleep 3 - - wget https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz - - mkdir geckodriver - - tar -xzf geckodriver-v0.19.1-linux64.tar.gz -C geckodriver - - export PATH=$PATH:$PWD/geckodriver - - sh -c "if [ ! -e ${TRAVIS_BUILD_DIR}/travis/lib-cache/selenium.jar ]; then wget -O ${TRAVIS_BUILD_DIR}/travis/lib-cache/selenium.jar https://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.0.jar; fi;" - - java -jar ${TRAVIS_BUILD_DIR}/travis/lib-cache/selenium.jar -port 4444 >/dev/null 2>&1 & # WARNING - Takes a long time to start up. Keep here - - # Ghostdriver does not work on Travis - Download the latest PhantomJS - #- mkdir travis-phantomjs - #- sh -c "if [ ! -e ${TRAVIS_BUILD_DIR}/travis/lib-cache/phantomjs.tar.bz2 ]; then wget -O ${TRAVIS_BUILD_DIR}/travis/lib-cache/phantomjs.tar.bz2 https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2; fi;" - #- tar -xvf ${TRAVIS_BUILD_DIR}/travis/lib-cache/phantomjs.tar.bz2 - #- export PATH=${TRAVIS_BUILD_DIR}/travis/lib-cache/phantomjs:$PATH - #- phantomjs --webdriver=4444 --ignore-ssl-errors=true --webdriver-loglevel=DEBUG & - - # Get rid of Github limits - # Only enable temporarily when making large package changes with composer - #- git config --global github.accesstoken $GH_TOKEN - - # Make modifications to the environment to allow us to retrieve core dumps - # When debugging, make sure you enable sudo by commenting out the first line of this file - #- ulimit -c unlimited -S - #- cat /proc/sys/kernel/core_pattern - #- sh -c "if [ '$TRAVIS_PHP_VERSION' = '7.0' ]; then echo '/tmp/core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern; fi;" - #- cat /proc/sys/kernel/core_pattern - - # Installing the server - - wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh - - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB - - cd ../core - - php occ app:enable $APP_NAME - -before_script: - # Make sure Webdriver is running - - curl http://localhost:4444/wd/hub/status - #- phantomjs --version - - # Install the Imagick PHP extension - - sh -c "pecl config-set preferred_state beta; echo yes | printf "\n" | pecl install imagick;" - - # Sets up the PHP composer cache - - sh -c "if [ ! -d ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum` ]; then mkdir -p ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`; fi;" - - rm -rf ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME/vendor - - sh -c "if [ -d ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`/vendor ]; then cp -r ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`/vendor ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME; fi;" - - # Composer - - cd ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME - - composer self-update - - composer install -o --prefer-dist --no-interaction - - composer show -i - -script: - # Test lint - - php vendor/bin/parallel-lint --exclude vendor/composer/autoload_static.php --exclude travis --exclude vendor . vendor/composer vendor/symfony/yaml vendor/autoload.php - - # Acceptance tests, using Firefox, without code coverage - - php vendor/bin/codecept run acceptance --env firefox - # Unit, integration and api tests, without code coverage - - php vendor/bin/codecept run unit $COVERAGE - - php vendor/bin/codecept run integration $COVERAGE -# - php vendor/bin/codecept run api $COVERAGE - -after_success: - # Send coverage report to Scrutinizer - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '7.0' ] && [ '$DB' = 'mysql' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '7.0' ] && [ '$DB' = 'mysql' ]; then php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml; fi" - # coverage goes to codecov - - bash <(curl -s https://codecov.io/bash) -f tests/_output/coverage.xml - - # Generate API documentation - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '7.0' ] && [ '$DB' = 'mysql' ]; then php vendor/bin/phpdoc run; fi" - # Generate Wiki documentation - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '7.0' ] && [ '$DB' = 'mysql' ]; then git submodule update --init; fi" - # Send documentation to Github Pages - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '7.0' ] && [ '$DB' = 'mysql' ]; then cd build/documentation; bash ./docpublisher.sh; fi" - -after_failure: - - cat tests/_output/phpbuiltinserver.errors.txt - - bash build/after_failure.sh - -matrix: - include: - - php: 5.6 - env: DB=pgsql - - php: 7.0 - env: DB=sqlite - - php: 7.0 - env: DB=mysql - - php: 7.1 - env: DB=sqlite CORE_BRANCH=master - allow_failures: - - php: nightly - fast_finish: true diff --git a/Makefile b/Makefile index 61430dc3e8..b554d2c6f5 100644 --- a/Makefile +++ b/Makefile @@ -144,6 +144,11 @@ test-php-unit-dbg: ## Run php unit tests with php dbg test-php-unit-dbg: vendor/bin/phpunit $(PHPUNITDBG) --configuration ./phpunit.xml --testsuite unit +.PHONY: test-php-lint +test-php-lint: +test-php-lint: vendor/bin/parallel-lint + php vendor/bin/parallel-lint --exclude vendor/composer/autoload_static.php --exclude travis --exclude vendor --exclude vendor-bin . vendor/composer vendor/symfony/yaml vendor/autoload.php + # # Dependency management #-------------------------------------- @@ -159,6 +164,9 @@ test-php-unit-dbg: vendor/bin/phpunit vendor/bin/codecept: composer.lock composer install + vendor/bin/parallel-lint: composer.lock + composer install + vendor/bamarni/composer-bin-plugin: composer.lock composer install