Skip to content
Snippets Groups Projects
.travis.yml 1.46 KiB
# Give sudo to environment
sudo: required

# Make Docker available inside the container
services:
  - docker

# Use the PHP environment
language: php

# Don't send notifications via email, that's annoying
notifications:
  email:
    on_success: never
    on_failure: never

# Trigger only on master -- we'll add Github pull requests in settings
branches:
  only:
    - master

# Extras
addons:
  # Make Github a known host so we can clone from it
  ssh_known_hosts:
  - github.com

# Cache composer dependencies
cache:
  directories:
    - vendor
    - $HOME/.composer/cache

# Build these combinations of PHP and WordPress Versions
matrix:
  include:
    - php: 7.2
      env: WP_VERSION=latest
    - php: 7.1
      env: WP_VERSION=latest
    - php: 7.2
      env: WP_VERSION=trunk
    - php: 7.2
      env: WP_VERSION=4.8

# Setup environment
before_script:
  # Export composer
  - export PATH="$HOME/.composer/vendor/bin:$PATH"
  # Install plugin with composer
  - composer install --no-progress

# Run tests
script:
  # Run just unit tests first -- if they fail we never spend the time building the environment for integration tests
  - composer unit-tests
  # Install full test environment using composer script
  - composer wp-install
  # Run integration tests
  - composer wp-tests
# IF tests passed run coverage and sniffs
after_sucess:
  # Run coverage
  - vendor/bin/phpunit --coverage-clover=coverage.xml
  # Report to codecov
  - bash <(curl -s https://codecov.io/bash) CODECOV_KEY