Skip to content

Commit 4f41648

Browse files
authored
Merge pull request #1377 from code-corps/switch-to-circle-2.0
Switch to circle 2.0 Update elixir to 1.6.1, erlang to 20.2
2 parents c7097fd + 96cf968 commit 4f41648

7 files changed

+144
-100
lines changed

.circleci/config.yml

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
defaults: &defaults
2+
working_directory: ~/code-corps-api
3+
docker:
4+
- image: circleci/elixir:1.6-node-browsers
5+
- image: circleci/postgres:9.4
6+
environment:
7+
POSTGRES_USER: ubuntu
8+
- image: circleci/ruby:2.3
9+
10+
jobs:
11+
build:
12+
<<: *defaults
13+
steps:
14+
- checkout
15+
- restore_cache:
16+
keys:
17+
- v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
18+
- v1-mix-cache-{{ .Branch }}
19+
- v1-mix-cache
20+
- restore_cache:
21+
keys:
22+
- v1-build-cache-{{ .Branch }}
23+
- v1-build-cache
24+
- run:
25+
name: Install PostgreSQL Client (for pg_dump, happening as part of ecto.migrate)
26+
command: sudo apt install postgresql-client
27+
- run: mix local.hex --force
28+
- run: mix local.rebar
29+
- run: mix deps.get
30+
- run:
31+
name: Run test suite and maybe report coverage
32+
command: |
33+
if [ ${CIRCLE_PR_USERNAME} ]; then
34+
MIX_ENV=test mix test;
35+
else
36+
MIX_ENV=test mix coveralls.circle --include acceptance:true;
37+
fi
38+
- save_cache:
39+
key: v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
40+
paths: "deps"
41+
- save_cache:
42+
key: v1-mix-cache-{{ .Branch }}
43+
paths: "deps"
44+
- save_cache:
45+
key: v1-mix-cache
46+
paths: "deps"
47+
- save_cache:
48+
key: v1-build-cache-{{ .Branch }}
49+
paths: "_build"
50+
- save_cache:
51+
key: v1-build-cache
52+
paths: "_build"
53+
deploy-staging:
54+
<<: *defaults
55+
steps:
56+
- checkout
57+
- run:
58+
name: Run Heroku setup script
59+
command: bash .circleci/setup-heroku.sh
60+
- add_ssh_keys:
61+
fingerprints:
62+
- "48:a0:87:54:ca:75:32:12:c6:9e:a2:77:a4:7a:08:a4"
63+
- run:
64+
name: Push to Remote Development
65+
command: |
66+
git push --force [email protected]:code-corps-remote-development.git HEAD:refs/heads/master
67+
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-remote-development
68+
heroku restart --app code-corps-remote-development
69+
- run:
70+
name: Push to Staging
71+
command: |
72+
git push --force [email protected]:code-corps-staging.git HEAD:refs/heads/master
73+
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-staging
74+
heroku restart --app code-corps-staging
75+
- run:
76+
name: Update API Docs
77+
command: |
78+
gem install apiaryio
79+
apiary publish --api-name="codecorpsapidevelop" --path ./blueprint/api.apib
80+
./bin/deploy_docs.sh
81+
deploy-production:
82+
<<: *defaults
83+
steps:
84+
- checkout
85+
- run:
86+
name: Run Heroku setup script
87+
command: bash .circleci/setup-heroku.sh
88+
- add_ssh_keys:
89+
fingerprints:
90+
- "48:a0:87:54:ca:75:32:12:c6:9e:a2:77:a4:7a:08:a4"
91+
- run:
92+
name: Deploy Master to Heroku Production
93+
command: |
94+
git push --force [email protected]:code-corps.git HEAD:refs/heads/master
95+
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps
96+
heroku restart --app code-corps
97+
- run:
98+
name: Update API Docs
99+
command: |
100+
gem install apiaryio
101+
apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
102+
103+
workflows:
104+
version: 2
105+
build-deploy:
106+
jobs:
107+
- build
108+
- deploy-staging:
109+
requires:
110+
- build
111+
filters:
112+
branches:
113+
only: develop
114+
- deploy-production:
115+
requires:
116+
- build
117+
filters:
118+
branches:
119+
only: master

.circleci/setup-heroku.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
wget https://cli-assets.heroku.com/branches/stable/heroku-linux-amd64.tar.gz
3+
sudo mkdir -p /usr/local/lib /usr/local/bin
4+
sudo tar -xvzf heroku-linux-amd64.tar.gz -C /usr/local/lib
5+
sudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
6+
7+
cat > ~/.netrc << EOF
8+
machine api.heroku.com
9+
login $HEROKU_LOGIN
10+
password $HEROKU_API_KEY
11+
EOF
12+
13+
cat >> ~/.ssh/config << EOF
14+
VerifyHostKeyDNS yes
15+
StrictHostKeyChecking no
16+
EOF

bin/circle_pre_build.sh

-51
This file was deleted.

circle.yml

-42
This file was deleted.

elixir_buildpack.config

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
erlang_version=20.1
2-
elixir_version=1.5.2
1+
erlang_version=20.2
2+
elixir_version=1.6.1

mix.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defmodule CodeCorps.Mixfile do
1010
def project do
1111
[app: :code_corps,
1212
version: "0.0.1",
13-
elixir: "~> 1.5.2",
13+
elixir: "~> 1.6",
1414
elixirc_paths: elixirc_paths(Mix.env),
1515
compilers: [:phoenix, :gettext] ++ Mix.compilers,
1616
dialyzer: [ignore_warnings: "dialyzer.ignore-warnings", plt_add_apps: [:kernel, :stdlib], plt_add_deps: :transitive],

mix.lock

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
%{"approximate_histogram": {:hex, :approximate_histogram, "0.1.1", "198eb36681e763ed4baab6ca0682acec4ef642f60ba272f251d3059052f4f378", [:mix], []},
1+
%{
2+
"approximate_histogram": {:hex, :approximate_histogram, "0.1.1", "198eb36681e763ed4baab6ca0682acec4ef642f60ba272f251d3059052f4f378", [:mix], []},
23
"bamboo": {:hex, :bamboo, "0.8.0", "573889a3efcb906bb9d25a1c4caa4ca22f479235e1b8cc3260d8b88dabeb4b14", [:mix], [{:hackney, "~> 1.6", [hex: :hackney, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: false]}, {:poison, ">= 1.5.0", [hex: :poison, optional: false]}]},
34
"bamboo_postmark": {:hex, :bamboo_postmark, "0.4.1", "2ec8fad4d221944f5169ea4346e6e1aef3578282c352c9f7184306d872aa1c26", [:mix], [{:bamboo, "~> 0.5", [hex: :bamboo, optional: false]}, {:hackney, "~> 1.6", [hex: :hackney, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: false]}, {:poison, ">= 1.5.0", [hex: :poison, optional: false]}]},
45
"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [], []},
@@ -14,7 +15,7 @@
1415
"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, optional: false]}]},
1516
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [], []},
1617
"credo": {:hex, :credo, "0.8.10", "261862bb7363247762e1063713bb85df2bbd84af8d8610d1272cd9c1943bba63", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, optional: false]}]},
17-
"db_connection": {:hex, :db_connection, "1.1.2", "2865c2a4bae0714e2213a0ce60a1b12d76a6efba0c51fbda59c9ab8d1accc7a8", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, optional: true]}]},
18+
"db_connection": {:hex, :db_connection, "1.1.3", "89b30ca1ef0a3b469b1c779579590688561d586694a3ce8792985d4d7e575a61", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
1819
"decimal": {:hex, :decimal, "1.4.1", "ad9e501edf7322f122f7fc151cce7c2a0c9ada96f2b0155b8a09a795c2029770", [:mix], []},
1920
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], []},
2021
"earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], []},
@@ -53,7 +54,7 @@
5354
"plug": {:hex, :plug, "1.4.3", "236d77ce7bf3e3a2668dc0d32a9b6f1f9b1f05361019946aae49874904be4aed", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, optional: true]}, {:mime, "~> 1.0", [hex: :mime, optional: false]}]},
5455
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], []},
5556
"poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [], []},
56-
"postgrex": {:hex, :postgrex, "0.13.3", "c277cfb2a9c5034d445a722494c13359e361d344ef6f25d604c2353185682bfc", [:mix], [{:connection, "~> 1.0", [hex: :connection, optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, optional: false]}]},
57+
"postgrex": {:hex, :postgrex, "0.13.5", "3d931aba29363e1443da167a4b12f06dcd171103c424de15e5f3fc2ba3e6d9c5", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm"},
5758
"ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], []},
5859
"scout_apm": {:hex, :scout_apm, "0.3.3", "8679378b624b502d7f6e8a1b023b57f4c7ab717380291e2b40ccdb2923457194", [:mix], [{:approximate_histogram, "~>0.1.1", [hex: :approximate_histogram, optional: false]}, {:hackney, "~> 1.0", [hex: :hackney, optional: false]}, {:plug, "~>1.0", [hex: :plug, optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, optional: false]}]},
5960
"scrivener": {:hex, :scrivener, "2.4.0", "c9431804b13ac6a5c4b01eb32188c1ff926898a2d684244d021706841f022e66", [:mix], []},
@@ -69,4 +70,5 @@
6970
"tzdata": {:hex, :tzdata, "0.5.14", "56f05ea3dd87db946966ab3c7168c0b35025c7ee0e9b4fc130a04631f5611eb1", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, optional: false]}]},
7071
"unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], []},
7172
"uri_query": {:hex, :uri_query, "0.1.2", "ae35b83b472f3568c2c159eee3f3ccf585375d8a94fb5382db1ea3589e75c3b4", [:mix], []},
72-
"uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], []}}
73+
"uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], []},
74+
}

0 commit comments

Comments
 (0)