-
-
Notifications
You must be signed in to change notification settings - Fork 134
/
.travis.yml
237 lines (202 loc) · 7.17 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
language: bash
sudo: required
# dist: trusty # 14.04
dist: xenial # 16.04
services:
- docker
env:
global:
# - DOCKER_COMPOSE_VERSION=1.22.0
- TZ=Asia/Shanghai
- GOPATH=/home/travis/go
- PATH=/home/travis/go/bin:$PATH
matrix:
include:
# - os: windows
# dist: 1803-containers
- os: linux
dist: xenial
before_install:
- 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) stable"
- sudo apt-get update
# - sudo apt-get -y install docker-ce
# https://download.docker.com/linux/ubuntu/dists/trusty/pool/stable/amd64/
- sudo apt-get -y install docker-ce=18.06.1~ce~3-0~ubuntu
- 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_3418790a352e_key -iv $encrypted_3418790a352e_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: 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: cli/test development
- stage: swarm
script:
- sudo rm /usr/local/bin/docker-compose
- ./lnmp-docker compose --official -f
- cli/test swarm
#
# wsl-debian
#
# Debian9 not support php56
# use ubuntu 16.04
- stage: wsl-php-builder-71
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.Dockerfile --build-arg PHP_VERSION=7.1.16 .
- export DOCKER_SERVICE_NAME=wsl-php-builder-71
- docker-compose build ${DOCKER_SERVICE_NAME}
after_success:
- docker-compose push ${DOCKER_SERVICE_NAME}
- docker-compose create ${DOCKER_SERVICE_NAME}
- . .env
- export DEB_NAME=khs1994-wsl-php_${PHP_VERSION_71}-debian-stretch_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-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 .
- export DOCKER_SERVICE_NAME=wsl-php-builder-72
- docker-compose build ${DOCKER_SERVICE_NAME}
after_success:
- docker-compose push ${DOCKER_SERVICE_NAME}
- docker-compose create ${DOCKER_SERVICE_NAME}
- . .env
- export DEB_NAME=khs1994-wsl-php_${PHP_VERSION_72}-debian-stretch_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-rhel-71
install:
- ./lnmp-docker compose --official -f
script:
- cd wsl
# - docker build -t test -f wsl.phpbuilder.rhel.Dockerfile --build-arg PHP_VERSION=7.1.16 .
- export DOCKER_SERVICE_NAME=wsl-php-builder-rhel-71
- docker-compose build ${DOCKER_SERVICE_NAME}
after_success:
- docker-compose push ${DOCKER_SERVICE_NAME}
- docker-compose create ${DOCKER_SERVICE_NAME}
- . .env
- export RPM_NAME=khs1994-wsl-php-${PHP_VERSION_71}-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-rhel-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 .
- export DOCKER_SERVICE_NAME=wsl-php-builder-rhel-72
- docker-compose build ${DOCKER_SERVICE_NAME}
after_success:
- docker-compose push ${DOCKER_SERVICE_NAME}
- docker-compose create ${DOCKER_SERVICE_NAME}
- . .env
- export RPM_NAME=khs1994-wsl-php-${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
#
# clusterkit
#
# - stage: memcached
# script:
# - stage: mysql
# script:
# - stage: redis-master-slave
# script:
# - stage: redis-sentinel
# script:
# - stage: redis-cluster-by-ruby
# script:
#
# deg
#
- stage: deb
script:
- 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
#
# yum
#
- stage: rpm
install:
# Don't build rc rpm
- test $( echo "${TRAVIS_TAG}" | grep rc ) && exit 0 || echo
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
# 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: tag
if: tag =~ /^(v18)/
- development
- swarm
- name: deb
if: tag =~ /^(v18)/
- name: rpm
if: tag =~ /^(v18)/
- name: wsl-php-builder-71
if: tag =~ /^(v18)/
- name: wsl-php-builder-72
if: tag =~ /^(v18)/
- name: wsl-php-builder-rhel-71
if: tag =~ /^(v18)/
- name: wsl-php-builder-rhel-72
if: tag =~ /^(v18)/
# branches:
# only:
# - master
# - '18.06'
# - dev
# - /^(v18)/