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

feat(tests): use a single container with multiple php versions #1394

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .kokoro/deploy_gae.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

# Run the deployment tests
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/deploy_gcf.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

# Run the deployment tests
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/deploy_misc.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

# Run the deployment tests
Expand Down
12 changes: 12 additions & 0 deletions .kokoro/lint.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/php-docs-samples/testing/run_cs_check.sh"
}
2 changes: 1 addition & 1 deletion .kokoro/php80.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member

Choose a reason for hiding this comment

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

}

# Give the docker image a unique project ID and credentials per PHP version
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/php81.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/php81"
value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test"
}

# Give the docker image a unique project ID and credentials per PHP version
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/php82.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/php82"
value: "gcr.io/cloud-devrel-kokoro-resources/php-multi-test"
}

# Give the docker image a unique project ID and credentials per PHP version
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/php_rest.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

# Set this project to run REST tests only
Expand Down
20 changes: 18 additions & 2 deletions .kokoro/system_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,26 @@ mkdir -p build/logs

export PULL_REQUEST_NUMBER=$KOKORO_GITHUB_PULL_REQUEST_NUMBER

# Load phpbrew shell
source /root/.phpbrew/bashrc

# 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
PHP_VERSION="7.4"
elif [ "2" -eq ${GOOGLE_ALT_PROJECT_ID: -1} ]; then
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
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
Expand Down
2 changes: 1 addition & 1 deletion testing/run_cs_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down