forked from EncoreTechnologies/st2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
78 lines (73 loc) · 2.53 KB
/
circle.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
general:
branches:
only:
- master
- /v[0-9]+(\.[0-9]+)*/
machine:
pre:
- sudo cp /home/ubuntu/.ssh/config /root/.ssh/config
- sudo curl -L -o /usr/bin/docker 'http://s3-external-1.amazonaws.com/circle-downloads/docker-1.9.0-circleci'
- sudo chmod 0755 /usr/bin/docker
- sudo service docker start
post:
- sudo service postgresql stop
- sudo service rabbitmq-server stop
- sudo service mongodb stop
# Since CircleCI runs every command in separate shell, it's not possible to export VAR
# Workaround with files for "setting variables"
checkout:
post:
- |
case $CIRCLE_NODE_INDEX in
0)
echo 'debian' > ~/DISTRO
;;
1)
echo 'ubuntu' > ~/DISTRO
;;
2)
echo 'centos7' > ~/DISTRO
;;
esac
- python -c 'execfile("st2common/st2common/__init__.py"); print __version__' > ~/ST2PKG_VERSION
- scripts/bintray.sh next-revision `cat ~/ST2PKG_VERSION` > ~/ST2PKG_RELEASE
- echo `cat ~/ST2PKG_VERSION`-`cat ~/ST2PKG_RELEASE`
dependencies:
pre:
- sudo -H pip install --upgrade pip
- sudo -H pip install docker-compose
- docker-compose version
override:
- echo Dependencies
- docker-compose pull `cat ~/DISTRO`:
parallel: true
test:
override:
- echo Test
- ST2PKG_VERSION=`cat ~/ST2PKG_VERSION` ST2PKG_RELEASE=`cat ~/ST2PKG_RELEASE` ST2_GITREV=$CIRCLE_BRANCH docker-compose up `cat ~/DISTRO`:
parallel: true
post:
- mkdir ${CIRCLE_ARTIFACTS}/`cat ~/DISTRO`
- cp -R /tmp/st2-packages/tmp.*/* ${CIRCLE_ARTIFACTS}/`cat ~/DISTRO`
- cp -R ${CIRCLE_ARTIFACTS}/`cat ~/DISTRO`/* scripts/
- echo Build and Run Docker
- docker build -t arma/st2:${CIRCLE_BRANCH} scripts/
- docker run --name st2docker -d arma/st2:${CIRCLE_BRANCH}
# Same as: docker exec st2docker st2 --version
# See: https://circleci.com/docs/docker#docker-exec
- sudo lxc-attach -n "$(docker inspect --format '{{.Id}}' st2docker)" -- bash -c 'st2 --version'
deployment:
stable:
branch: /v[0-9]+(\.[0-9]+)*/
commands:
- echo Running stable deploy
- scripts/bintray.sh deploy deb ${CIRCLE_ARTIFACTS}/`cat ~/DISTRO`
- docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASSWORD}
- docker push arma/st2
unstable:
branch: master
commands:
- echo Running unstable deploy
- scripts/bintray.sh deploy deb ${CIRCLE_ARTIFACTS}/`cat ~/DISTRO`
- docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASSWORD}
- docker push arma/st2