This repository has been archived by the owner on Jul 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from washingtonstateuniversity/enhancement/tra…
…vis-ci-jobs Update Travis config to use jobs and clean up install processes
- Loading branch information
Showing
1 changed file
with
41 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |