Skip to content

Commit

Permalink
Adjust CI scripts to current standard
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Nov 30, 2018
1 parent 0d5a0cd commit 4c5395b
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 1,223 deletions.
207 changes: 137 additions & 70 deletions .drone.yml

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
/build
/l10n/.transifexrc
.php_cs.cache

# Composer
/vendor
vendor-bin/**/vendor
vendor-bin/**/composer.lock

# Tests - auto-generated files
/tests/acceptance/output*
/tests/output

# just sane ignores
.*.sw[po]
Expand Down Expand Up @@ -44,7 +54,3 @@ nbproject

# Mac OS
.DS_Store

tests/acceptance/output
tests/unit/clover.xml
.php_cs.cache
93 changes: 89 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ composer_deps=vendor
composer_dev_deps=vendor/php-cs-fixer
COMPOSER_BIN=$(build_dir)/composer.phar


# signing
occ=$(CURDIR)/../../occ
private_key=$(HOME)/.owncloud/certificates/$(app_name).key
certificate=$(HOME)/.owncloud/certificates/$(app_name).crt
Expand All @@ -29,6 +29,12 @@ endif
endif
endif

# bin file definitions
PHPUNIT=php -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit"
PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit"
PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer
PHAN=php -d zend.enable_gc=0 vendor-bin/phan/vendor/bin/phan
PHPSTAN=php -d zend.enable_gc=0 vendor-bin/phpstan/vendor/bin/phpstan


.PHONY: clean
Expand Down Expand Up @@ -90,6 +96,55 @@ else
endif
tar -czf $(appstore_package_name).tar.gz -C $(appstore_package_name)/../ $(app_name)

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

.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 using phpdbg
test-php-unit-dbg: vendor/bin/phpunit
$(PHPUNITDBG) --configuration ./phpunit.xml --testsuite unit

.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-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-phan
test-php-phan: ## Run phan
test-php-phan: vendor-bin/phan/vendor
$(PHAN) --config-file .phan/config.php --require-config-exists

.PHONY: test-php-phpstan
test-php-phpstan: ## Run phpstan
test-php-phpstan: vendor-bin/phpstan/vendor
$(PHPSTAN) analyse --memory-limit=4G --configuration=./phpstan.neon --no-progress --level=5 appinfo lib

.PHONY: test-acceptance-api
test-acceptance-api: ## Run API acceptance tests
test-acceptance-api: vendor/bin/phpunit
../../tests/acceptance/run.sh --remote --type api

.PHONY: test-acceptance-cli
test-acceptance-cli: ## Run CLI acceptance tests
test-acceptance-cli: vendor/bin/phpunit
../../tests/acceptance/run.sh --remote --type cli

.PHONY: test-acceptance-webui
test-acceptance-webui: ## Run webUI acceptance tests
test-acceptance-webui: vendor/bin/phpunit
../../tests/acceptance/run.sh --remote --type webUI

.PHONY: test-php-codecheck
test-php-codecheck:
$(occ) app:check-code $(app_name) -c private -c strong-comparison
Expand All @@ -99,6 +154,36 @@ test-php-codecheck:
test-php-lint:
../../lib/composer/bin/parallel-lint . --exclude 3rdparty --exclude build .

.PHONY: test-php-style
test-php-style: $(composer_dev_deps)
$(composer_deps)/bin/php-cs-fixer fix -v --diff --diff-format udiff --dry-run --allow-risky yes
#
# 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/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.

vendor-bin/phan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phan/composer.lock
composer bin phan install --no-progress

vendor-bin/phan/composer.lock: vendor-bin/phan/composer.json
@echo phan composer.lock is not up to date.

vendor-bin/phpstan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phpstan/composer.lock
composer bin phpstan install --no-progress

vendor-bin/phpstan/composer.lock: vendor-bin/phpstan/composer.json
@echo phpstan composer.lock is not up to date.
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
"php": "5.6"
}
},
"require": {
},
"require-dev": {
"owncloud/coding-standard": "^1.0"
"bamarni/composer-bin-plugin": "^1.2"
},
"extra": {
"bamarni-bin": {
"bin-links": false
}
}
}
Loading

0 comments on commit 4c5395b

Please sign in to comment.