From e6285bd8c298d0d8ce444092e124e602f180f961 Mon Sep 17 00:00:00 2001 From: Joseph White Date: Fri, 27 Jan 2017 10:02:19 -0500 Subject: [PATCH] Synchronise the CI setup with the XDMoD core. - Make sure phpcs settings are the same - Make sure new files are checked in travis. --- .travis.build.sh | 25 ++++++++++++++++++++++++- phpcs.xml | 27 +++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/.travis.build.sh b/.travis.build.sh index 6f497586..242be26f 100755 --- a/.travis.build.sh +++ b/.travis.build.sh @@ -35,7 +35,7 @@ if [ "$TEST_SUITE" = "syntax" ] || [ "$TEST_SUITE" = "style" ]; then files_changed=() while IFS= read -r -d $'\0' file; do files_changed+=("$file") - done < <(git diff --name-only --diff-filter=d -z "$TRAVIS_COMMIT_RANGE") + done < <(git diff --name-only --diff-filter=da -z "$TRAVIS_COMMIT_RANGE") # Separate the changed files by language. php_files_changed=() @@ -47,6 +47,17 @@ if [ "$TEST_SUITE" = "syntax" ] || [ "$TEST_SUITE" = "style" ]; then js_files_changed+=("$file") fi done + + # Get any added files by language + php_files_added=() + js_files_added=() + while IFS= read -r -d $'\0' file; do + if [[ "$file" == *.php ]]; then + php_files_added+=("$file") + elif [[ "$file" == *.js ]]; then + js_files_added+=("$file") + fi + done < <(git diff --name-only --diff-filter=A -z "$TRAVIS_COMMIT_RANGE") fi # Build tests require the corresponding version of Open XDMoD. @@ -121,6 +132,12 @@ elif [ "$TEST_SUITE" = "style" ]; then fi rm "$file.lint.new.json" done + for file in "${php_files_added[@]}"; do + phpcs "$file" + if [ $? != 0 ]; then + build_exit_value=2 + fi + done for file in "${js_files_changed[@]}"; do eslint "$file" -f json > "$file.lint.new.json" if [ $? != 0 ]; then @@ -133,6 +150,12 @@ elif [ "$TEST_SUITE" = "style" ]; then fi rm "$file.lint.new.json" done + for file in "${js_files_added[@]}"; do + eslint "$file" + if [ $? != 0 ]; then + build_exit_value=2 + fi + done elif [ "$TEST_SUITE" = "build" ]; then # If PHP 5.3.3 is installed, SSL/TLS isn't available to PHP. # Use a newer version of PHP for installing Composer dependencies. diff --git a/phpcs.xml b/phpcs.xml index ca5f9eda..6eb66934 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,6 +1,29 @@ XDMoD PHP coding standard - - + + + + + + + + + + + + + + + + + + + + + + + + +