Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #39 from washingtonstateuniversity/enhancement/tra…
Browse files Browse the repository at this point in the history
…vis-ci-jobs

Update Travis config to use jobs and clean up install processes
  • Loading branch information
admturner authored Sep 30, 2020
2 parents 7c894f6 + f35e6dc commit 71eaf49
Showing 1 changed file with 41 additions and 50 deletions.
91 changes: 41 additions & 50 deletions .travis.yml
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

0 comments on commit 71eaf49

Please sign in to comment.