From f35e6dc98ac261e2213fd17a08bab7c7fef6cc38 Mon Sep 17 00:00:00 2001 From: Adam Turner Date: Wed, 30 Sep 2020 11:42:16 -0700 Subject: [PATCH] Update Travis config to use jobs and clean up install processes --- .travis.yml | 91 ++++++++++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 50 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5357d64..7ecdb83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,65 +1,56 @@ # Travis CI configuration # @link https://travis-ci.org/ -# WSUWP Plugin HRS Courses -# @link https://github.com/washingtonstateuniversity/wsuwp-plugin-hrs-courses -language: php os: linux -dist: trusty +dist: xenial + +language: generic + +notifications: + email: + on_success: never + on_failure: change -# Cache some data across builds for performance. -# https://docs.travis-ci.com/user/caching/ cache: apt: true - npm: true directories: - # Cache directory for older Composer versions. - $HOME/.composer/cache - # Cache directory for more recent Composer versions. - - $HOME/.cache/composer/files - -# PHP versions to build on. -php: - - 7.3 - - 7.2 - - 7.1 - - 7.0 - -env: - global: - - WP_VERSION=5.0 - - WP_MULTISITE=0 - - LINT=1 + - vendor + - $HOME/.npm + - $HOME/.nvm/.cache branches: only: - stable + - 2.x before_install: - # Speed up build time by disabling Xdebug. - - phpenv config-rm xdebug.ini || echo 'No xdebug config.' - # Make sure NPM is installed - - npm i -g npm - -install: - - cd $TRAVIS_BUILD_DIR - # Install PHP_CodeSniffer and WP Coding Standards - - if [[ "$LINT" == "1" ]]; then composer install --no-suggest; fi - - if [[ "$LINT" == "1" ]]; then npm ci; fi - -before_script: - # Refresh path following CodeSniffer install. - - phpenv rehash; - -script: - # Search theme for PHP syntax errors @see https://github.com/WordPress/twentynineteen/ - # The usage of bash + || exit 1 is to ensure xargs does not exit on first error. - - find . \( -name '*.php' \) -not -path "./vendor/*" | xargs -n1 bash -c 'php -lf $0 || exit 1' - # Search for PHP, JS, and CSS errors with linting and coding standards checks. - # Then test building the production version of the theme. - - if [[ "$LINT" == "1" ]]; then npm run build; fi - -notifications: - email: - on_success: never - on_failure: change + - npm --version + - node --version + - nvm install --latest-npm + +jobs: + include: + - name: Lint JS + install: npm ci + script: npm run lint:scripts + + - name: Lint CSS + install: npm ci + script: npm run lint:styles + + - name: Lint JSON + install: npm ci + script: npm run lint:pkg + + - name: Lint PHP + install: composer install + script: + - find . \( -name '*.php' \) -not -path "./vendor/*" | xargs -n1 bash -c 'php -lf $0 || exit 1' + - npm run lint:php + + - name: Build + install: + - npm ci + - composer install + script: npm run build