---
language: php

os: linux
dist: bionic

version: ~> 1.0

node_js: "lts/*"

php: "7.3"

addons:
  chrome: stable

cache:
  directories:
    - "$HOME/.composer/cache"
    - "$HOME/.drush/cache"
    - "$HOME/.rvm"
    - "${TMPDIR:-/tmp}/phpstan/cache"

branches:
  only:
    - 8.x-1.x
    - wip

env:
  global:
    - ORCA_SUT_NAME=drupal/mysql56
    - ORCA_SUT_BRANCH=8.x-1.x
    - ORCA_VERSION=^3

jobs:
  fast_finish: true
  include:
    - { env: ORCA_JOB=STATIC_CODE_ANALYSIS, name: "Static code analysis" }
    # These jobs currently irrelevant for a D9-only package.
    # - { env: ORCA_JOB=INTEGRATED_TEST_ON_OLDEST_SUPPORTED, name: "Integrated test on oldest supported Drupal core version" }
    # - { env: ORCA_JOB=INTEGRATED_TEST_ON_LATEST_LTS, name: "Integrated test on latest LTS Drupal core version" }
    # - { env: ORCA_JOB=INTEGRATED_TEST_ON_PREVIOUS_MINOR, name: "Integrated test on previous minor Drupal core version" }
    - { env: ORCA_JOB=INTEGRATED_UPGRADE_TEST_FROM_PREVIOUS_MINOR, name: "Integrated upgrade test from previous minor" }
    - { env: ORCA_JOB=ISOLATED_TEST_ON_CURRENT, name: "Isolated test on current Drupal core version" }
    - { env: ORCA_JOB=INTEGRATED_TEST_ON_CURRENT, name: "Integrated test on current Drupal core version" }
    - { env: ORCA_JOB=INTEGRATED_UPGRADE_TEST_TO_NEXT_MINOR, name: "Integrated upgrade test to next minor Drupal core version" }
    - { env: ORCA_JOB=INTEGRATED_UPGRADE_TEST_TO_NEXT_MINOR_DEV, name: "Integrated upgrade test to next minor dev Drupal core version" }
    - { env: ORCA_JOB=ISOLATED_TEST_ON_CURRENT_DEV, name: "Isolated test on current dev Drupal core version" }
    - { env: ORCA_JOB=INTEGRATED_TEST_ON_CURRENT_DEV, name: "Integrated test on current dev Drupal core version" }
    - { env: ORCA_JOB=LOOSE_DEPRECATED_CODE_SCAN, name: "Loose deprecated code scan" }
    - { env: ORCA_JOB=STRICT_DEPRECATED_CODE_SCAN, name: "Strict deprecated code scan" }
    - { env: ORCA_JOB=DEPRECATED_CODE_SCAN_W_CONTRIB, name: "Deprecated code scan w/ contrib" }
    - { env: ORCA_JOB=ISOLATED_TEST_ON_NEXT_MINOR, name: "Isolated test on next minor Drupal core version" }
    - { env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MINOR, name: "Integrated test on next minor Drupal core version" }
    - { env: ORCA_JOB=ISOLATED_TEST_ON_NEXT_MINOR_DEV, name: "Isolated test on next minor dev Drupal core version" }
    - { env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MINOR_DEV, name: "Integrated test on next minor dev Drupal core version" }
    # - { env: ORCA_JOB=ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER, name: "Isolated test on next major, latest minor beta-or-later Drupal core version" }
    # - { env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER, name: "Integrated test on next major, latest minor beta-or-later Drupal core version" }
    # - { env: ORCA_JOB=ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV, name: "Isolated test on next major, latest minor dev Drupal core version" }
    # - { env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV, name: "Integrated test on next major, latest minor dev Drupal core version" }
    - { env: ORCA_JOB=ISOLATED_UPGRADE_TEST_TO_NEXT_MAJOR_BETA_OR_LATER, name: "Isolated upgrade test to next major beta-or-later Drupal core version" }
    - { env: ORCA_JOB=ISOLATED_UPGRADE_TEST_TO_NEXT_MAJOR_DEV, name: "Isolated upgrade test to next major dev Drupal core version" }
  allow_failures:
    # The static analysis fails on account of a false positive in composer.json.
    - env: ORCA_JOB=STATIC_CODE_ANALYSIS
    - env: ORCA_JOB=INTEGRATED_UPGRADE_TEST_TO_NEXT_MINOR_DEV
    - env: ORCA_JOB=LOOSE_DEPRECATED_CODE_SCAN
    - env: ORCA_JOB=DEPRECATED_CODE_SCAN_W_CONTRIB
    - env: ORCA_JOB=ISOLATED_TEST_ON_NEXT_MINOR_DEV
    - env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MINOR_DEV
    - env: ORCA_JOB=ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV
    - env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV
    - env: ORCA_JOB=ISOLATED_UPGRADE_TEST_TO_NEXT_MAJOR_DEV

before_install:
  - composer create-project --no-dev acquia/orca ../orca "$ORCA_VERSION"
  - ../orca/bin/travis/before_install.sh

install: ../orca/bin/travis/install.sh

before_script: ../orca/bin/travis/before_script.sh

script: ../orca/bin/travis/script.sh

before_cache: ../orca/bin/travis/before_cache.sh

after_success: ../orca/bin/travis/after_success.sh

after_failure: ../orca/bin/travis/after_failure.sh

after_script: ../orca/bin/travis/after_script.sh
