From 0d958447c9aa0c506202060131383d74c8ecaade Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 17 Jun 2021 13:27:41 -0700 Subject: [PATCH 01/10] test using a single container with multiple php versions --- .kokoro/php73.cfg | 2 +- .kokoro/php74.cfg | 2 +- .kokoro/php80.cfg | 2 +- .kokoro/system_tests.sh | 15 +++++++++++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.kokoro/php73.cfg b/.kokoro/php73.cfg index 7105905259..bd7d481e5e 100644 --- a/.kokoro/php73.cfg +++ b/.kokoro/php73.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php73" + value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test" } # Give the docker image a unique project ID and credentials per PHP version diff --git a/.kokoro/php74.cfg b/.kokoro/php74.cfg index c6409b06a7..d08cfa24a2 100644 --- a/.kokoro/php74.cfg +++ b/.kokoro/php74.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php74" + value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test" } # Give the docker image a unique project ID and credentials per PHP version diff --git a/.kokoro/php80.cfg b/.kokoro/php80.cfg index f5837873dc..2c745a7a33 100644 --- a/.kokoro/php80.cfg +++ b/.kokoro/php80.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php80" + value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test" } # Give the docker image a unique project ID and credentials per PHP version diff --git a/.kokoro/system_tests.sh b/.kokoro/system_tests.sh index 0b0a149f17..35f76b79cf 100755 --- a/.kokoro/system_tests.sh +++ b/.kokoro/system_tests.sh @@ -50,10 +50,21 @@ mkdir -p build/logs export PULL_REQUEST_NUMBER=$KOKORO_GITHUB_PULL_REQUEST_NUMBER +# decide which php version to use (this is for TESTING ONLY) +if [ "3" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then + phpbrew switch "7.3.28" +elif [ "1" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then + phpbrew switch "7.4.20" +elif [ "2" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then + phpbrew switch "8.0.7" +else + # By default use PHP 7.4 + phpbrew switch "7.4.20" +fi + # If we are running REST tests, disable gRPC if [ "${RUN_REST_TESTS_ONLY}" = "true" ]; then - GRPC_INI=$(php -i | grep grpc.ini | sed 's/^Additional .ini files parsed => //g' | sed 's/,*$//g' ) - mv $GRPC_INI "${GRPC_INI}.disabled" + phpbrew ext disable grpc fi # Install global test dependencies From 0f9f07ec90a1f0ce15d423e5df2039b9d5f75e7c Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 17 Jun 2021 13:38:40 -0700 Subject: [PATCH 02/10] load phpbrew shell --- .kokoro/lint.cfg | 2 +- .kokoro/php_rest.cfg | 2 +- .kokoro/system_tests.sh | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.kokoro/lint.cfg b/.kokoro/lint.cfg index 5f9ed254e8..43ac7fa51e 100644 --- a/.kokoro/lint.cfg +++ b/.kokoro/lint.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php74" + value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test" } env_vars: { diff --git a/.kokoro/php_rest.cfg b/.kokoro/php_rest.cfg index e2b32adcf2..459d4fadf5 100644 --- a/.kokoro/php_rest.cfg +++ b/.kokoro/php_rest.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php73" + value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test" } # Set this project to run REST tests only diff --git a/.kokoro/system_tests.sh b/.kokoro/system_tests.sh index 35f76b79cf..e1ff51e093 100755 --- a/.kokoro/system_tests.sh +++ b/.kokoro/system_tests.sh @@ -50,16 +50,19 @@ mkdir -p build/logs export PULL_REQUEST_NUMBER=$KOKORO_GITHUB_PULL_REQUEST_NUMBER +# Load phpbrew shell +source $HOME/.phpbrew/bashrc + # decide which php version to use (this is for TESTING ONLY) -if [ "3" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then +if [ -z "${GOOGLE_ALT_PROJECT_ID}" ]; then + # By default use PHP 7.4 + phpbrew switch "7.4.20" +elif [ "3" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then phpbrew switch "7.3.28" elif [ "1" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then phpbrew switch "7.4.20" elif [ "2" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then phpbrew switch "8.0.7" -else - # By default use PHP 7.4 - phpbrew switch "7.4.20" fi # If we are running REST tests, disable gRPC From f79c5c30666cb99290d49aefc05266c130c9a7a8 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 17 Jun 2021 14:34:32 -0700 Subject: [PATCH 03/10] WIP --- .kokoro/system_tests.sh | 10 +++++----- .php_cs.dist => .php-cs-fixer.dist.php | 0 2 files changed, 5 insertions(+), 5 deletions(-) rename .php_cs.dist => .php-cs-fixer.dist.php (100%) diff --git a/.kokoro/system_tests.sh b/.kokoro/system_tests.sh index e1ff51e093..bec8c7b774 100755 --- a/.kokoro/system_tests.sh +++ b/.kokoro/system_tests.sh @@ -51,18 +51,18 @@ mkdir -p build/logs export PULL_REQUEST_NUMBER=$KOKORO_GITHUB_PULL_REQUEST_NUMBER # Load phpbrew shell -source $HOME/.phpbrew/bashrc +source /root/.phpbrew/bashrc # decide which php version to use (this is for TESTING ONLY) if [ -z "${GOOGLE_ALT_PROJECT_ID}" ]; then # By default use PHP 7.4 - phpbrew switch "7.4.20" + phpbrew switch $(phpbrew list | grep 7.4) elif [ "3" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then - phpbrew switch "7.3.28" + phpbrew switch $(phpbrew list | grep 7.3) elif [ "1" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then - phpbrew switch "7.4.20" + phpbrew switch $(phpbrew list | grep 7.4) elif [ "2" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then - phpbrew switch "8.0.7" + phpbrew switch $(phpbrew list | grep 8.0) fi # If we are running REST tests, disable gRPC diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php similarity index 100% rename from .php_cs.dist rename to .php-cs-fixer.dist.php From 71332b2f01bbaf67ed777d94f6ffd082e5ae6f88 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 17 Jun 2021 14:44:02 -0700 Subject: [PATCH 04/10] switch deploy containers also --- .kokoro/deploy_gae.cfg | 2 +- .kokoro/deploy_gcf.cfg | 2 +- .kokoro/deploy_misc.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.kokoro/deploy_gae.cfg b/.kokoro/deploy_gae.cfg index 7b53066472..105cd4561f 100644 --- a/.kokoro/deploy_gae.cfg +++ b/.kokoro/deploy_gae.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php74" + value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test" } # Run the deployment tests diff --git a/.kokoro/deploy_gcf.cfg b/.kokoro/deploy_gcf.cfg index cb204a4808..351734c429 100644 --- a/.kokoro/deploy_gcf.cfg +++ b/.kokoro/deploy_gcf.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php74" + value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test" } # Run the deployment tests diff --git a/.kokoro/deploy_misc.cfg b/.kokoro/deploy_misc.cfg index d5dee66881..2adab9ec79 100644 --- a/.kokoro/deploy_misc.cfg +++ b/.kokoro/deploy_misc.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/php74" + value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test" } # Run the deployment tests From ad5f71e277f4b88d70a12fc1e1ab4088273add4b Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 21 Jun 2021 11:32:45 -0700 Subject: [PATCH 05/10] fix linter --- testing/run_cs_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/run_cs_check.sh b/testing/run_cs_check.sh index 4415407ee4..411a0a63bd 100755 --- a/testing/run_cs_check.sh +++ b/testing/run_cs_check.sh @@ -26,4 +26,4 @@ fi PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.." DIR="${1:-$PROJECT_ROOT}" -$PHP_CS_FIXER fix --dry-run --diff --config="${PROJECT_ROOT}/.php_cs.dist" --path-mode=intersection $DIR +$PHP_CS_FIXER fix --dry-run --diff --config="${PROJECT_ROOT}/.php-cs-fixer.dist.php" --path-mode=intersection $DIR From 37a15a87e1bb9636faa6f474cc418e2bf7129e1f Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 22 Jun 2021 11:50:26 -0700 Subject: [PATCH 06/10] fix php-cs-fixer --- .php-cs-fixer.dist.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 18962d967c..9766ebe1d2 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,6 +1,6 @@ setRules([ '@PSR2' => true, 'concat_space' => ['spacing' => 'one'], @@ -10,6 +10,7 @@ 'method_argument_space' => [ 'keep_multiple_spaces_after_comma' => true ], + 'native_function_invocation' => true, 'return_type_declaration' => [ 'space_before' => 'none' ], From 1be769386b13cb2ac89d9d29abbc8361520cda9a Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 22 Jun 2021 11:59:29 -0700 Subject: [PATCH 07/10] ignore multiline formats for now --- .php-cs-fixer.dist.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 9766ebe1d2..b70d6a3e5c 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -8,9 +8,9 @@ 'method_argument_space' => false, 'whitespace_after_comma_in_array' => true, 'method_argument_space' => [ - 'keep_multiple_spaces_after_comma' => true + 'keep_multiple_spaces_after_comma' => true, // for wordpress constants + 'on_multiline' => 'ignore', // consider removing this someday ], - 'native_function_invocation' => true, 'return_type_declaration' => [ 'space_before' => 'none' ], From 1d6dde6e2033b8d349105fe8bcf1cc6b02703ddf Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Wed, 23 Jun 2021 12:09:34 -0700 Subject: [PATCH 08/10] ignore php-cs-fixer cache --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 068897c41f..efd7c43601 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ credentials.* .vscode/ .kokoro/secrets.sh .phpunit.result.cache +.php-cs-fixer.cache From ed4fba29dbca1d68f06a01a925989beac88acfd0 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 18 Oct 2021 16:40:01 -0700 Subject: [PATCH 09/10] remove already-added gitignore --- .gitignore | 1 - .kokoro/system_tests.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e78117315e..e1393d9f6c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ credentials.* .vscode/ .kokoro/secrets.sh .phpunit.result.cache -.php-cs-fixer.cache diff --git a/.kokoro/system_tests.sh b/.kokoro/system_tests.sh index bec8c7b774..ed0ae045f0 100755 --- a/.kokoro/system_tests.sh +++ b/.kokoro/system_tests.sh @@ -53,7 +53,7 @@ export PULL_REQUEST_NUMBER=$KOKORO_GITHUB_PULL_REQUEST_NUMBER # Load phpbrew shell source /root/.phpbrew/bashrc -# decide which php version to use (this is for TESTING ONLY) +# decide which php version to use if [ -z "${GOOGLE_ALT_PROJECT_ID}" ]; then # By default use PHP 7.4 phpbrew switch $(phpbrew list | grep 7.4) From 36fb683e0bdb73c4dcaf6450ba563a0db2e6afb4 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 19 Oct 2021 11:58:25 -0700 Subject: [PATCH 10/10] fix a few bugs --- .kokoro/system_tests.sh | 18 ++++++++++-------- testing/run_cs_check.sh | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.kokoro/system_tests.sh b/.kokoro/system_tests.sh index ed0ae045f0..eccb5140d8 100755 --- a/.kokoro/system_tests.sh +++ b/.kokoro/system_tests.sh @@ -53,18 +53,20 @@ export PULL_REQUEST_NUMBER=$KOKORO_GITHUB_PULL_REQUEST_NUMBER # Load phpbrew shell source /root/.phpbrew/bashrc -# decide which php version to use -if [ -z "${GOOGLE_ALT_PROJECT_ID}" ]; then - # By default use PHP 7.4 - phpbrew switch $(phpbrew list | grep 7.4) -elif [ "3" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then - phpbrew switch $(phpbrew list | grep 7.3) +# Decide which php version to use. +if [ "3" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then + PHP_VERSION="7.3" elif [ "1" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then - phpbrew switch $(phpbrew list | grep 7.4) + PHP_VERSION="7.4" elif [ "2" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then - phpbrew switch $(phpbrew list | grep 8.0) + PHP_VERSION="8.0" +else + # By default use PHP 7.4 + PHP_VERSION="7.4" fi +phpbrew switch $(phpbrew list | grep $PHP_VERSION | cut -c 2-) + # If we are running REST tests, disable gRPC if [ "${RUN_REST_TESTS_ONLY}" = "true" ]; then phpbrew ext disable grpc diff --git a/testing/run_cs_check.sh b/testing/run_cs_check.sh index 2a43deb48a..c28fb5842b 100755 --- a/testing/run_cs_check.sh +++ b/testing/run_cs_check.sh @@ -22,7 +22,7 @@ DIR="${1:-$PROJECT_ROOT}" cd $PROJECT_ROOT # install local version of php-cs-fixer 3.0 from composer.json -composer -q install -d testing/ +composer install -d testing/ # run php-cs-fixer PHP_CS_FIXER="php-cs-fixer"