Skip to content

Commit

Permalink
Merge pull request #16903 from Yoast/feature/JRF/CI/travis-run-phpcs-…
Browse files Browse the repository at this point in the history
…separately

Travis: run CS in separate workflow & other minor tweaks
  • Loading branch information
enricobattocchi committed Apr 22, 2021
2 parents 2297401 + 3f6ddf2 commit f11ea6a
Show file tree
Hide file tree
Showing 3 changed files with 277 additions and 36 deletions.
47 changes: 14 additions & 33 deletions .travis.yml
Expand Up @@ -25,7 +25,17 @@ jobs:
fast_finish: true
include:
- php: 7.2
env: PHPCS=1 CHECKJS=1 SECURITY=1 TRAVIS_NODE_VERSION=lts/* AUTO_CHECKOUT_MONOREPO_BRANCH=1
env: CHECKJS=1 SECURITY=1 TRAVIS_NODE_VERSION=lts/* AUTO_CHECKOUT_MONOREPO_BRANCH=1
- php: 7.4
name: 'PHP 7.4: Check CS'
before_install: skip
before_script: skip
install:
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
- travis_retry composer install --no-interaction
script:
- composer check-cs-threshold
after_script: skip
- php: 7.3.24
env: WP_VERSION=latest WP_MULTISITE=1 COVERAGE=1
- php: 5.6
Expand Down Expand Up @@ -117,7 +127,6 @@ cache:
before_install:
- export SECURITYCHECK_DIR=/tmp/security-checker
- if [[ -z "$CC_TEST_REPORTER_ID" ]]; then COVERAGE="0"; fi
- if [[ -d "premium" ]]; then IS_PREMIUM=1; fi
- if [[ "$COVERAGE" != "1" ]]; then phpenv config-rm xdebug.ini || echo 'No xdebug config.'; fi
- |
if [[ "$CHECKJS" == "1" ]]; then
Expand Down Expand Up @@ -146,25 +155,12 @@ install:
fi
- |
if [[ ${TRAVIS_PHP_VERSION:0:1} == "8" || $TRAVIS_PHP_VERSION == "nightly" ]]; then
if [[ "$IS_PREMIUM" == "1" ]]; then
cd premium
travis_retry composer install --no-interaction --ignore-platform-reqs --no-scripts --no-suggest
cd -
else
travis_retry composer install --no-interaction --ignore-platform-reqs --no-scripts --no-suggest
fi
elif [[ "$PHPUNIT" == "1" || "$COVERAGE" == "1" || "$PHPCS" == "1" || "$PHPLINT" == "1" ]]; then
travis_retry composer install --no-interaction --ignore-platform-reqs --no-scripts --no-suggest
elif [[ "$PHPUNIT" == "1" || "$COVERAGE" == "1" || "$PHPLINT" == "1" ]]; then
# Run composer update as we have dev dependencies locked at PHP ^7.0 versions.
travis_retry composer update
travis_retry composer install --no-interaction
composer du
if [[ "$IS_PREMIUM" == "1" ]]; then
if [[ "$PHPCS" == "1" || "$PHPLINT" == "1" ]]; then
cd premium
travis_retry composer install --no-interaction
cd -
fi
fi
elif [[ "$TRAVIS_BUILD_STAGE_NAME" == "🚀 deployment" ]]; then
travis_retry composer update
travis_retry composer install --no-dev --no-interaction
Expand Down Expand Up @@ -258,24 +254,9 @@ script:
- |
if [[ "$PHPLINT" == "1" ]]; then
travis_fold start "PHP.check" && travis_time_start
if [[ "$IS_PREMIUM" == "1" ]]; then
cd premium && composer lint && cd -
else
composer lint
fi
composer lint
travis_time_finish && travis_fold end "PHP.check"
fi
# PHP CS
- |
if [[ "$PHPCS" == "1" ]]; then
travis_fold start "PHP.code-style" && travis_time_start
if [[ "$IS_PREMIUM" == "1" ]]; then
cd premium && composer check-cs && cd -
else
composer check-cs-threshold
fi
travis_time_finish && travis_fold end "PHP.code-style"
fi
# PHP Unit
- |
if [[ "$PHPUNIT" == "1" && ${TRAVIS_PHP_VERSION:0:1} != "8" && $TRAVIS_PHP_VERSION != "nightly" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -80,7 +80,7 @@
"Yoast\\WP\\SEO\\Composer\\Actions::check_coding_standards"
],
"check-cs-thresholds": [
"@putenv YOASTCS_THRESHOLD_ERRORS=330",
"@putenv YOASTCS_THRESHOLD_ERRORS=325",
"@putenv YOASTCS_THRESHOLD_WARNINGS=225",
"Yoast\\WP\\SEO\\Composer\\Actions::check_cs_thresholds"
],
Expand Down

0 comments on commit f11ea6a

Please sign in to comment.