forked from PrestaShop/PrestaShop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
146 lines (125 loc) · 4.66 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
language: php
services:
- mysql
addons:
chrome: stable
apt:
packages:
- dpkg
- apache2
- postfix
- libapache2-mod-fastcgi
- libappindicator1
- fonts-liberation
cache:
directories:
- $HOME/.composer/cache
os: linux
dist: trusty
php:
- 7.1
- 7.2
- 7.3
env:
global:
- SYMFONY_DEPRECATIONS_HELPER=disabled
- DISABLE_DEBUG_TOOLBAR=1
jobs:
- PRESTASHOP_TEST_TYPE=unit
- PRESTASHOP_TEST_TYPE=integration
- PRESTASHOP_TEST_TYPE=sanity
stages:
- name: deploy
if: type = cron
- name: test
if: type IN (push, pull_request)
jobs:
include:
- stage: deploy
php: 7.3
before_install: skip
before_script: skip
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
deploy:
provider: gcs
access_key_id: $GCS_ACCESS_KEY
secret_access_key: $GCS_ACCESS_SECRET
bucket: prestashop-core-nightly
acl: public-read
local_dir: "/tmp/ps-release"
on:
all_branches: true
before_install:
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_10.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :10 -ac -screen 0 1600x1200x16
# Avoid Composer authentication issues
- if [[ "$TRAVIS_REPO_SLUG" = PrestaShop/PrestaShop ]]; then cp travis-scripts/.composer-auth.json ~/.composer/auth.json; fi;
# Apache & php-fpm configuration
- bash travis-scripts/setup-php-fpm.sh
- bash travis-scripts/setup-apache.sh
# PrestaShop configuration
- cp tests-legacy/parameters.yml.travis app/config/parameters.yml
# Always test with non-unity MySQL autoincrement
- mysql -e 'SET @@GLOBAL.auto_increment_increment = 2, @@GLOBAL.auto_increment_offset = 2;'
install:
- composer install --no-suggest --ansi --prefer-dist --no-interaction --no-progress --quiet;
- if [ "$PRESTASHOP_TEST_TYPE" != "sanity" ]; then
bash travis-scripts/install-prestashop;
fi
script:
- if [ "$PRESTASHOP_TEST_TYPE" = "unit" ]; then
bash tests/check_file_syntax.sh;
fi
- if [ "$PRESTASHOP_TEST_TYPE" = "unit" ]; then
bash tests-legacy/check_phpunit.sh;
fi
- if [ "$PRESTASHOP_TEST_TYPE" = "unit" ]; then
bash tests/check_unit.sh;
fi
- if [ "$PRESTASHOP_TEST_TYPE" = "integration" ]; then
make assets;
bash tests/check_integration.sh;
fi
- if [ "$PRESTASHOP_TEST_TYPE" = "sanity" ]; then
make assets;
bash tests/check_sanity.sh;
fi
after_script:
- sudo cat /var/log/apache2/error.log
after_failure:
- curl -L http://localhost/
- cat /etc/apache2/envvars
- cat /etc/apache2/sites-available/000-default.conf
- sudo cat /var/log/php-fpm.log
- sudo ls -l /var/log/apache2
- sudo cat /var/log/apache2/other_vhosts_access.log
- cat $TRAVIS_BUILD_DIR/var/log/dev.log
before_deploy:
- |
if [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then
mkdir -p ${HOME}/.ssh/;
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
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}";
gcloud compute instances add-metadata "${GC_INSTANCE_NAME}-${INSTANCE_TYPE}" --zone $GC_ZONE --metadata=NIGHTLY_TOKEN=$NIGHTLY_TOKEN && \
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/puppeteer/scripts/run-nightly-tests.sh && \
gcloud compute instances add-metadata "${GC_INSTANCE_NAME}-${INSTANCE_TYPE}" --zone $GC_ZONE --metadata-from-file startup-reports-script=tests/puppeteer/scripts/run-nightly-reports.sh && \
gcloud compute instances start --zone $GC_ZONE "${GC_INSTANCE_NAME}-${INSTANCE_TYPE}"
fi