forked from devilbox/docker-php-fpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
143 lines (126 loc) · 4.48 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
---
###
### Travis settings
###
sudo: required
language: minimal
services:
- docker
###
### Build Matrix
###
env:
global:
- IMAGE: devilbox/php-fpm
matrix:
- PHP=5.2
- PHP=5.3
- PHP=5.4
- PHP=5.5
- PHP=5.6
- PHP=7.0
- PHP=7.1
- PHP=7.2
- PHP=7.3
- PHP=7.4
- PHP=8.0
###
### Install requirements
###
install:
- docker version
# Disable services enabled by default
# http://docs.travis-ci.com/user/database-setup/#MySQL
- sudo /etc/init.d/httpd stop || true
- sudo /etc/init.d/memcached stop || true
- sudo /etc/init.d/mongodb stop || true
- sudo /etc/init.d/mysql stop || true
- sudo /etc/init.d/nginx stop || true
- sudo /etc/init.d/postgresql stop || true
- sudo /etc/init.d/redis stop || true
- sudo service httpd stop || true
- sudo service memcached stop || true
- sudo service mongodb stop || true
- sudo service mysql stop || true
- sudo service nginx stop || true
- sudo service postgresql stop || true
- sudo service redis stop || true
- netstat -tulpn
- retry() {
for ((n=0; n<10; n++)); do
echo "[${n}] ${*}";
if eval "${*}"; then
return 0;
fi;
done;
return 1;
}
###
### Check generation changes, build and test
###
before_script:
# Regenerate Dockerfiles and make sure nothing has changed (every stage)
- make gen-dockerfiles
- git diff --quiet || { echo "Build Changes"; git diff; git status; false; }
# Build (multiple tries due to network outages)
- retry make build-base VERSION=${PHP}
#- retry make test-base VERSION=${PHP}
- retry make build-mods VERSION=${PHP}
#- retry make test-mods VERSION=${PHP}
- retry make build-prod VERSION=${PHP}
#- retry make test-prod VERSION=${PHP}
- retry make build-work VERSION=${PHP}
- retry make test-work VERSION=${PHP}
# Test if PHP modules have changed
- make gen-readme VERSION=${PHP}
- git diff --quiet || { echo "Build Changes"; git diff; git status; false; }
###
### Push to Dockerhub
###
script:
- if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
make login USERNAME="${DOCKER_USERNAME}" PASSWORD="${DOCKER_PASSWORD}";
if [ "${TRAVIS_BRANCH}" == "master" ]; then
echo "Pushing latest";
make push TAG="${PHP}-base" &&
make push TAG="${PHP}-mods" &&
make push TAG="${PHP}-prod" &&
make push TAG="${PHP}-work";
elif [[ ${TRAVIS_BRANCH} =~ ^(release-[.0-9]+)$ ]]; then
echo "Pushing branch ${TRAVIS_BRANCH}";
make tag OLD_TAG="${PHP}-base" NEW_TAG="${PHP}-base-${TRAVIS_BRANCH}" &&
make tag OLD_TAG="${PHP}-mods" NEW_TAG="${PHP}-mods-${TRAVIS_BRANCH}" &&
make tag OLD_TAG="${PHP}-prod" NEW_TAG="${PHP}-prod-${TRAVIS_BRANCH}" &&
make tag OLD_TAG="${PHP}-work" NEW_TAG="${PHP}-work-${TRAVIS_BRANCH}" &&
make push TAG="${PHP}-base-${TRAVIS_BRANCH}" &&
make push TAG="${PHP}-mods-${TRAVIS_BRANCH}" &&
make push TAG="${PHP}-prod-${TRAVIS_BRANCH}" &&
make push TAG="${PHP}-work-${TRAVIS_BRANCH}";
elif [ -n "${TRAVIS_TAG}" ]; then
echo "Pushing tag ${TRAVIS_TAG}";
make tag OLD_TAG="${PHP}-base" NEW_TAG="${PHP}-base-${TRAVIS_TAG}" &&
make tag OLD_TAG="${PHP}-mods" NEW_TAG="${PHP}-mods-${TRAVIS_TAG}" &&
make tag OLD_TAG="${PHP}-prod" NEW_TAG="${PHP}-prod-${TRAVIS_TAG}" &&
make tag OLD_TAG="${PHP}-work" NEW_TAG="${PHP}-work-${TRAVIS_TAG}" &&
make push TAG="${PHP}-base-${TRAVIS_TAG}" &&
make push TAG="${PHP}-mods-${TRAVIS_TAG}" &&
make push TAG="${PHP}-prod-${TRAVIS_TAG}" &&
make push TAG="${PHP}-work-${TRAVIS_TAG}";
elif [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then
if MY_TAG="$( git describe --exact-match "$(git rev-parse HEAD)" 2>/dev/null )"; then
echo "Pushing cron tag ${MY_TAG}";
make tag OLD_TAG="${PHP}-base" NEW_TAG="${PHP}-base-${MY_TAG}" &&
make tag OLD_TAG="${PHP}-mods" NEW_TAG="${PHP}-mods-${MY_TAG}" &&
make tag OLD_TAG="${PHP}-prod" NEW_TAG="${PHP}-prod-${MY_TAG}" &&
make tag OLD_TAG="${PHP}-work" NEW_TAG="${PHP}-work-${MY_TAG}" &&
make push TAG="${PHP}-base-${MY_TAG}" &&
make push TAG="${PHP}-mods-${MY_TAG}" &&
make push TAG="${PHP}-prod-${MY_TAG}" &&
make push TAG="${PHP}-work-${MY_TAG}";
fi
else
echo "Skipping push to dockerhub on normal branches";
fi
else
echo "Skipping push to dockerhub on PR";
fi