-
Notifications
You must be signed in to change notification settings - Fork 2
/
circle.yml
104 lines (93 loc) · 3.3 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
version: 2.1
references:
project: &project markets-etl
dir: &dir ~/markets-etl
img: &img circleci/clojure:lein-2.9.0 # leave this pinned; using cimg/clojure:1.10.1 fails
path: &path /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/circleci/.local/bin:/root/.local/bin
environment: &environment
environment:
- PATH: *path
orbs:
codecov: codecov/[email protected]
executors:
clojure_and_postgres:
working_directory: *dir
environment:
- PATH: *path
- TEST_JDBC_DB_URI: jdbc:postgresql://localhost:5432/postgres?loginTimeout=30&socketTimeout=900&tcpKeepAlive=true&user=postgres
docker:
- image: *img
- image: circleci/postgres:9.6.9-alpine # for integration test
clojure:
working_directory: *dir
<<: *environment
docker:
- image: *img
commands:
restore_and_save_cache:
steps:
- restore_cache:
key: \<< checksum "project.clj" \>> # << and >> must be escaped: https://circleci.com/docs/2.0/build-processing/#limitations
- run: lein deps
- save_cache:
paths:
- ~/.m2
- ~/.lein
key: \<< checksum "project.clj" \>>
install-aws-cli:
steps:
- run: sudo apt update; sudo apt install -y -qq python3-pip; pip3 install awscli --upgrade --user
save-uberjar:
steps:
- persist_to_workspace:
root: .
paths:
- target/uberjar/app.jar
jobs:
test:
executor: clojure_and_postgres
steps:
- checkout
- restore_and_save_cache
- run: lein cloverage --codecov
- run: lein test
- run: lein cljfmt check
- codecov/upload:
file: target/coverage/codecov.json
publish:
executor: clojure
steps:
- checkout
- restore_and_save_cache
- setup_remote_docker
- run: deploy/bin/publish-image
- save-uberjar
- store_artifacts:
path: target/uberjar/app.jar
markets-etl-lambda-build-and-deploy:
executor: clojure
steps:
- install-aws-cli
- run: git clone https://github.com/skilbjo/lambdas.git ~/lambdas
- run: git clone https://github.com/skilbjo/markets-etl.git ~/markets-etl
- run: cd ~/lambdas; cd markets-etl; deploy/build-project
- run: cd ~/lambdas; cd markets-etl; lein uberjar
#- attach_workspace: { at: ~/lambdas/markets-etl } # grab already-generated uberjar ## Dont do this, so publish will have most recent build number
- run: mkdir -p ~/.aws; echo '[skilbjo-robot]' >~/.aws/credentials; echo "aws_access_key_id = $robot_aws_access_key_id" >>~/.aws/credentials; echo "aws_secret_access_key = $robot_aws_secret_access_key" >>~/.aws/credentials;
- run: if [[ $CIRCLE_BRANCH == 'master' ]]; then cd ~/lambdas; cd markets-etl; deploy/publish-lambda; fi
workflows:
commit:
jobs:
- test
- publish:
requires:
- test
- markets-etl-lambda-build-and-deploy # add this requirement here
# only to ensure "publish" is
- markets-etl-lambda-build-and-deploy: # the job with the most recent
filters: # build number sequence
branches:
only:
- master
requires:
- test