-
Notifications
You must be signed in to change notification settings - Fork 14
/
.travis.yml
165 lines (156 loc) · 7.31 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
sudo: required
addons:
apt:
packages:
- docker-ce
services:
- docker
env:
global:
- secure: "bVSEkJFCQ4xuL4Lxs7CS78Pfj9EeFkgDAd39m/8RRSg2WoPQ9ghQTLLsJ18xN9agGkGL30VeDxZT2txxcrx2JD2NIkA/sAQxLKM5aW8VVrhO4pRpswipK2ffhl6GrHzj2MzxU18R3txRnOu5xrkV4pLMVhqGverM8PgTfXdONPvU6mD9MB0xO5wi7LiVB0+Yx3Mav7VolWvjsGW1SolB7Ib/aGUOhd7E/uSzTNP/u8w/ZUt1yDVw1ZnHPPHTXaDdlv7KF1BA4+ugmTF9Jc4DJ0GYi/kV5wEG7nTP3sMSeq4F2UxT2rX3v93Hin2XNHE417VyEb79D5zQ8vBWOa9hky3kxDNqCGM37xJhv4RsSGHtukZYxEroMHJ22bHxM38DVvkhQ3qp6r4P46pXx9FFirfph+x2PJxOSsRCiQ5+/I/ke9ZQSzsx1PgXnn2645nWfcJymEa5ojg1K1o2eQSXgl5fIZ3bYTktEQrxK3L40TYnBeYIcTEmbT4NUp4G6Yft6YPTCSbgS8sf7e3lfMBY9a9YZtUY1sLgj8oMQnmfw58P4zO9PFVrODvOpZ1CBGSMJQ6HI9ULSNZ3sC0PwZDOqx4CAOHcwBNzyXx97rQi1f3J4rqI0aqmArpBosuXKsyyU2J1dO479L/JJZ7/A97XjIKUBcwBxo/CJHj9JOV9NEg="
- secure: "f3qorap6yMRvOxIrgBqgJHA17ReNPJybVtIvsW+jlcMk2kk/4bgU6T6TSvwEygEF35MXT0f3WW4mqwvynRCsppjYlCXMGdbQMP1LrCn9g+O0iHL8UYob+ySopVMq61AFdi/esrnqn1PTLmA4am1IqG1wZPxG5mUVBiF9xWx/vNc/ee5ubTI06ujmNbtpIYv47OSgwbi9DLubwZztiOabXXbkODO8YzWK9+vYQ2XZfm2+5+QyIwLceby0kcxx1XU5SvNbqra3b8RfmywZEvxllKaRirK+wCVvBvxMhFh78zMyX1Rn35kGT2RZ5372BqW3vKtDElLGzJM672cZIi4uON7amLObFNCLyRhyoSegN57DHzX3lkRzdq0A/YRIImacvS/n3SIX0tHaiU2c+R5E+J92T0x8NwxxkoiqiISPatN7NDw3bmr5mZsz//4dLQ32w8ehCHgMTwmmqz+nAacudOJc4qaVyB0l6oEqXEb8E4F3YXbdhEqVavhDCZW3azYR+zA43V9JBgqXrGhSCQ2swRO+OAovZqZlHvxSbOQY8M5KD3hPallohv6k4GFEDCbQbMIkuz23Ep35BtaR4cRzz4sMNZaDAtLMmwcUogQgtsQ75+jrZ1Jul/VOnhvkp6U5I5VNnNvzf8nAnQ330g/ldcWNMSbuaQqjGcR64VRWHRA="
- CI_APP_IMAGE_WITH_TAG=quay.io/covex_nn/dsw-app:$TRAVIS_BRANCH
- CI_DEV_IMAGE_WITH_TAG=quay.io/covex_nn/dsw-dev:$TRAVIS_BRANCH
- CI_NGINX_IMAGE_WITH_TAG=quay.io/covex_nn/dsw-nginx:$TRAVIS_BRANCH
- CI_SOURCE_IMAGE_WITH_TAG=quay.io/covex_nn/dsw-source:$TRAVIS_BRANCH
- DOCKER_COMPOSE_VERSION=1.17.1
- SERVER_NAME=docker.local
jobs:
include:
- stage: Build Step1
language: generic
before_install:
- if [ "$TRAVIS_SECURE_ENV_VARS" = "false" ]; then exit 0; fi
- docker login -u covex_nn -p $QUAY_CLI_PASSWORD quay.io
install:
- docker pull $CI_DEV_IMAGE_WITH_TAG || true
- docker pull $CI_SOURCE_IMAGE_WITH_TAG || true
script:
- docker build
--cache-from $CI_DEV_IMAGE_WITH_TAG
--tag $CI_DEV_IMAGE_WITH_TAG
--target dev .
- docker build
--cache-from $CI_DEV_IMAGE_WITH_TAG
--cache-from $CI_SOURCE_IMAGE_WITH_TAG
--tag $CI_SOURCE_IMAGE_WITH_TAG
--target source .
after_script:
- docker push $CI_DEV_IMAGE_WITH_TAG
- docker push $CI_SOURCE_IMAGE_WITH_TAG
- docker logout quay.io
- stage: Build Step2
language: generic
before_install:
- if [ "$TRAVIS_SECURE_ENV_VARS" = "false" ]; then exit 0; fi
- docker login -u covex_nn -p $QUAY_CLI_PASSWORD quay.io
install:
- docker pull $CI_DEV_IMAGE_WITH_TAG || true
- docker pull $CI_SOURCE_IMAGE_WITH_TAG || true
- docker pull $CI_APP_WITH_TAG || true
script:
- docker build
--cache-from $CI_DEV_IMAGE_WITH_TAG
--cache-from $CI_SOURCE_IMAGE_WITH_TAG
--cache-from $CI_APP_IMAGE_WITH_TAG
--tag $CI_APP_IMAGE_WITH_TAG
--build-arg source_image=$CI_SOURCE_IMAGE_WITH_TAG
--target prod .
after_script:
- docker push $CI_APP_IMAGE_WITH_TAG
- docker logout quay.io
- stage: Build Step2
language: generic
before_install:
- if [ "$TRAVIS_SECURE_ENV_VARS" = "false" ]; then exit 0; fi
- docker login -u covex_nn -p $QUAY_CLI_PASSWORD quay.io
install:
- docker pull $CI_SOURCE_IMAGE_WITH_TAG || true
- docker pull $CI_NGINX_IMAGE_WITH_TAG || true
script:
- docker build
--cache-from $CI_NGINX_IMAGE_WITH_TAG
--tag $CI_NGINX_IMAGE_WITH_TAG
--build-arg server_name=$SERVER_NAME
--build-arg server_upstream=prod
--build-arg source_image=$CI_SOURCE_IMAGE_WITH_TAG
--target prod --file Dockerfile-nginx .
after_script:
- docker push $CI_NGINX_IMAGE_WITH_TAG
- docker logout quay.io
- stage: Deploy
language: generic
env:
DOCKER_ENV: remote
install:
- mkdir build
- docker-compose -f docker-compose.deploy.yml config > build/docker-compose.yml
- cd build
- cat docker-compose.yml
script:
- docker-compose up -d --no-recreate;
- docker-compose up -d --force-recreate --no-deps spare;
- docker-compose exec -T spare phing storage-prepare database-deploy -Dsymfony.env=prod;
- docker-compose up -d --force-recreate --no-deps php;
- echo "[$(date -R)] web-server is down"
- docker-compose stop nginx;
- docker-compose up -d nginx;
- echo "[$(date -R)] web-server is down"
after_success:
- docker-compose ps
after_failure:
- docker-compose ps
- docker-compose logs
- stage: Deploy
language: php
php: 7.2
env:
DOCKER_ENV: local
ENV_database_host: 127.0.0.1
before_install:
- sudo service mysql stop
- if [ $COMPOSER_GITHUB_TOKEN ]; then
echo '{"github-oauth":{"github.com":"'"$COMPOSER_GITHUB_TOKEN"'"}}' > auth.json;
else
echo '{ }' > auth.json;
fi
install:
- mkdir --parents "${HOME}/bin"
- wget "https://www.phing.info/get/phing-latest.phar" --output-document="${HOME}/bin/phing"
- chmod u+x "${HOME}/bin/phing"
- composer install
script:
- docker-compose up -d
- sleep 20s
- phing
- phpunit
after_success:
- docker-compose ps
after_failure:
- docker-compose ps
- docker-compose logs
- stage: Deploy
language: php
php: 7.2
env:
DOCKER_ENV: local_docker
before_install:
- if [ $COMPOSER_GITHUB_TOKEN ]; then
echo '{"github-oauth":{"github.com":"'"$COMPOSER_GITHUB_TOKEN"'"}}' > auth.json;
else
echo '{ }' > auth.json;
fi
install:
- composer install
before_script:
- sudo service mysql stop
- cp docker-compose.override.yml.dist docker-compose.override.yml
script:
- docker-compose up -d
- docker-compose exec -T php phing
- docker-compose exec -T php phpunit
after_success:
- docker-compose ps
after_failure:
- docker-compose ps
- docker-compose logs