@@ -3,45 +3,116 @@ general:
3
3
branches :
4
4
ignore :
5
5
- gh-pages
6
+ defaults : &defaults
7
+ working_directory : ~/bootleg
6
8
jobs :
7
9
build :
8
- machine : true
9
- working_directory : ~/bootleg
10
+ << : *defaults
11
+ parallelism : 1 # run only one instance of this job in parallel
12
+ docker : # run the steps with Docker
13
+ - image : circleci/elixir:1.6
14
+ environment : # environment variables for primary container
15
+ SHELL : /bin/bash
10
16
steps :
11
17
- checkout
12
- - run : echo 'export INSTALL_PATH="$HOME/dependencies";export PATH="$INSTALL_PATH/bin:$PATH";export MIX_ENV=test;export VERSION_CIRCLECI=2' >> $BASH_ENV
18
+
19
+ - run : mix local.hex --force
20
+ - run : mix local.rebar --force
21
+
22
+ - restore_cache : # restores saved mix cache
23
+ keys : # list of cache keys, in decreasing specificity
24
+ - mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
25
+ - mix-cache-{{ .Branch }}
26
+ - mix-cache
27
+ - restore_cache : # restores saved build cache
28
+ keys :
29
+ - build-cache-{{ .Branch }}
30
+ - build-cache
31
+ - restore_cache : # restores saved plt cache
32
+ keys :
33
+ - dialyzer-cache
34
+
35
+ - run : mix do deps.get, deps.compile # get updated dependencies & compile them
36
+
37
+ - save_cache : # generate and store cache so `restore_cache` works
38
+ key : mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
39
+ paths : " deps"
40
+ - save_cache : # make another less specific cache
41
+ key : mix-cache-{{ .Branch }}
42
+ paths : " deps"
43
+ - save_cache : # and one more build cache for good measure
44
+ key : mix-cache
45
+ paths : " deps"
46
+
47
+ - run : mix compile
48
+
49
+ - save_cache : # save a *build* cache, too
50
+ key : build-cache-{{ .Branch }}
51
+ paths : " _build"
52
+ - save_cache : # and one more build cache for good measure
53
+ key : build-cache
54
+ paths : " _build"
55
+
56
+ - run : mix do format --check-formatted, credo --strict
57
+ - run : mix test --exclude functional
58
+ - run : mix dialyzer --halt-exit-status
59
+
60
+ - save_cache :
61
+ key : dialyzer-cache
62
+ paths : " _build/test/dialyxir*.plt"
63
+
64
+ - store_test_results :
65
+ path : ~/bootleg/_build/test/lib/bootleg
66
+
67
+ functional :
68
+ << : *defaults
69
+ machine :
70
+ image : circleci/classic:latest
71
+ steps :
72
+ - checkout
73
+ - run :
74
+ name : Setup Environment Variables
75
+ command : |
76
+ echo 'export INSTALL_PATH="$HOME/dependencies"' >> $BASH_ENV
77
+ echo 'export PATH="$INSTALL_PATH/bin:$PATH"' >> $BASH_ENV
78
+ echo 'export VERSION_CIRCLECI=2' >> $BASH_ENV
79
+ echo 'export COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN' >> $BASH_ENV
80
+ echo 'export CI_PULL_REQUEST=$CIRCLE_PR_NUMBER' >> $BASH_ENV
13
81
- restore_cache :
14
- key : environment-cache-{{ checksum ".circleci/config.yml" }}-{{ checksum " script/ci/prepare.sh" }}-{{ arch }}
82
+ key : environment-cache-{{ checksum "script/ci/prepare.sh" }}-{{ arch }}
15
83
- run :
16
84
name : Install Elixir
17
85
command : script/ci/prepare.sh
18
86
- save_cache :
19
- key : environment-cache-{{ checksum ".circleci/config.yml" }}-{{ checksum " script/ci/prepare.sh" }}-{{ arch }}
87
+ key : environment-cache-{{ checksum "script/ci/prepare.sh" }}-{{ arch }}
20
88
paths :
21
89
- ~/dependencies
22
90
- restore_cache :
23
- key : dependencies-cache-{{ checksum ".circleci/config.yml" }}-{{ checksum " script/ci/prepare.sh" }}-{{ checksum "mix.lock" }}-{{ arch }}
91
+ key : dependencies-cache-{{ checksum "script/ci/prepare.sh" }}-{{ checksum "mix.lock" }}-{{ arch }}
24
92
- run :
25
93
name : Preparing dependencies
26
94
command : |
27
95
mix local.hex --force
28
96
mix local.rebar --force
29
97
mix deps.get;
30
98
mix deps.compile;
31
- mix dialyzer --plt;
32
- no_output_timeout : 10m
33
99
- save_cache :
34
- key : dependencies-cache-{{ checksum ".circleci/config.yml" }}-{{ checksum " script/ci/prepare.sh" }}-{{ checksum "mix.lock" }}-{{ arch }}
100
+ key : dependencies-cache-{{ checksum "script/ci/prepare.sh" }}-{{ checksum "mix.lock" }}-{{ arch }}
35
101
paths :
36
102
- ~/.mix
37
103
- _build
38
104
- deps
39
105
- run : mix compile
40
- - run : mix dialyzer
41
- - run : mix format --check-formatted --dry-run || (mix format && git --no-pager diff && false)
42
- - run : mix credo --strict
43
106
- run : mix coveralls.html
44
107
- store_test_results :
45
108
path : ~/bootleg/_build/test/lib/bootleg
46
109
- store_artifacts :
47
110
path : cover
111
+ workflows :
112
+ version : 2
113
+ build-and-verify :
114
+ jobs :
115
+ - build
116
+ - functional :
117
+ requires :
118
+ - build
0 commit comments