1 | version: 2
|
2 |
|
3 | default: &defaults
|
4 | docker:
|
5 | - image: groupbyinc/circleci-java-node
|
6 |
|
7 | - image: groupbyinc/elasticsearch-local:6.0.0-rc1
|
8 | name: source_es
|
9 | auth:
|
10 | username: ${DOCKERHUB_USER}
|
11 | password: ${DOCKERHUB_PASS}
|
12 |
|
13 | - image: groupbyinc/elasticsearch-local:6.4.0
|
14 | name: dest_es
|
15 | auth:
|
16 | username: ${DOCKERHUB_USER}
|
17 | password: ${DOCKERHUB_PASS}
|
18 |
|
19 | - image: groupbyinc/redis:4.0.1
|
20 | name: redis
|
21 | auth:
|
22 | username: ${DOCKERHUB_USER}
|
23 | password: ${DOCKERHUB_PASS}
|
24 | environment:
|
25 | MAX_MEM_BYTES: "100MB"
|
26 |
|
27 | main_branch_only: &main_branch_only
|
28 | filters:
|
29 | branches:
|
30 | only:
|
31 | - master
|
32 |
|
33 | cache_key: &cache_key
|
34 | key: v1-dependencies-{{ .Branch }}-{{ .Revision }}
|
35 |
|
36 | setup_builder: &setup_builder
|
37 | run:
|
38 | name: Initialize Build Agent
|
39 | command: /scripts/setup.sh
|
40 |
|
41 | jobs:
|
42 | test:
|
43 | <<: *defaults
|
44 | steps:
|
45 | - checkout
|
46 | - restore_cache: *cache_key
|
47 | - *setup_builder
|
48 | - run: sudo npm install --global gulp-cli
|
49 | - run: npm install && npm install gulp-cli
|
50 | - save_cache:
|
51 | <<: *cache_key
|
52 | paths:
|
53 | - node_modules
|
54 | - run: environment=circle gulp test
|
55 | deploy:
|
56 | <<: *defaults
|
57 | steps:
|
58 | - setup_remote_docker
|
59 | - checkout
|
60 | - restore_cache: *cache_key
|
61 | - *setup_builder
|
62 | - run: npm publish
|
63 | - run:
|
64 | name: Build Image
|
65 | command: cd docker && docker build -t groupbyinc/chillastic .
|
66 | - run: docker push groupbyinc/chillastic
|
67 |
|
68 | workflows:
|
69 | version: 2
|
70 | build-and-push:
|
71 | jobs:
|
72 | - test:
|
73 | context: org-global
|
74 | - deploy:
|
75 | <<: *main_branch_only
|
76 | context: org-global
|
77 | requires:
|
78 | - test
|