From c2e4d5a28ed353a7698046b0c76b7e40759623e3 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 11 Jun 2019 10:31:50 +0100 Subject: [PATCH] Tweak travis scripts --- .scrutinizer.yml | 29 +++++++++++++++++++++++++++++ .travis.yml | 11 ++--------- unit-tests/bin/install.sh | 5 +++++ unit-tests/bin/travis.sh | 12 ------------ 4 files changed, 36 insertions(+), 21 deletions(-) create mode 100644 .scrutinizer.yml delete mode 100755 unit-tests/bin/travis.sh diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 00000000000..261f5dcc6d9 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,29 @@ +tools: + php_code_sniffer: + config: + standard: WordPress + sensiolabs_security_checker: true + external_code_coverage: + timeout: 2500 +checks: + php: + avoid_closing_tag: false + avoid_superglobals: false + coding_standard: + name: WordPress + no_exit: false + no_global_keyword: false + one_class_per_file: false + psr2_class_declaration: false + psr2_control_structure_declaration: false + psr2_switch_declaration: false + variable_existence: false + verify_access_scope_valid: false + verify_argument_usable_as_reference: false + verify_property_names: false +filter: + excluded_paths: + - src/RestApi/Version1/ + - src/RestApi/Version2/ + - src/RestApi/Version3/ + - unit-tests/ diff --git a/.travis.yml b/.travis.yml index c5344bbe4f8..2b445c3ded6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: php - +dist: trusty sudo: required matrix: @@ -10,20 +10,13 @@ matrix: - name: "PHP 7.1 unit tests" php: 7.1 env: WP_VERSION=latest WP_MULTISITE=0 WP_CORE_DIR=/tmp/wordpress - - name: "PHP 7.0 unit tests" - php: 7.0 - env: WP_VERSION=latest WP_MULTISITE=0 WP_CORE_DIR=/tmp/wordpress - - name: "PHP 5.6 unit tests" - php: 5.6 - env: WP_VERSION=latest WP_MULTISITE=0 WP_CORE_DIR=/tmp/wordpress before_script: - phpenv config-rm xdebug.ini - export PATH="$WP_CORE_DIR/wp-content/plugins/woocommerce-rest-api/vendor/bin:$PATH" - bash unit-tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION - - bash unit-tests/bin/travis.sh before - - timedatectl script: + - composer install - bash unit-tests/bin/phpunit.sh - bash unit-tests/bin/phpcs.sh \ No newline at end of file diff --git a/unit-tests/bin/install.sh b/unit-tests/bin/install.sh index d5579b4a5f5..d730a3d1b73 100755 --- a/unit-tests/bin/install.sh +++ b/unit-tests/bin/install.sh @@ -186,6 +186,11 @@ install_deps() { php wp-cli.phar plugin activate woocommerce php wp-cli.phar plugin activate woocommerce-admin + if [ "$BRANCH" != "" ]; then + # Install the correct branch of the plugin, if running from Travis CI. + php wp-cli.phar plugin install https://github.com/$REPO/archive/$BRANCH.zip --activate + fi + # Back to original dir cd "$WORKING_DIR" } diff --git a/unit-tests/bin/travis.sh b/unit-tests/bin/travis.sh deleted file mode 100755 index e7b020cc9ac..00000000000 --- a/unit-tests/bin/travis.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# usage: travis.sh before|after - -if [ $1 == 'before' ]; then - - if [[ ${RUN_PHPCS} == 1 ]]; then - cd "$WP_CORE_DIR/wp-content/plugins/woocommerce-rest-api/" - # This can (currently) only run for PHP 7.1+ - composer install - fi - -fi