forked from khs1994-docker/lnmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
437 lines (389 loc) · 15.6 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
version: ~> 1.0
language: bash
# dist: trusty # 14.04
# dist: xenial # 16.04
dist: bionic # 18.04
services:
- docker
env:
global:
# - DOCKER_COMPOSE_VERSION=1.22.0
- TZ=Asia/Shanghai
- GOPATH=/home/travis/go
- PATH=/home/travis/go/bin:$PATH
- LNMP_PATH=/home/travis/build/khs1994-docker/lnmp
- LNMP_BRANCH=19.03
# matrix:
# include:
# # - os: windows
# # dist: 1803-containers
# - os: linux
# dist: xenial
before_install:
# remove some apt source
- cat /etc/apt/sources.list
- ls /etc/apt/sources.list.d || true
- sudo rm -rf /etc/apt/sources.list.d/pgdg.list || true
- date
- docker --version
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) test"
- sudo apt-get update
# - sudo apt-get -y install docker-ce || sudo apt -f install
# https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/
- apt-cache madison docker-ce | grep ${LNMP_BRANCH}
- DOCKER_VERSION=$(apt-cache madison docker-ce | grep ${LNMP_BRANCH} | head -n 1 | cut -d "|" -f 2 | sed s/[[:space:]]//g)
- echo ${DOCKER_VERSION}
- sudo apt-get -y install docker-ce=${DOCKER_VERSION}
- sudo cat /etc/docker/daemon.json || true
- cat /etc/resolv.conf
- docker version
# 升级最新 Docker Compose
# - docker-compose --version
# - sudo rm /usr/local/bin/docker-compose
# - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION:-1.20.1}/docker-compose-`uname -s`-`uname -m` > docker-compose
# - chmod +x docker-compose
# - sudo mv docker-compose /usr/local/bin
# - docker-compose --version
# 部署公钥
- openssl aes-256-cbc -K $encrypted_70ae0c965114_key -iv $encrypted_70ae0c965114_iv -in cli/khs1994-robot.enc -out ~/.ssh/id_rsa -d
- chmod 600 ~/.ssh/id_rsa
# git config
- git config --global user.name "khs1994-merge-robot"
- git config --global user.email "[email protected]"
# verify version
- docker --version
- docker-compose --version
# docker login
- echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin
#
# github release
#
- sudo apt update ; sudo apt install -y golang
- go get github.com/aktau/github-release
- github-release --help
jobs:
include:
# - stage: docs
# script:
# - cd docs
# - docker run -it --rm -v $PWD:/srv/gitbook-src khs1994/gitbook
# - sudo touch _book/CNAME
# - sudo echo "docs.lnmp.khs1994.com" | sudo tee _book/CNAME
# deploy:
# provider: pages
# repo: khs1994-docker/lnmp-docs
# skip-cleanup: true
# local-dir: docs/_book
# keep-history: true
# github-token: $GITHUB_TOKEN
# on:
# branch:
# - master
# - 19.03
- stage: tag
script: |
github-release info -u khs1994-docker -r lnmp -t ${TRAVIS_TAG} || \
cat CHANGELOG.md | github-release release -u khs1994-docker -r lnmp -t ${TRAVIS_TAG} --draft -d -
- stage: development
install:
- sudo rm /usr/local/bin/docker-compose
- ./lnmp-docker compose --official -f
script:
- ./lnmp-docker services
- ./lnmp-docker config > docker-compose.yml
- docker-compose config -q
- docker-compose up -d $(./lnmp-docker services)
- sleep 20
- docker ps -a
- curl 127.0.0.1
- ./lnmp-docker down
- QUITE=true ./lnmp-docker test development
- stage: swarm
script:
- sudo rm /usr/local/bin/docker-compose
- ./lnmp-docker compose --official -f
- QUITE=true ./lnmp-docker test swarm
# wsl-debian
- stage: wsl-php-builder-72
name: wsl-php-builder-72
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export DEB_NAME=khs1994-wsl-php72_${PHP_VERSION_72}-debian-buster_amd64.deb
- docker cp $( docker container ls -a --format {{.ID}} ):/${DEB_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${DEB_NAME}" --file "${DEB_NAME}" -R
- stage: wsl-php-builder-73
name: wsl-php-builder-73
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export DEB_NAME=khs1994-wsl-php73_${PHP_VERSION_73}-debian-buster_amd64.deb
- docker cp $( docker container ls -a --format {{.ID}} ):/${DEB_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${DEB_NAME}" --file "${DEB_NAME}" -R
- stage: wsl-php-builder-74
name: wsl-php-builder-74
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export DEB_NAME=khs1994-wsl-php74_${PHP_VERSION_74}-debian-buster_amd64.deb
- docker cp $( docker container ls -a --format {{.ID}} ):/${DEB_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${DEB_NAME}" --file "${DEB_NAME}" -R
# wsl ubuntu 18.04
- stage: wsl-php-builder-ubuntu1804-72
name: wsl-php-builder-ubuntu1804-72
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export DEB_NAME=khs1994-wsl-php72_${PHP_VERSION_72}-ubuntu-bionic_amd64.deb
- docker cp $( docker container ls -a --format {{.ID}} ):/${DEB_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${DEB_NAME}" --file "${DEB_NAME}" -R
- stage: wsl-php-builder-ubuntu1804-73
name: wsl-php-builder-ubuntu1804-73
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export DEB_NAME=khs1994-wsl-php73_${PHP_VERSION_73}-ubuntu-bionic_amd64.deb
- docker cp $( docker container ls -a --format {{.ID}} ):/${DEB_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${DEB_NAME}" --file "${DEB_NAME}" -R
- stage: wsl-php-builder-ubuntu1804-74
name: wsl-php-builder-ubuntu1804-74
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export DEB_NAME=khs1994-wsl-php74_${PHP_VERSION_74}-ubuntu-bionic_amd64.deb
- docker cp $( docker container ls -a --format {{.ID}} ):/${DEB_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${DEB_NAME}" --file "${DEB_NAME}" -R
# wsl rhel
- stage: wsl-php-builder-rhel7-72
name: wsl-php-builder-rhel7-72
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.rhel.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export RPM_NAME=khs1994-wsl-php72-${PHP_VERSION_72}-1.el7.centos.x86_64.rpm
- docker cp $( docker container ls -a --format {{.ID}} ):/${RPM_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${RPM_NAME}" --file "${RPM_NAME}" -R
- stage: wsl-php-builder-rhel7-73
name: wsl-php-builder-rhel7-73
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.rhel.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export RPM_NAME=khs1994-wsl-php73-${PHP_VERSION_73}-1.el7.centos.x86_64.rpm
- docker cp $( docker container ls -a --format {{.ID}} ):/${RPM_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${RPM_NAME}" --file "${RPM_NAME}" -R
- stage: wsl-php-builder-rhel8-73
name: wsl-php-builder-rhel8-73
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.rhel.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export RPM_NAME=khs1994-wsl-php73-${PHP_VERSION_73}-1.el8.centos.x86_64.rpm
- docker cp $( docker container ls -a --format {{.ID}} ):/${RPM_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${RPM_NAME}" --file "${RPM_NAME}" -R
- stage: wsl-php-builder-rhel8-74
name: wsl-php-builder-rhel8-74
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.rhel.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export RPM_NAME=khs1994-wsl-php74-${PHP_VERSION_74}-1.el8.centos.x86_64.rpm
- docker cp $( docker container ls -a --format {{.ID}} ):/${RPM_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${RPM_NAME}" --file "${RPM_NAME}" -R
- stage: wsl-php-builder-fc31-73
name: wsl-php-builder-fc31-73
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.rhel.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export RPM_NAME=khs1994-wsl-php73-${PHP_VERSION_73}-1.fc31.x86_64.rpm
- docker cp $( docker container ls -a --format {{.ID}} ):/${RPM_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${RPM_NAME}" --file "${RPM_NAME}" -R
- stage: wsl-php-builder-fc31-74
name: wsl-php-builder-fc31-74
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.rhel.Dockerfile --build-arg PHP_VERSION=7.2.5 .
- docker-compose build ${TRAVIS_JOB_NAME}
after_success:
- docker-compose push ${TRAVIS_JOB_NAME}
- docker-compose run ${TRAVIS_JOB_NAME} command || true
- . .env
- export RPM_NAME=khs1994-wsl-php74-${PHP_VERSION_74}-1.fc31.x86_64.rpm
- docker cp $( docker container ls -a --format {{.ID}} ):/${RPM_NAME} .
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${RPM_NAME}" --file "${RPM_NAME}" -R
# clusterkit
# - stage: memcached
# script:
# - stage: mysql
# script:
# - stage: redis-master-slave
# script:
# - stage: redis-sentinel
# script:
# - stage: redis-cluster-by-ruby
# script:
- stage: deb
script:
- ./lnmp-docker compose --official -f
- sh cli/build.sh deb ${TRAVIS_TAG}
- export VERSION=$( echo ${TRAVIS_TAG} | cut -d "v" -f 2 )
- export DEB_NAME=khs1994-docker-lnmp_${VERSION}_amd64.deb
- ls -la cli
- sudo dpkg -i cli/${DEB_NAME}
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${DEB_NAME}" --file "cli/${DEB_NAME}" -R
- stage: rpm
install:
# Don't build rc rpm
- test $( echo "${TRAVIS_TAG}" | grep alpha ) && exit 0 || true
- test $( echo "${TRAVIS_TAG}" | grep beta ) && exit 0 || true
- test $( echo "${TRAVIS_TAG}" | grep rc ) && exit 0 || true
script:
- sudo apt install -y rpm
- sh cli/build.sh rpm ${TRAVIS_TAG}
- export VERSION=$( echo ${TRAVIS_TAG} | cut -d "v" -f 2 )
- export RPM_NAME=$( cd $HOME; ls *.rpm )
- ls -la ~/*.rpm
- github-release upload --user khs1994-docker --repo lnmp --tag ${TRAVIS_TAG} --name "${RPM_NAME}" --file "${HOME}/${RPM_NAME}" -R
- stage: checkConfig
script:
- sudo apt install -y tree
- cd config
- ./default.sh
- tree .
- cd ..
- git status | grep "nothing to commit" && exit 0 || true
- git add .
- git commit -m "[Config] Update default config" || exit 0
- git remote add github https://khs1994:${GITHUB_TOKEN}@github.com/khs1994-docker/lnmp.git
- git checkout -b 19.03-config
- git push github 19.03-config -f
# stages:
# - test
# # - name: deploy
# # if: tag =~ ^[0-9.]+$
# # if: branch = master
# # if: type IN (push, pull_request, api, cron)
# https://docs.travis-ci.com/user/conditions-v1
stages:
- name: development
if: branch = "master"
- name: swarm
if: branch = "master"
- name: checkConfig
if: |
branch = "19.03"
- name: tag
if: tag =~ /^(v19)/
# don't run
# - name: docs
# if: tag =~ /^(vxx)/
- name: deb
if: tag =~ /^(v19)/
- name: rpm
if: tag =~ /^(v19)/
- name: wsl-php-builder-72
if: tag =~ /^(v19)/
- name: wsl-php-builder-73
if: tag =~ /^(v19)/
- name: wsl-php-builder-74
if: tag =~ /^(v19)/
- name: wsl-php-builder-ubuntu1804-72
if: tag =~ /^(v19)/
- name: wsl-php-builder-ubuntu1804-73
if: tag =~ /^(v19)/
- name: wsl-php-builder-ubuntu1804-74
if: tag =~ /^(v19)/
- name: wsl-php-builder-rhel7-72
if: tag =~ /^(v19)/
- name: wsl-php-builder-rhel7-73
if: tag =~ /^(v19)/
- name: wsl-php-builder-rhel8-73
if: tag =~ /^(v19)/
- name: wsl-php-builder-rhel8-74
if: tag =~ /^(v19)/
- name: wsl-php-builder-fc31-73
if: tag =~ /^(v19)/
- name: wsl-php-builder-fc31-74
if: tag =~ /^(v19)/
# branches:
# only:
# - master
# - '18.06'
# - dev
# - /^(v18)/