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

[stable10] drop php 5.6 support #34698

Merged
merged 10 commits into from
Mar 12, 2019
58 changes: 42 additions & 16 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,21 @@ pipeline:
composer:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- COMPOSER_HOME=/drone/src/.cache/composer
commands:
- make install-composer-deps
- make vendor-bin-deps
when:
event: [push, pull_request]

yarn:
image: owncloudci/nodejs:latest
pull: true
environment:
- NPM_CONFIG_CACHE=/drone/src/.cache/npm
- YARN_CACHE_FOLDER=/drone/src/.cache/yarn
- bower_storage__packages=/drone/src/.cache/bower
commands:
- ./tests/drone/yarn-install.sh
when:
Expand All @@ -79,9 +86,7 @@ pipeline:
secrets: [ cache_s3_endpoint, cache_s3_access_key, cache_s3_secret_key ]
rebuild: true
mount:
- lib/composer
- core/vendor
- build/node_modules
- .cache
when:
local: false
event: [ push ]
Expand Down Expand Up @@ -116,7 +121,7 @@ pipeline:
- make test-php-phan
when:
matrix:
TEST_SUITE: phan
TEST_SUITE: phan-70

php-phan-71:
image: owncloudci/php:7.1
Expand Down Expand Up @@ -629,19 +634,15 @@ matrix:
PHP_VERSION: 7.1
COVERAGE: true

- PHP_VERSION: 5.6
DB_TYPE: postgres
TEST_SUITE: phpunit
INSTALL_SERVER: true
INSTALL_TESTING_APP: true

# owncloud-coding-standard
# Run with PHP 5.6 because that is not supported by phan.
# This gives us a syntax check for PHP 5.6
- PHP_VERSION: 5.6
- PHP_VERSION: 7.1
TEST_SUITE: owncloud-coding-standard

# phan (runs multiple PHP v7.* to provide syntax checks of each PHP version)
# phan (runs on just PHP 7.0 because that has different dependencies for phan)
- TEST_SUITE: phan-70
PHP_VERSION: 7.0

# phan (runs multiple PHP v7.1+ to provide syntax checks of each PHP version)
- TEST_SUITE: phan
PHP_VERSION: 7.1

Expand Down Expand Up @@ -688,6 +689,31 @@ matrix:
INSTALL_SERVER: true
INSTALL_TESTING_APP: true

# PHP 7.0
- PHP_VERSION: 7.0
DB_TYPE: mysql
TEST_SUITE: phpunit
INSTALL_SERVER: true
INSTALL_TESTING_APP: true

- PHP_VERSION: 7.0
DB_TYPE: mysqlmb4
TEST_SUITE: phpunit
INSTALL_SERVER: true
INSTALL_TESTING_APP: true

- PHP_VERSION: 7.0
DB_TYPE: postgres
TEST_SUITE: phpunit
INSTALL_SERVER: true
INSTALL_TESTING_APP: true

- PHP_VERSION: 7.0
DB_TYPE: oracle
TEST_SUITE: phpunit
INSTALL_SERVER: true
INSTALL_TESTING_APP: true

# PHP 7.2
- PHP_VERSION: 7.2
DB_TYPE: sqlite
Expand Down Expand Up @@ -735,7 +761,7 @@ matrix:
INSTALL_TESTING_APP: true

# Primary Objectstorage
- PHP_VERSION: 5.6
- PHP_VERSION: 7.0
TEST_SUITE: phpunit
DB_TYPE: sqlite
OBJECTSTORE: swift
Expand Down Expand Up @@ -1462,7 +1488,7 @@ matrix:
CALDAV_CARDDAV_JOB: true

# encryption tests
- PHP_VERSION: 5.6
- PHP_VERSION: 7.0
TEST_SUITE: cli
BEHAT_SUITE: cliEncryption
DB_TYPE: mariadb
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@ clover.xml
/tests/output
.php_cs.cache
.php_cs

# CI
.cache
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ vendor: composer.lock
vendor/bamarni/composer-bin-plugin: composer.lock
composer install

.PHONY: vendor-bin-deps
vendor-bin-deps: vendor-bin/owncloud-codestyle/vendor vendor-bin/php_codesniffer/vendor vendor-bin/phan/vendor vendor-bin/phpstan/vendor vendor-bin/behat/vendor

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

Expand All @@ -381,8 +384,17 @@ vendor-bin/phan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phan/compo
vendor-bin/phan/composer.lock: vendor-bin/phan/composer.json
@echo phan composer.lock is not up to date.

# The first line of "php --version" output looks like:
# PHP 7.2.16-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:23:29) ( NTS )
# We want the 2nd "word", then the first 2 numbers separated by the dot
PHP_MINOR_VERSION = $(shell php --version | head -n 1 | cut -d' ' -f2 | cut -d'.' -f1-2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While head/cut are quite standard unix tools - not sure if they will be always available everywhere 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What tools+algorithm is good/portable to use for extracting the 7.n out of the first line of the php --version output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrickjahns head and cut should be in any developer's *nix, and with these "standard" simple options. Hopefully they would be on a developer's Mac?
Also, this code will only exist in stable10 and only until we drop PHP 7.0.
What would you like me to do?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if Mac users complain, they can feel free to send a PR to adjust the Makefile to make it work on they envs.

OC server isn't supported on Mac so developers should not develop directly on Macs, else they're on their own...


vendor-bin/phpstan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phpstan/composer.lock
ifeq "$(PHP_MINOR_VERSION)" "7.0"
@echo "phpstan is not supported on PHP 7.0 so it is not being installed"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will still try to run phpstan later on - just the installation is aborted

Copy link
Contributor Author

@phil-davis phil-davis Mar 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes,
when a "general" dependency target is called, like the drone composer: step:

      - make install-composer-deps
      - make vendor-bin-deps

and the PHP version is 7.0
then the make will succeed - it will install owncloud-codestyle phan behat and whatever...
but it will not try to install phpstan (because that "just can't work")

And later steps in the pipeline can happily run code-style checks, phan, behat test tools.

If a later step tries to run phpstan then it a will fail with a "file not found" error. But that is fine, someone who tries to explicitly add a matrix entry for phpstan on PHP 7.0 will see it fail, do a bit of research, and quickly discover that phpstan does not run on PHP 7.0

else
composer bin phpstan install --no-progress
endif

vendor-bin/phpstan/composer.lock: vendor-bin/phpstan/composer.json
@echo phpstan composer.lock is not up to date.
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"optimize-autoloader": true,
"classmap-authoritative": false,
"platform": {
"php": "5.6.33"
"php": "7.0.8"
}
},
"autoload" : {
Expand All @@ -26,7 +26,7 @@
"roave/security-advisories": "dev-master"
},
"require": {
"php": ">=5.6",
"php": ">=7.0.8",
"doctrine/dbal": "^2.5",
"phpseclib/phpseclib": "^2.0",
"rackspace/php-opencloud": "v1.9.2",
Expand Down
Loading