.travis.yml 4.55 KB
Newer Older
fram's avatar
fram committed
1
2
language: php

Pierre Rambaud's avatar
Pierre Rambaud committed
3
4
5
services:
  - mysql

6
addons:
7
8
9
  chrome: stable
  apt:
    packages:
10
      - dpkg
11
12
13
14
15
      - apache2
      - postfix
      - libapache2-mod-fastcgi
      - libappindicator1
      - fonts-liberation
16

Thomas Nabord's avatar
Thomas Nabord committed
17
cache:
Thierry Marianne's avatar
Thierry Marianne committed
18
  directories:
Thomas Nabord's avatar
Thomas Nabord committed
19
    - $HOME/.composer/cache
20

21
sudo: required
22
dist: xenial
23

fram's avatar
fram committed
24
php:
25
  - 5.6
Thomas Nabord's avatar
Thomas Nabord committed
26
  - 7.2
27

28
env:
29
30
  global:
    - SYMFONY_DEPRECATIONS_HELPER=disabled
31
    - DISABLE_DEBUG_TOOLBAR=1
32
33
  matrix:
    - PRESTASHOP_TEST_TYPE=unit
34
    - PRESTASHOP_TEST_TYPE=integration
35
    - PRESTASHOP_TEST_TYPE=e2e
36

37
38
matrix:
  include:
39
    - php: 7.2
Thomas Nabord's avatar
Thomas Nabord committed
40
      env: EXTRA_DEPS=phpHigh  PRESTASHOP_TEST_TYPE=unit
Thomas Nabord's avatar
Thomas Nabord committed
41
42
43
44
45
46
47
    - 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
Thomas Nabord's avatar
Thomas Nabord committed
48
          && today=`date +%Y-%m-%d-`; for i in *; do mv $i $today$TRAVIS_BRANCH-$i; done
Thomas Nabord's avatar
Thomas Nabord committed
49
50
          && cd -
      if: type = cron
51
      deploy:
Thomas Nabord's avatar
Thomas Nabord committed
52
53
54
55
56
57
58
59
60
        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
Thomas Nabord's avatar
Thomas Nabord committed
61
  exclude:
Pierre Rambaud's avatar
Pierre Rambaud committed
62
    - php: 5.6 # Replaced with additional tests
Thomas Nabord's avatar
Thomas Nabord committed
63
      env: PRESTASHOP_TEST_TYPE=e2e
64
65
66
  allow_failures:
    - php: 7.2
      env: EXTRA_DEPS=phpHigh  PRESTASHOP_TEST_TYPE=unit
67

fram's avatar
fram committed
68
before_install:
Thomas Baccelli's avatar
Thomas Baccelli committed
69
  - composer self-update --1
Pierre Rambaud's avatar
Pierre Rambaud committed
70
  - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_10.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :10 -ac -screen 0 1600x1200x16
71
  # Avoid Composer authentication issues
Jonathan Lelievre's avatar
Jonathan Lelievre committed
72
  - if [[ "$TRAVIS_REPO_SLUG" = PrestaShop/PrestaShop ]]; then cp travis-scripts/.composer-auth.json ~/.composer/auth.json; fi;
Thomas Nabord's avatar
Thomas Nabord committed
73
74
75
  # Apache & php-fpm configuration
  - bash travis-scripts/setup-php-fpm.sh
  - bash travis-scripts/setup-apache.sh
Thierry Marianne's avatar
Thierry Marianne committed
76

Thomas Nabord's avatar
Thomas Nabord committed
77
  # PrestaShop configuration
78
  - cp tests-legacy/parameters.yml.travis app/config/parameters.yml
79

80
before_script:
Jonathan Lelievre's avatar
Jonathan Lelievre committed
81
  - if [ "$EXTRA_DEPS" = "phpHigh" ]; then
82
        composer update --ignore-platform-reqs --no-suggest --ansi --no-interaction --no-progress --quiet;
Jonathan Lelievre's avatar
Jonathan Lelievre committed
83
84
    else
        composer install --no-suggest --ansi --prefer-dist --no-interaction --no-progress --quiet;
85
86
    fi

87
  - bash travis-scripts/install-prestashop;
88

89
script:
Jonathan Lelievre's avatar
Jonathan Lelievre committed
90
  - if [ "$PRESTASHOP_TEST_TYPE" = "unit" ]; then
91
        bash tests-legacy/check_file_syntax.sh;
92
        bash tests-legacy/check_phpunit.sh;
93
94
    fi

Jonathan Lelievre's avatar
Jonathan Lelievre committed
95
  - if [ "$PRESTASHOP_TEST_TYPE" = "unit" ]; then
Mathieu Ferment's avatar
Mathieu Ferment committed
96
        bash tests/check_unit.sh;
97
98
    fi

99
100
101
102
  - if [ "$PRESTASHOP_TEST_TYPE" = "integration" ]; then
        bash tests/check_integration.sh;
    fi

103
  - if [ $PRESTASHOP_TEST_TYPE = "e2e" ]; then
104
        bash tests/check_e2e.sh;
105
    fi
djfm's avatar
djfm committed
106
107
108

after_script:
  - sudo cat /var/log/apache2/error.log
109
110

after_failure:
Thomas Nabord's avatar
Thomas Nabord committed
111
  - curl -L http://localhost/
112
  - cat /etc/apache2/envvars
Thomas Nabord's avatar
Thomas Nabord committed
113
114
  - cat /etc/apache2/sites-available/000-default.conf
  - sudo cat /var/log/php-fpm.log
joce's avatar
joce committed
115
  - sudo ls -l /var/log/apache2
Thomas Nabord's avatar
Thomas Nabord committed
116
  - sudo cat /var/log/apache2/other_vhosts_access.log
117
  - cat $TRAVIS_BUILD_DIR/var/log/dev.log
Pierre RAMBAUD's avatar
Pierre RAMBAUD committed
118
119
120
121
122

before_deploy:
  - |
      if [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then
        mkdir -p ${HOME}/.ssh/;
Pierre RAMBAUD's avatar
Pierre RAMBAUD committed
123
124
125
126
127
128
        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
129
130
131
132
133
      fi

after_deploy:
  - |
    if [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then
134
      [[ $TRAVIS_BRANCH = "develop" ]] && INSTANCE_TYPE="develop" || INSTANCE_TYPE="release";
135
136
      # 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
137
138
      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 && \
139
      gcloud compute instances add-metadata "${GC_INSTANCE_NAME}-${INSTANCE_TYPE}" --zone $GC_ZONE --metadata-from-file startup-reports-script=tests/E2E/scripts/run-nightly-reports.sh && \
Pierre RAMBAUD's avatar
Pierre RAMBAUD committed
140
      gcloud compute instances start --zone $GC_ZONE "${GC_INSTANCE_NAME}-${INSTANCE_TYPE}"
Pierre RAMBAUD's avatar
Pierre RAMBAUD committed
141
    fi