.travis.yml

Summary

Maintainability
Test Coverage
language: php

# The 2.0 releases can be used with any PHP version from 7.1 to 7.4.
# PHP 7.4 support is available in the latest Phan 2.x releases.
php:
  - 7.2
  - 7.3
  - 7.4
  - nightly

jobs:
  # PHP's argument names are being changed until 8.0.0 stable is released in November,
  # leading to build failures unrelated to Phan itself.
  allow_failures:
  - php: nightly

# NOTE: Travis starts up 5 test suites at a time.
# So, it's faster to run all of the tests at once per supported PHP version.
dist: xenial
sudo: false

cache:
  directories:
    - $HOME/.composer/cache
    - $HOME/.cache/phan-ast/build

# We invoke php multiple times via CLI in several tests, so enable the opcache file cache.
before_install:
  # NOTE: This is testing compatibility with the latest version of php-ast. Most ci jobs can just use `pecl install ast` to install php-ast 1.0.8+
  - ./tests/travis_setup.sh
  - mkdir /tmp/opcache || true; echo -e 'opcache.enable_cli=1\nopcache.file_cache=/tmp/opcache' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
  - composer validate

# --classmap-authoritative shouldn't affect Phan's behavior, but is faster.
# Use it for Travis and published Phars.
install:
  - composer --prefer-dist --classmap-authoritative install
  - pushd internal/paratest; composer --prefer-dist --classmap-authoritative install; popd

# We have a fake TEST_SUITE in tests/run_all_tests which runs Phan, and check if the exit code is non-zero and the standard output is non-empty.
# This is used instead of a unit test because Phan currently caches too much state for this to be run with other unit tests, and the configuration might end up different within a unit test.
# This was moved into a separate script to stop cluttering up .travis.yml
script:
  # NOTE: GNU parallel is not available on travis, and because we don't plan to depend on sudo in the future, it's inconvenient to install
  - tests/run_all_tests
  - php internal/package.php