-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.travis.yml
53 lines (48 loc) · 2.29 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
sudo: required
env:
- VERSION=9.3
- VERSION=9.4
- VERSION=9.5
- VERSION=9.6
- VERSION=10
- VERSION=11
- VERSION=12
services:
- docker
before_install:
- docker version
- docker network create --driver=bridge --subnet=192.168.0.0/16 --opt="com.docker.network.driver.mtu=1450" --opt="com.docker.network.bridge.name=redd0" nanobox
- sudo apt-get -y install python-pip
- sudo pip install docker==2.7.0 docker-squash
- git clone https://github.com/nanobox-io/nanobox-hooks-postgresql.git hooks
- docker build -t nanobox/postgresql:$VERSION ./$VERSION
script:
- sudo stdbuf -oL test/run_all.sh $VERSION
- sudo stdbuf -oL hooks/test/run_all.sh ${VERSION}
after_success:
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
- "echo \"Branch: '$BRANCH'; Version: '$VERSION'\";"
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
- docker build -t ${NAMESPACE}/postgresql ./${VERSION};
- docker-squash -t ${NAMESPACE}/postgresql:squashed -f nanobox/runit --tmp-dir /var/tmp/squasher ${NAMESPACE}/postgresql
# `$VERSION-beta` tag is always pushed (master or any dev branch)
- docker tag ${NAMESPACE}/postgresql:squashed ${NAMESPACE}/postgresql:${VERSION}-beta;
- docker push ${REMOTE}${NAMESPACE}/postgresql:${VERSION}-beta;
# `beta` tag is always pushed (master or any dev branch)
- if [ "$VERSION" == "9.5" ]; then
docker tag ${NAMESPACE}/postgresql:squashed ${NAMESPACE}/postgresql:beta;
docker push ${REMOTE}${NAMESPACE}/postgresql:beta;
fi
# `latest` tag is only pushed on master && most recent version
- if [ "$BRANCH" == "master" ] && [ "$VERSION" == "9.5" ]; then
docker tag ${NAMESPACE}/postgresql:squashed ${NAMESPACE}/postgresql;
docker push ${REMOTE}${NAMESPACE}/postgresql;
fi
# `$VERSION` (latest/stable implied) tag is only pushed on master. tag branch for clarity otherwise (`$VERSION-$BRANCH`)
- if [ "$BRANCH" == "master" ]; then
docker tag ${NAMESPACE}/postgresql:squashed ${NAMESPACE}/postgresql:${VERSION};
docker push ${REMOTE}${NAMESPACE}/postgresql:${VERSION};
else
docker tag ${NAMESPACE}/postgresql:squashed ${NAMESPACE}/postgresql:${VERSION}-${BRANCH//\//_};
docker push ${REMOTE}${NAMESPACE}/postgresql:${VERSION}-${BRANCH//\//_};
fi