|
1 | 1 | version: 2
|
2 | 2 | jobs:
|
3 | 3 | build_test:
|
4 |
| - parallelism: 1 |
5 | 4 | docker:
|
6 | 5 | - image: circleci/elixir:1.9.4
|
7 | 6 | environment:
|
8 | 7 | MIX_ENV: test
|
9 |
| - - image: circleci/postgres:10.1-alpine |
10 |
| - environment: |
11 |
| - POSTGRES_USER: postgres |
12 |
| - POSTGRES_DB: ez_coins_test |
13 |
| - POSTGRES_PASSWORD: postgres |
14 |
| - working_directory: ~/api |
15 | 8 | steps:
|
16 | 9 | - checkout
|
17 |
| - |
18 | 10 | - run: mix local.hex --force
|
19 | 11 | - run: mix local.rebar --force
|
20 |
| - |
21 | 12 | - restore_cache:
|
22 |
| - keys: |
23 |
| - - v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }} |
24 |
| - - v1-mix-cache-{{ .Branch }} |
25 |
| - - v1-mix-cache |
| 13 | + key: v1-deps-cache-{{ checksum "mix.lock" }} |
| 14 | + - run: mix do deps.get, deps.compile |
| 15 | + - save_cache: |
| 16 | + key: v1-deps-cache-{{ checksum "mix.lock" }} |
| 17 | + paths: |
| 18 | + - deps |
| 19 | + - ~/.mix |
| 20 | + - _build |
| 21 | + - run: mix compile |
| 22 | + - run: echo "$OTP_VERSION $ELIXIR_VERSION" > .version_file |
26 | 23 | - restore_cache:
|
27 | 24 | keys:
|
28 |
| - - v1-build-cache-{{ .Branch }} |
29 |
| - - v1-build-cache |
30 |
| - - run: mix do deps.get, compile |
| 25 | + - plt-cache-{{ checksum ".version_file" }}-{{ checksum "mix.lock" }} |
| 26 | + - run: mix dialyzer --plt |
31 | 27 | - save_cache:
|
32 |
| - key: v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }} |
33 |
| - paths: "deps" |
34 |
| - - save_cache: |
35 |
| - key: v1-mix-cache-{{ .Branch }} |
36 |
| - paths: "deps" |
37 |
| - - save_cache: |
38 |
| - key: v1-mix-cache |
39 |
| - paths: "deps" |
40 |
| - - save_cache: |
41 |
| - key: v1-build-cache-{{ .Branch }} |
42 |
| - paths: "_build" |
43 |
| - - save_cache: |
44 |
| - key: v1-build-cache |
45 |
| - paths: "_build" |
46 |
| - |
| 28 | + key: plt-cache-{{ checksum ".version_file" }}-{{ checksum "mix.lock" }} |
| 29 | + paths: |
| 30 | + - _build |
| 31 | + - deps |
| 32 | + - ~/.mix |
| 33 | + dialyzer: |
| 34 | + docker: |
| 35 | + - image: circleci/elixir:1.9.4 |
| 36 | + environment: |
| 37 | + MIX_ENV: test |
| 38 | + steps: |
| 39 | + - checkout |
| 40 | + - run: echo "$OTP_VERSION $ELIXIR_VERSION" > .version_file |
| 41 | + - restore_cache: |
| 42 | + keys: |
| 43 | + - plt-cache-{{ checksum ".version_file" }}-{{ checksum "mix.lock" }} |
47 | 44 | - run:
|
48 |
| - name: Wait for DB |
49 |
| - command: dockerize -wait tcp://localhost:5432 -timeout 1m |
50 |
| - |
| 45 | + name: Execute dialyzer |
| 46 | + command: mix dialyzer --halt-exit-status |
| 47 | + test: |
| 48 | + docker: |
| 49 | + - image: circleci/elixir:1.9.4 |
| 50 | + - image: circleci/postgres:10.1-alpine |
| 51 | + environment: |
| 52 | + POSTGRES_USER: postgres |
| 53 | + POSTGRES_DB: ez_coins_test |
| 54 | + POSTGRES_PASSWORD: postgres |
| 55 | + steps: |
| 56 | + - checkout |
| 57 | + - restore_cache: |
| 58 | + key: v1-deps-cache-{{ checksum "mix.lock" }} |
51 | 59 | - run: mix test
|
52 |
| - |
53 |
| - - store_test_results: |
54 |
| - path: _build/test/lib/ez_coins_api |
| 60 | + generate_documentation: |
| 61 | + docker: |
| 62 | + - image: circleci/elixir:1.9.4 |
| 63 | + environment: |
| 64 | + MIX_ENV: test |
| 65 | + steps: |
| 66 | + - checkout |
| 67 | + - restore_cache: |
| 68 | + key: v1-deps-cache-{{ checksum "mix.lock" }} |
| 69 | + - run: mix docs |
| 70 | + - store_artifacts: |
| 71 | + path: doc |
| 72 | + destination: documentation |
| 73 | + format_check: |
| 74 | + docker: |
| 75 | + - image: circleci/elixir:1.9.4 |
| 76 | + environment: |
| 77 | + MIX_ENV: test |
| 78 | + steps: |
| 79 | + - checkout |
| 80 | + - restore_cache: |
| 81 | + key: v1-deps-cache-{{ checksum "mix.lock" }} |
| 82 | + - run: mix format --check-formatted |
55 | 83 | build_production:
|
56 | 84 | docker:
|
57 | 85 | - image: docker:17.05.0-ce-git
|
@@ -97,9 +125,21 @@ jobs:
|
97 | 125 |
|
98 | 126 | workflows:
|
99 | 127 | version: 2
|
100 |
| - test: |
| 128 | + checks: |
101 | 129 | jobs:
|
102 | 130 | - build_test
|
| 131 | + - format_check: |
| 132 | + requires: |
| 133 | + - build_test |
| 134 | + - generate_documentation: |
| 135 | + requires: |
| 136 | + - build_test |
| 137 | + - dialyzer: |
| 138 | + requires: |
| 139 | + - build_test |
| 140 | + - test: |
| 141 | + requires: |
| 142 | + - build_test |
103 | 143 | deploy_production:
|
104 | 144 | jobs:
|
105 | 145 | - build_production:
|
|
0 commit comments