# This is not the acquia-pipelines file that will be used for projects generated via BLT.
# This file will create a sample BLT project against which to test. It uses the same logic as the child project's
# acquia-pipelines.yml file wherever possible.
version: 1.1.0
services:
  - mysql

variables:
  global:
    COMPOSER_BIN: $BUILD_DIR/vendor/bin
    BLT_DIR: $BUILD_DIR
    IS_PULL_REQUEST: true
    PATH: $COMPOSER_BIN:$PATH

events:
  build:
    steps:
        # Install global packages and set global configuration.
        - setup-environment:
            type: script
            script:
              - composer validate --no-check-all --ansi
              - composer install
              - source $BLT_DIR/scripts/pipelines/setup_environment
              - source $BLT_DIR/scripts/pipelines/setup_project

        # Execute all testing and validation tasks.
        - run-tests:
            type: script
            script:
              # Create a sample, BLT-generated project against which to test.
              - source ${BLT_DIR}/scripts/blt/ci/internal/smoke_tests.sh
              # Create a sample, BLT-generated project against which to test.
              - source ${BLT_DIR}/scripts/blt/ci/internal/create_blt_project.sh
              # Execute tests against sample project.
              - source ${BLT_DIR}/scripts/pipelines/run_tests
              # Make BLT doctor happy.
              - source ${BLT_DIR}/scripts/blt/ci/internal/doctor.sh
              - phpunit ${BLT_DIR}/tests/phpunit --group blted8


        # Generate artifact.
        - build-artifact:
            type: script
            script:
              # Build the artifact.
              - source ${BLT_DIR}/scripts/pipelines/build_artifact
              - source ${BLT_DIR}/scripts/blt/ci/internal/test_artifact.sh
