forked from mozilla/addons-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
72 lines (61 loc) · 2.52 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
# These environment variables must be set in CircleCI UI
#
# DOCKERHUB_REPO - docker hub repo, format: <username>/<repo>
# DOCKER_EMAIL - login info for docker hub
# DOCKER_USER
# DOCKER_PASS
machine:
pre:
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
node:
version: 4.3.1
services:
- docker
dependencies:
cache_directories:
- "~/docker"
pre:
- npm install -g npm@3
- sudo apt-get update; sudo apt-get install pigz
- sudo pip install tox mozdownload mozinstall
- mozdownload --version latest --destination firefox.tar.bz2
- mozinstall firefox.tar.bz2
- wget -O geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v0.10.0/geckodriver-v0.10.0-linux64.tar.gz
- gunzip -c geckodriver.tar.gz | tar xopf -
- chmod +x geckodriver && mv geckodriver /home/ubuntu/bin/
override:
- docker info
# Build the container, using Circle's Docker cache. Only use 1 image per
# day to keep the cache size down.
- I="image-$(date +%j).gz"; if [[ -e ~/docker/$I ]]; then echo "Loading $I"; pigz -d -c ~/docker/$I | docker load; fi
- docker build --pull -t addons-frontend .
- docker images
# write the sha256 sum to an artifact to make image verification easier
- docker images --no-trunc | awk '/^app/ {print $3}' | tee $CIRCLE_ARTIFACTS/docker-image-shasum256.txt
# Clean up any old images; save the new one.
- I="image-$(date +%j).gz"; mkdir -p ~/docker; rm ~/docker/*; docker save addons-frontend | pigz --fast -c > ~/docker/$I; ls -l ~/docker
test:
override:
- docker run -d -p 4000:4000 -e NODE_APP_INSTANCE=disco -e NODE_ENV=uitests addons-frontend /bin/sh -c "npm run build && npm run start" && sleep 60
- tox -e discopane-ui-tests --
--base-url=http://localhost:4000
--firefox-path=firefox/firefox
# appropriately tag and push the container to dockerhub
deployment:
hub_latest:
branch: "master"
commands:
- "[ ! -z $DOCKERHUB_REPO ]"
- "docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS"
- "docker tag addons-frontend $DOCKERHUB_REPO:latest"
- "docker push $DOCKERHUB_REPO:latest"
hub_releases:
# push all tags
tag: /.*/
commands:
- "[ ! -z $DOCKERHUB_REPO ]"
- "docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS"
- "echo $DOCKERHUB_REPO:$CIRCLE_TAG"
- "docker tag addons-frontend $DOCKERHUB_REPO:$CIRCLE_TAG"
- "docker images"
- "docker push $DOCKERHUB_REPO:$CIRCLE_TAG"