diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..cc5112a3611 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,46 @@ +# Copyright 2017 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG BASE_IMAGE +FROM $BASE_IMAGE + +RUN mkdir -p /build && \ + apt-get update -y && \ + apt-get install -y -q --no-install-recommends \ + build-essential \ + g++ \ + gcc \ + libc-dev \ + make \ + autoconf + +COPY . /build/ + +WORKDIR /build/ext + +ENV TEST_PHP_ARGS="-q" \ + REPORT_EXIT_STATUS=1 + +RUN phpize && \ + ./configure --enable-stackdriver-trace && \ + make clean && \ + make && \ + make test && \ + make install + +WORKDIR /build + +RUN composer install && \ + vendor/bin/phpcs --standard=./phpcs-ruleset.xml && \ + vendor/bin/phpunit diff --git a/circle.yml b/circle.yml new file mode 100644 index 00000000000..9296470e5de --- /dev/null +++ b/circle.yml @@ -0,0 +1,19 @@ +machine: + timezone: America/Los_Angeles + environment: + GCLOUD_DIR: ${HOME}/gcloud + PATH: ${GCLOUD_DIR}/google-cloud-sdk/bin:${PATH} + CLOUDSDK_CORE_DISABLE_PROMPTS: 1 + CLOUDSDK_ACTIVE_CONFIG_NAME: opencensus-php + TEST_BUILD_DIR: ${HOME} + PHP_DOCKER_GOOGLE_CREDENTIALS: ${HOME}/credentials.json + GOOGLE_PROJECT_ID: php-stackdriver + TAG: circle-${CIRCLE_BUILD_NUM} + +dependencies: + override: + - scripts/install_test_dependencies.sh + +test: + override: + - scripts/run_test_suite.sh diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 00000000000..a5e67c064ac --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1,14 @@ +# This cloudbuild.yaml is used to test the php extension against multiple versions of php +steps: + - name: gcr.io/cloud-builders/docker + args: ['build', '--build-arg', 'BASE_IMAGE=gcr.io/google-appengine/php71', '.'] + waitFor: ['-'] + id: php71 + - name: gcr.io/cloud-builders/docker + args: ['build', '--build-arg', 'BASE_IMAGE=gcr.io/google-appengine/php70', '.'] + waitFor: ['-'] + id: php70 + - name: gcr.io/cloud-builders/docker + args: ['build', '--build-arg', 'BASE_IMAGE=gcr.io/php-mvm-a/php72:alpha3', '.'] + waitFor: ['-'] + id: php72 diff --git a/composer.json b/composer.json index 1dd891210aa..68ef29c6572 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "cache/adapter-common": "^1.0" }, "require-dev": { - "phpunit/phpunit": "4.8.*" + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*" }, "suggest": { "cache/apcu-adapter": "Enable QpsSampler to use apcu cache.", diff --git a/phpcs-ruleset.xml b/phpcs-ruleset.xml new file mode 100644 index 00000000000..b4467ac3fc5 --- /dev/null +++ b/phpcs-ruleset.xml @@ -0,0 +1,5 @@ + + + + src + diff --git a/scripts/dump_credentials.php b/scripts/dump_credentials.php new file mode 100644 index 00000000000..6c700e4cb20 --- /dev/null +++ b/scripts/dump_credentials.php @@ -0,0 +1,30 @@ +