Tweak travis scripts

This commit is contained in:
Mike Jolley 2019-06-11 10:31:50 +01:00
parent 6dc3999ff9
commit c2e4d5a28e
4 changed files with 36 additions and 21 deletions

29
.scrutinizer.yml Normal file
View File

@ -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/

View File

@ -1,5 +1,5 @@
language: php language: php
dist: trusty
sudo: required sudo: required
matrix: matrix:
@ -10,20 +10,13 @@ matrix:
- name: "PHP 7.1 unit tests" - name: "PHP 7.1 unit tests"
php: 7.1 php: 7.1
env: WP_VERSION=latest WP_MULTISITE=0 WP_CORE_DIR=/tmp/wordpress 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: before_script:
- phpenv config-rm xdebug.ini - phpenv config-rm xdebug.ini
- export PATH="$WP_CORE_DIR/wp-content/plugins/woocommerce-rest-api/vendor/bin:$PATH" - 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/install.sh woocommerce_test root '' localhost $WP_VERSION
- bash unit-tests/bin/travis.sh before
- timedatectl
script: script:
- composer install
- bash unit-tests/bin/phpunit.sh - bash unit-tests/bin/phpunit.sh
- bash unit-tests/bin/phpcs.sh - bash unit-tests/bin/phpcs.sh

View File

@ -186,6 +186,11 @@ install_deps() {
php wp-cli.phar plugin activate woocommerce php wp-cli.phar plugin activate woocommerce
php wp-cli.phar plugin activate woocommerce-admin 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 # Back to original dir
cd "$WORKING_DIR" cd "$WORKING_DIR"
} }

View File

@ -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