Skip to content

Commit a532540

Browse files
Rob Adamsbrienw
Rob Adams
authored andcommitted
CircleCI updates to test against multiple Elixir versions (#303)
1 parent 8c5d34a commit a532540

File tree

3 files changed

+72
-51
lines changed

3 files changed

+72
-51
lines changed

.circleci/config.yml

+66-46
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
1-
version: 2
1+
version: 2.1
2+
3+
default_version: &default_version 1.6.6
4+
default_steps: &default_steps
5+
- run: mix test --exclude functional
6+
- store_test_results:
7+
path: ~/bootleg/_build/test/lib/bootleg
28
general:
39
branches:
410
ignore:
511
- gh-pages
612
defaults: &defaults
713
working_directory: ~/bootleg
14+
cache_files: &cache_files
15+
- _build
16+
- deps
17+
- ~/.mix
818
jobs:
919
build:
1020
<<: *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
21+
parameters:
22+
version:
23+
description: Elixir version
24+
type: string
25+
default: *default_version
26+
execute:
27+
description: What steps to execute after build
28+
type: steps
29+
default: *default_steps
30+
31+
parallelism: 1
32+
docker:
33+
- image: elixir:<< parameters.version >>
1434
environment: # environment variables for primary container
1535
SHELL: /bin/bash
1636
steps:
@@ -21,48 +41,23 @@ jobs:
2141

2242
- restore_cache: # restores saved mix cache
2343
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
44+
- build-v<< parameters.version >>-{{ .Branch }}-{{ checksum "mix.lock" }}
45+
- build-v<< parameters.version >>-{{ .Branch }}
46+
- build-v<< parameters.version >>
3447

35-
- run: mix do deps.get, deps.compile # get updated dependencies & compile them
48+
- run: mix do deps.get, deps.compile, compile
3649

3750
- save_cache: # generate and store cache so `restore_cache` works
38-
key: mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
39-
paths: "deps"
51+
key: build-v<< parameters.version >>-{{ .Branch }}-{{ checksum "mix.lock" }}
52+
paths: *cache_files
4053
- 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
54+
key: build-v<< parameters.version >>-{{ .Branch }}
55+
paths: *cache_files
56+
- save_cache: # and one more for good measure
57+
key: build-v<< parameters.version >>
58+
paths: *cache_files
5959

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
60+
- steps: << parameters.execute >>
6661

6762
functional:
6863
<<: *defaults
@@ -109,10 +104,35 @@ jobs:
109104
- store_artifacts:
110105
path: cover
111106
workflows:
112-
version: 2
113-
build-and-verify:
107+
version: 2.1
108+
all_versions:
109+
jobs:
110+
- build:
111+
name: "Test in Elixir 1.6.6"
112+
version: 1.6.6
113+
- build:
114+
name: "Test in Elixir 1.8.2"
115+
version: 1.8.2
116+
- build:
117+
name: "Test in Elixir 1.9.0"
118+
version: 1.9.0
119+
code_quality:
120+
jobs:
121+
- build:
122+
name: "Code quality and style checks"
123+
execute:
124+
- run: mix do format --check-formatted, credo --strict
125+
- build:
126+
name: "Dialyzer type checks"
127+
execute:
128+
- restore_cache: # restores saved plt cache
129+
keys:
130+
- dialyzer
131+
- run: mix dialyzer --halt-exit-status
132+
- save_cache:
133+
key: dialyzer
134+
paths: "_build/test/dialyxir*.plt"
135+
validate_functional:
114136
jobs:
115-
- build
116137
- functional:
117-
requires:
118-
- build
138+
name: "Functional tests"

mix.exs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ defmodule Bootleg.Mixfile do
4343
{:sshkit, "0.1.0"},
4444
{:ssh_client_key_api, "~> 0.2.1"},
4545
{:credo, "~> 0.10", only: [:dev, :test]},
46-
{:dialyxir, "~> 1.0.0-rc.3", only: [:dev], runtime: false},
46+
{:dialyxir, "~> 1.0.0-rc.6", only: [:dev], runtime: false},
4747
{:ex_doc, "~> 0.18", only: [:docs], runtime: false},
4848
{:excoveralls, "~> 0.10", only: [:test]},
49-
{:mock, "~> 0.3.0", only: [:test]},
49+
{:mock, "~> 0.3.3", only: [:test]},
5050
{:junit_formatter, "~> 2.0", only: [:test]},
5151
{:temp, "~> 0.4.3", only: [:test]}
5252
]

mix.lock

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
33
"certifi": {:hex, :certifi, "2.4.2", "75424ff0f3baaccfd34b1214184b6ef616d89e420b258bb0a5ea7d7bc628f7f0", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"},
44
"credo": {:hex, :credo, "0.10.2", "03ad3a1eff79a16664ed42fc2975b5e5d0ce243d69318060c626c34720a49512", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
5-
"dialyxir": {:hex, :dialyxir, "1.0.0-rc.3", "774306f84973fc3f1e2e8743eeaa5f5d29b117f3916e5de74c075c02f1b8ef55", [:mix], [], "hexpm"},
5+
"dialyxir": {:hex, :dialyxir, "1.0.0-rc.6", "78e97d9c0ff1b5521dd68041193891aebebce52fc3b93463c0a6806874557d7d", [:mix], [{:erlex, "~> 0.2.1", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm"},
66
"earmark": {:hex, :earmark, "1.2.6", "b6da42b3831458d3ecc57314dff3051b080b9b2be88c2e5aa41cd642a5b044ed", [:mix], [], "hexpm"},
7+
"erlex": {:hex, :erlex, "0.2.3", "102b4f90156f59fd323be9864f7613b3f40e55d73a4cc69bcbd5cb259e0ec2bf", [:mix], [], "hexpm"},
78
"ex_doc": {:hex, :ex_doc, "0.18.4", "4406b8891cecf1352f49975c6d554e62e4341ceb41b9338949077b0d4a97b949", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
89
"excoveralls": {:hex, :excoveralls, "0.10.0", "a4508bdd408829f38e7b2519f234b7fd5c83846099cda348efcb5291b081200c", [:mix], [{:hackney, "~> 1.13", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
910
"exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"},
@@ -14,10 +15,10 @@
1415
"junit_formatter": {:hex, :junit_formatter, "2.2.0", "da6093f0740c58a824f9585ebb7cb1b960efaecf48d1fa969e95d9c47c6b19dd", [:mix], [], "hexpm"},
1516
"makeup": {:hex, :makeup, "0.5.5", "9e08dfc45280c5684d771ad58159f718a7b5788596099bdfb0284597d368a882", [:mix], [{:nimble_parsec, "~> 0.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
1617
"makeup_elixir": {:hex, :makeup_elixir, "0.10.0", "0f09c2ddf352887a956d84f8f7e702111122ca32fbbc84c2f0569b8b65cbf7fa", [:mix], [{:makeup, "~> 0.5.5", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},
17-
"meck": {:hex, :meck, "0.8.12", "1f7b1a9f5d12c511848fec26bbefd09a21e1432eadb8982d9a8aceb9891a3cf2", [:rebar3], [], "hexpm"},
18+
"meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm"},
1819
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"},
1920
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm"},
20-
"mock": {:hex, :mock, "0.3.2", "e98e998fd76c191c7e1a9557c8617912c53df3d4a6132f561eb762b699ef59fa", [:mix], [{:meck, "~> 0.8.8", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm"},
21+
"mock": {:hex, :mock, "0.3.3", "42a433794b1291a9cf1525c6d26b38e039e0d3a360732b5e467bfc77ef26c914", [:mix], [{:meck, "~> 0.8.13", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm"},
2122
"nimble_parsec": {:hex, :nimble_parsec, "0.4.0", "ee261bb53214943679422be70f1658fff573c5d0b0a1ecd0f18738944f818efe", [:mix], [], "hexpm"},
2223
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"},
2324
"poison": {:hex, :poison, "4.0.1", "bcb755a16fac91cad79bfe9fc3585bb07b9331e50cfe3420a24bcc2d735709ae", [:mix], [], "hexpm"},

0 commit comments

Comments
 (0)