Skip to content
Snippets Groups Projects
.travis.yml 1.46 KiB
Newer Older
  • Learn to ignore specific revisions
  • Josh Pollock's avatar
    Josh Pollock committed
    # 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
    
    
    Josh Pollock's avatar
    Josh Pollock committed
    # 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
    
    Josh Pollock's avatar
    Josh Pollock committed
        - php: 7.1
          env: WP_VERSION=latest
    
    Josh Pollock's avatar
    Josh Pollock committed
        - php: 7.2
          env: WP_VERSION=trunk
    
    Josh Pollock's avatar
    Josh Pollock committed
        - php: 7.2
          env: WP_VERSION=4.8
    
    Josh Pollock's avatar
    Josh Pollock committed
    
    # 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