Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (40 sloc) 2.8 KB
sudo: false
language: php
php:
- '5.6'
- '7.0'
- '7.2'
- '7.3'
- nightly
matrix:
include:
# Arbitrary PHP version to run the sniffs against.
- php: '7.3'
env: SNIFF=1
allow_failures:
- php: nightly # Old phpunit not compatible with PHP 8.0.0 yet
before_install:
# Set the target directories and versions for PHP_CodeSniffer, WP Coding Standards and PHPCS Security Audit.
- if [[ "$SNIFF" == "1" ]]; then export PHPCS_DIR=/tmp/phpcs; export PHPCS_VERSION=3.3.2; fi
- if [[ "$SNIFF" == "1" ]]; then export WP_SNIFFS_DIR=/tmp/wp-sniffs; export WP_SNIFFS_VERSION=2.1.0; fi
- if [[ "$SNIFF" == "1" ]]; then export SECURITY_SNIFFS_DIR=/tmp/security-sniffs; export SECURITY_SNIFFS_VERSION=2.0.0; fi
- if [[ "$SNIFF" == "1" ]]; then export PHP_COMPATIBILITY_SNIFFS_DIR=/tmp/compatibility-sniffs; export PHP_COMPATIBILITY_SNIFFS_VERSION=9.1.1; fi
# Install PHP_CodeSniffer.
- if [[ "$SNIFF" == "1" ]]; then wget https://github.com/squizlabs/PHP_CodeSniffer/archive/$PHPCS_VERSION.tar.gz -O $PHPCS_VERSION.tar.gz && tar -xf $PHPCS_VERSION.tar.gz && mv PHP_CodeSniffer-$PHPCS_VERSION $PHPCS_DIR; fi
# Install WordPress Coding Standards.
- if [[ "$SNIFF" == "1" ]]; then wget https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/archive/$WP_SNIFFS_VERSION.tar.gz -O $WP_SNIFFS_VERSION.tar.gz && tar -xf $WP_SNIFFS_VERSION.tar.gz && mv WordPress-Coding-Standards-$WP_SNIFFS_VERSION $WP_SNIFFS_DIR; fi
# Install PHPCS Security Audit.
- if [[ "$SNIFF" == "1" ]]; then wget https://github.com/FloeDesignTechnologies/phpcs-security-audit/archive/$SECURITY_SNIFFS_VERSION.tar.gz -O $SECURITY_SNIFFS_VERSION.tar.gz && tar -xf $SECURITY_SNIFFS_VERSION.tar.gz && mv phpcs-security-audit-$SECURITY_SNIFFS_VERSION $SECURITY_SNIFFS_DIR; fi
# Install PHP Compatibility.
- if [[ "$SNIFF" == "1" ]]; then wget https://github.com/PHPCompatibility/PHPCompatibility/archive/$PHP_COMPATIBILITY_SNIFFS_VERSION.tar.gz -O $PHP_COMPATIBILITY_SNIFFS_VERSION.tar.gz && tar -xf $PHP_COMPATIBILITY_SNIFFS_VERSION.tar.gz && mv PHPCompatibility-$PHP_COMPATIBILITY_SNIFFS_VERSION $PHP_COMPATIBILITY_SNIFFS_DIR; fi
# Set install path for sniffs.
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs --config-set installed_paths $WP_SNIFFS_DIR,$SECURITY_SNIFFS_DIR,$PHP_COMPATIBILITY_SNIFFS_DIR; fi
# Show installed sniffs
- if [[ "$SNIFF" == "1" ]]; then ${PHPCS_DIR}/bin/phpcs -i; fi
# After CodeSniffer install you should refresh your path.
- if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi
script:
# Syntax check all php files and fail for any error text in STDERR
- '! find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"'
# More extensive PHP Style Check
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs -i; $PHPCS_DIR/bin/phpcs -ns --standard=phpcs.xml; fi
You can’t perform that action at this time.