-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.travis.yml
48 lines (43 loc) · 2.2 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
sudo: required
env:
- VERSION=1.4
- VERSION=1.5
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-memcached.git hooks
- docker build -t nanobox/memcached:$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}/memcached ./${VERSION};
- docker-squash -t ${NAMESPACE}/memcached:squashed -f nanobox/runit --tmp-dir /var/tmp/squasher ${NAMESPACE}/memcached
# `$VERSION-beta` tag is always pushed (master or any dev branch)
- docker tag ${NAMESPACE}/memcached:squashed ${NAMESPACE}/memcached:${VERSION}-beta;
- docker push ${REMOTE}${NAMESPACE}/memcached:${VERSION}-beta;
# `beta` tag is always pushed (master or any dev branch)
- if [ "$VERSION" == "1.4" ]; then
docker tag ${NAMESPACE}/memcached:squashed ${NAMESPACE}/memcached:beta;
docker push ${REMOTE}${NAMESPACE}/memcached:beta;
fi
# `latest` tag is only pushed on master && most recent version
- if [ "$BRANCH" == "master" ] && [ "$VERSION" == "1.4" ]; then
docker tag ${NAMESPACE}/memcached:squashed ${NAMESPACE}/memcached;
docker push ${REMOTE}${NAMESPACE}/memcached;
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}/memcached:squashed ${NAMESPACE}/memcached:${VERSION};
docker push ${REMOTE}${NAMESPACE}/memcached:${VERSION};
else
docker tag ${NAMESPACE}/memcached:squashed ${NAMESPACE}/memcached:${VERSION}-${BRANCH//\//_};
docker push ${REMOTE}${NAMESPACE}/memcached:${VERSION}-${BRANCH//\//_};
fi