forked from coopcycle/coopcycle-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
executable file
·147 lines (136 loc) · 7.5 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
147
notifications:
email: false
sudo: required
matrix:
fast_finish: true
services:
- postgresql
- docker
- redis-server
addons:
postgresql: '9.4'
apt:
packages:
- nginx
- libgconf-2-4
- postgresql-9.4-postgis-2.4
hosts:
- test.coopcycle.org
language: php
php:
- '7.4.5'
cache:
apt: true
directories:
- $HOME/.composer/cache/files
- $HOME/.npm
- $HOME/.cache
env:
global:
- OSRM_VERSION=v5.16.0
- STRIPE_MOCK_API_BASE=http://localhost:12111
- APP_ENV=test
- APP_DEBUG=1
- APP_HOST=test.coopcycle.org
- NODE_ENV=test
- BEHAT_PARAMS='{"extensions":{"Behat\\MinkExtension":{"base_url":"http://test.coopcycle.org"}}}'
- COOPCYCLE_REGION=fr
- COOPCYCLE_DB_HOST=127.0.0.1
- COOPCYCLE_DB_PORT=5432
- COOPCYCLE_DB_NAME=coopcycle
- COOPCYCLE_DB_USER=postgres
- COOPCYCLE_DB_PASSWORD=
- COOPCYCLE_OAUTH_FACEBOOK_CLIENT_ID=YourFacebookClientId
- COOPCYCLE_OAUTH_FACEBOOK_CLIENT_SECRET=YourFacebookClientSecret
- COOPCYCLE_REDIS_DSN=redis://127.0.0.1:6379
- COOPCYCLE_TILE38_DSN=redis://127.0.0.1:9851
- COOPCYCLE_MJML_HOST=http://localhost:8889
- COOPCYCLE_OSRM_HOST=127.0.0.1:5000
- COOPCYCLE_DEMO=0
- COOPCYCLE_PUBLIC_KEY_FILE=var/jwt/public.pem
- COOPCYCLE_PRIVATE_KEY_FILE=var/jwt/private.pem
- APNS_CERTIFICATE_FILE=/dev/null
- COOPCYCLE_OAUTH_ENCRYPTION_KEY=RY890EuDb7heQhhI6GOsXC09v1aYCnMwL4M4uhM5Ewk=
- COOPCYCLE_MAIL_TRANSPORT=smtp
- COOPCYCLE_MAIL_URL=smtp://localhost:25
- COOPCYCLE_MAIL_HOST=127.0.0.1
- COOPCYCLE_TAX_INCL=1
- COOPCYCLE_LEGACY_TAXES=1
- MATOMO_CHECKOUT_COMPLETED_GOAL_ID=
# https://docs.travis-ci.com/user/encryption-keys
# GOOGLE_API_KEY
- secure: "QQdL4x+Ht2/qUv+qhtyR/9effGz2P6PyJ0+8lGWycu0K5sKmtcUO/6xK7il4/uK5nogm4YcON1Pcmm665NhfCSu1gicNgd0bYR0KIWIYPeWUM9pjC1yzZhh2MOl9p0NWo6ulI1Ex7WTmN8sXc5AuNhpnKuQXR8mZPu5Tg9YTodkglKARdO11Nk1rU4dLefvlmncWHgtZ4DTYINe0jHWLH0RnmLKtKVzwLpeSt/AEplRAl25fh+qp6fw61qoHMLLyUGTJpli+mvEUruAKupc4bERBOaL9uEa+J0X0eOumK5tQLyXPGjibPRjwJWxBq7OHZOWtX4CvbWU6xoF/MM0hp9HRdH6i06tlo68BTR+dBviQWw7s2JLqCWrYtb6ifsmg+FVY4cKTDQG9mEJ6ZEMa8OAIaIltaXj3MyrrbsnkJIbweXn6OfsJBxzeIO8VaNJ++XA5uFD/RH1ClY9je6P635eFU2KSOoj58i3ElNl8Mn1/hwaBUZlfmytwLMmDmjyNr0EpuLohep6+FLv5vksgea0Nj1wI7HUJ0kY8bX6+BkFL1AWVrDJX3ZW38GvAArRWs+HHF7PN35agwSwOhih8SRtn/DpOWBNfG1Q+/PN1Yf6tWsPWc6aGCWNFiWj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QSQEWJOy5ex10Yi+xVLOvTxBKEyBl/lDDr6vxsC5btbDL0PJ9RP2U44gTuUvzrh6kRLYesx2iNt/M51/fb6O/xDApMqIz6KcbPF6F7YNPgaiNd/n+hj1qs4PSc4BATon400fH/N3VpD4AB+ptRIgW5lF67q40dtjkN2cRu454lvxUcSJPhMl0QHttlY59cyuh7N4Gi9QP9+kHdkElDOk5KseJ5NkHwpw3dvK7YAYduYqz2CSLgxq6I5HSSVPqXOSmBiEMfPWJj9NWgcnCq0Fffebbnhq6NYlmSl4olhelyiH7bnZxDbm6x5xLqo72RJR7L3D3hQFGN3cyR1E96JRti3phkK/1nc1/T2LeV+n97zVmpFVQyNoYQIS1B1smiQ1R0AyjHu6gjVxbA="
before_install:
- nvm install 12
- echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
install:
- npm ci
- npm install -g pm2@^4.2
# Install OSRM
- mkdir -p var/osrm
- wget https://coopcycle-assets.sfo2.digitaloceanspaces.com/osm/paris-france.osm.pbf -P var/osrm
- docker run -t -v $(pwd)/var/osrm:/data osrm/osrm-backend:$OSRM_VERSION osrm-extract -p /opt/bicycle.lua /data/paris-france.osm.pbf
- docker run -t -v $(pwd)/var/osrm:/data osrm/osrm-backend:$OSRM_VERSION osrm-partition /data/paris-france.osrm
- docker run -t -v $(pwd)/var/osrm:/data osrm/osrm-backend:$OSRM_VERSION osrm-customize /data/paris-france.osrm
- docker run -t -v $(pwd)/var/osrm:/data -d -p 5000:5000 osrm/osrm-backend:$OSRM_VERSION osrm-routed --algorithm mld /data/paris-france.osrm
- docker run -t -d -p 12111:12111 stripemock/stripe-mock:v0.94.0
- docker run -t -d -p 8889:80 adrianrudnik/mjml-server
- docker run -t -d -p 9851:9851 tile38/tile38
# Configure php-fpm
# @see https://docs.travis-ci.com/user/languages/php/
# @see http://php.net/manual/fr/install.fpm.configuration.php#clear-env
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -i -e 's/;clear_env = no/clear_env = no/g' ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
# Configure Nginx
- sudo sed -i -e 's/www-data/travis/g' /etc/nginx/nginx.conf
- sudo cp .travis/test.coopcycle.org.conf /etc/nginx/sites-available/test.coopcycle.org.conf
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$TRAVIS_BUILD_DIR?g" --in-place /etc/nginx/sites-available/test.coopcycle.org.conf
- sudo ln -s /etc/nginx/sites-available/test.coopcycle.org.conf /etc/nginx/sites-enabled/
before_script:
- phpenv config-rm xdebug.ini
- echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# Configure JSON Web Token
- mkdir -p var/jwt
- openssl genrsa -out var/jwt/private.pem 4096
- openssl rsa -pubout -in var/jwt/private.pem -out var/jwt/public.pem
# Create directories for images
- mkdir -p web/images/products
- mkdir -p web/images/restaurants
- mkdir -p web/images/tasks
# Configure PostgreSQL
- psql -U postgres -c 'CREATE DATABASE coopcycle_test;'
- psql -U postgres -d coopcycle_test -c 'CREATE EXTENSION postgis;'
- psql -U postgres -d coopcycle_test -c 'CREATE EXTENSION postgis_topology;'
- psql -U postgres -d coopcycle_test -c 'CREATE EXTENSION pg_trgm;'
# Install PHP app
- composer install --prefer-dist --no-plugins
- php bin/console doctrine:schema:create --env=test
- php bin/console coopcycle:setup --env=test
- node_modules/.bin/encore dev
# Start php-fpm
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
- sudo nginx -t
- sudo service nginx restart
- cp phpunit.xml.dist phpunit.xml
- cp .travis/cypress.json cypress.json
- pm2 start pm2.config.js --env=test
script:
# - curl 'http://localhost:5000/route/v1/bicycle/2.3706188,48.877821;2.385706,48.887031?overview=full'
- php vendor/bin/phpstan analyse
- node node_modules/.bin/eslint --quiet js/app/
- php vendor/bin/phpunit
- npm run jest
- php bin/console doctrine:schema:validate --skip-sync --env=test
- php vendor/bin/behat -f progress
- node node_modules/.bin/mocha --require @babel/register --exit js/tests/
- $(npm bin)/cypress run
# after_failure:
# - python -m pip install --upgrade pip
# - pip install python-swiftclient python-keystoneclient
# - pip install awscli
# - tar czvf $TRAVIS_BUILD_NUMBER.tgz -C cypress/screenshots .
# - aws --endpoint=$AWS_ENDPOINT s3 cp $TRAVIS_BUILD_NUMBER.tgz s3://cypress/$TRAVIS_BUILD_NUMBER.tgz --acl private