Skip to content
.travis.yml 4.22 KiB
Newer Older
fram's avatar
fram committed
language: php

  chrome: stable
  apt:
    packages:
      - apache2
      - postfix
      - libapache2-mod-fastcgi
      - libappindicator1
      - fonts-liberation
Thomas Nabord's avatar
Thomas Nabord committed
cache:
  directories:
Thomas Nabord's avatar
Thomas Nabord committed
    - $HOME/.composer/cache
fram's avatar
fram committed
php:
Thomas Nabord's avatar
Thomas Nabord committed
  - 7.2
  global:
    - SYMFONY_DEPRECATIONS_HELPER=disabled
  matrix:
    - PRESTASHOP_TEST_TYPE=lint
    - PRESTASHOP_TEST_TYPE=unit
    - PRESTASHOP_TEST_TYPE=e2e
      env: EXTRA_DEPS=phpHigh  PRESTASHOP_TEST_TYPE=unit
    - php: 7.2
      env: PRESTASHOP_TEST_TYPE=e2e EXTRA_TESTS=functional
    - stage: deploy
      php: 7.2
      before_install: skip
      script:
        - mkdir -p /tmp/ps-release
        - php tools/build/CreateRelease.php --destination-dir=/tmp/ps-release
        - cd /tmp/ps-release
          && today=`date +%Y-%m-%d-`; for i in *; do mv $i $today$TRAVIS_BRANCH-$i; done
          && cd -
      if: type = cron
        provider: gcs
        access_key_id: $GCS_ACCESS_KEY
        secret_access_key: $GCS_ACCESS_SECRET
        bucket: prestashop-core-nightly
        skip_cleanup: true
        acl: public-read
        local-dir: "/tmp/ps-release"
        on:
          all_branches: true
  exclude:
    - php: 7.2 # Replaced with additional tests
      env: PRESTASHOP_TEST_TYPE=e2e
fram's avatar
fram committed
before_install:
  # Avoid Composer authentication issues
  - if [[ $TRAVIS_REPO_SLUG = PrestaShop/PrestaShop ]]; then cp travis-scripts/.composer-auth.json ~/.composer/auth.json; fi;
Thomas Nabord's avatar
Thomas Nabord committed
  # Apache & php-fpm configuration
  - bash travis-scripts/setup-php-fpm.sh
  - bash travis-scripts/setup-apache.sh
Thomas Nabord's avatar
Thomas Nabord committed
  # PrestaShop configuration
  - cp tests-legacy/parameters.yml.travis app/config/parameters.yml
Francois Gaillard's avatar
Francois Gaillard committed
notifications:
  hipchat: ec4e21c5eb82066ba8be5fd1afefde@1184657
fram's avatar
fram committed
script:
  - if [ $EXTRA_DEPS = "phpHigh" ]; then
        composer update --ignore-platform-reqs --no-suggest --ansi;
        composer install --no-suggest --ansi --prefer-dist --no-interaction --no-progress;
Thomas Nabord's avatar
Thomas Nabord committed
  - bash travis-scripts/install-prestashop
  - if [ $PRESTASHOP_TEST_TYPE = "lint" ]; then
        bash tests-legacy/check_file_syntax.sh;
    fi

  - if [ $PRESTASHOP_TEST_TYPE = "unit" ]; then
        bash tests-legacy/check_phpunit.sh;
    fi

  - if [ $PRESTASHOP_TEST_TYPE = "unit" ]; then
Mathieu Ferment's avatar
Mathieu Ferment committed
        bash tests/check_unit.sh;
Pierre RAMBAUD's avatar
Pierre RAMBAUD committed
  - if [ $PRESTASHOP_TEST_TYPE = "e2e" ]; then
        bash tests-legacy/check_e2e.sh;

after_script:
  - sudo cat /var/log/apache2/error.log
Thomas Nabord's avatar
Thomas Nabord committed
  - curl -L http://localhost/
Thomas Nabord's avatar
Thomas Nabord committed
  - cat /etc/apache2/sites-available/000-default.conf
  - sudo cat /var/log/php-fpm.log
joce's avatar
joce committed
  - sudo ls -l /var/log/apache2
Thomas Nabord's avatar
Thomas Nabord committed
  - sudo cat /var/log/apache2/other_vhosts_access.log
  - if [ ! -z "$PRESTASTHOP_SCREENHOST" ]; then bash ./travis-scripts/base64-screenshots; fi # As we cannot upload file, we display the base64 encoded content of the screenshots
  - cat $TRAVIS_BUILD_DIR/var/log/dev.log
Pierre RAMBAUD's avatar
Pierre RAMBAUD committed

before_deploy:
  - |
      if [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then
        mkdir -p ${HOME}/.ssh/;
Pierre RAMBAUD's avatar
Pierre RAMBAUD committed
        echo $GC_INSTANCE_KEY | base64 --decode -i > ${HOME}/.ssh/google_compute_engine && \
        echo $GC_INSTANCE_PUB | base64 --decode -i > ${HOME}/.ssh/google_compute_engine.pub && \
        chmod 600 ${HOME}/.ssh/* && \
        echo $GC_SERVICE_KEY | base64 --decode -i > ${HOME}/gcloud-service-key.json && \
        gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json && \
        gcloud config set project $GC_PROJECT_ID
Pierre RAMBAUD's avatar
Pierre RAMBAUD committed
      fi

after_deploy:
  - |
    if [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then
      [[ $TRAVIS_BRANCH = "develop" ]] && INSTANCE_TYPE="develop" || INSTANCE_TYPE="release";
      # make sure instance is stopped. This step does not need to be chained
      gcloud compute instances stop --zone $GC_ZONE "${GC_INSTANCE_NAME}-${INSTANCE_TYPE}";
Pierre RAMBAUD's avatar
Pierre RAMBAUD committed
      gcloud compute instances add-metadata "${GC_INSTANCE_NAME}-${INSTANCE_TYPE}" --zone $GC_ZONE --metadata=TRAVIS_BRANCH=$TRAVIS_BRANCH && \
      gcloud compute instances add-metadata "${GC_INSTANCE_NAME}-${INSTANCE_TYPE}" --zone $GC_ZONE --metadata-from-file startup-tests-script=tests/E2E/scripts/run-nightly-tests.sh && \
      gcloud compute instances start --zone $GC_ZONE "${GC_INSTANCE_NAME}-${INSTANCE_TYPE}"
Pierre RAMBAUD's avatar
Pierre RAMBAUD committed
    fi