os: linux
dist: focal
language: php

env:
  - PATH="app/vendor/bin:${PATH}"

php:
  - 7.4
  - nightly

jobs:
  allow_failures:
    - php: nightly

services:
  - memcached
  - redis

cache:
  directories:
    - $HOME/.composer/cache
    - $HOME/.npm
    - app/vendor

before_install:
  - printf "\n" | pecl install -f apcu-5.1.18 memcached
  - echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

install:
  - composer install --no-suggest
  - npm ci

script:
  - npm run production --verbose
  - php-cs-fixer fix --diff --dry-run
  - psalm --show-info=true
  - phpunit --coverage-text

before_deploy: make artifacts

deploy:
  on:
    tags: true
  provider: releases
  token: ${GITHUB_TOKEN}
  name: v${TRAVIS_TAG}
  tag_name: ${TRAVIS_TAG}
  draft: true
  file:
    - artifacts/DirectoryLister-${TRAVIS_TAG}.tar.gz
    - artifacts/DirectoryLister-${TRAVIS_TAG}.zip
  edge: true

os: linux
dist: bionic
language: php

env:
  - PATH="app/vendor/bin:${PATH}"

php:
  - 7.2
  - 7.3
  - 7.4
  - nightly

jobs:
  allow_failures:
    - php: nightly

services:
  - memcached
  - redis

cache:
  directories:
    - $HOME/.composer/cache
    - $HOME/.npm
    - app/vendor

before_install:
  - printf "\n" | pecl install -f apcu-5.1.18 memcached
  - echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

install:
  - composer update
  - npm ci

script:
  - npm run production --verbose
  - php-cs-fixer fix --diff --dry-run
  - psalm --show-info=true
  - phpunit --coverage-text

before_deploy: make artifacts

deploy:
  on:
    tags: true
  provider: releases
  token: ${GITHUB_TOKEN}
  name: v${TRAVIS_TAG}
  tag_name: ${TRAVIS_TAG}
  draft: true
  file:
    - artifacts/DirectoryLister-${TRAVIS_TAG}.tar.gz
    - artifacts/DirectoryLister-${TRAVIS_TAG}.zip
  edge: true

Test PHP 7.2, 7.3 and 7.4 in Travis tests
Test PHP 7.2, 7.3 and 7.4 in Travis tests
