From 01052bf8af223b379b54652568a2301767550e7b Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 25 Apr 2020 00:49:05 +0100 Subject: [PATCH] Revamp testing Add a composer.json file Bring in squizlabs/php_codesniffer and phpcompatibility/php-compatibility via composer Do php linting via jakub-onderka/php-parallel-lint --- .travis.yml | 21 +++------------------ composer.json | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 composer.json diff --git a/.travis.yml b/.travis.yml index 28668e83..72c7fa7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,24 +13,9 @@ matrix: allow_failures: - php: nightly -before_install: - - if [[ "$SNIFF" == "1" ]]; then export PHPCS_DIR=/tmp/phpcs; fi - - if [[ "$SNIFF" == "1" ]]; then export PHPCOMPAT_DIR=/tmp/PHPCompatibility; fi - # Install PHP CodeSniffer - - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi - # Install PHP Compatibility Standard - - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $PHPCOMPAT_DIR; fi - # Set install path for PHP Compatibility Standard - # @link https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-installed-standard-paths - - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs --config-set installed_paths $PHPCOMPAT_DIR; fi - # Refresh path - - if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi - +before_script: + - composer install --prefer-source --quiet --no-interaction # Run test script commands. -# All commands must exit with code 0 on success. Anything else is considered failure. script: - # Search for PHP syntax errors - - find -L . -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l - # Run PHPCS - - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs . ; fi + - composer test diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..fb900ec2 --- /dev/null +++ b/composer.json @@ -0,0 +1,19 @@ +{ + "name": "billz/raspap-webgui", + "homepage": "https://raspap.com/", + "license": "GPL-3.0", + "keywords": ["raspberrypi"], + "require-dev": { + "jakub-onderka/php-parallel-lint": "1.0.0", + "phpcompatibility/php-compatibility": "^9.3.5", + "squizlabs/php_codesniffer": "^3.5.5" + }, + "scripts": { + "lint": "parallel-lint . --exclude vendor", + "phpcs": "phpcs -p -s --config-set installed_paths vendor/phpcompatibility/php-compatibility .", + "test": [ + "composer lint", + "composer phpcs" + ] + } +}