Skip to content

Commit

Permalink
Merge pull request #1377 from code-corps/switch-to-circle-2.0
Browse files Browse the repository at this point in the history
Switch to circle 2.0
Update elixir to 1.6.1, erlang to 20.2
  • Loading branch information
begedin authored Feb 12, 2018
2 parents c7097fd + 96cf968 commit 4f41648
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 100 deletions.
119 changes: 119 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
defaults: &defaults
working_directory: ~/code-corps-api
docker:
- image: circleci/elixir:1.6-node-browsers
- image: circleci/postgres:9.4
environment:
POSTGRES_USER: ubuntu
- image: circleci/ruby:2.3

jobs:
build:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
- v1-mix-cache-{{ .Branch }}
- v1-mix-cache
- restore_cache:
keys:
- v1-build-cache-{{ .Branch }}
- v1-build-cache
- run:
name: Install PostgreSQL Client (for pg_dump, happening as part of ecto.migrate)
command: sudo apt install postgresql-client
- run: mix local.hex --force
- run: mix local.rebar
- run: mix deps.get
- run:
name: Run test suite and maybe report coverage
command: |
if [ ${CIRCLE_PR_USERNAME} ]; then
MIX_ENV=test mix test;
else
MIX_ENV=test mix coveralls.circle --include acceptance:true;
fi
- save_cache:
key: v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
paths: "deps"
- save_cache:
key: v1-mix-cache-{{ .Branch }}
paths: "deps"
- save_cache:
key: v1-mix-cache
paths: "deps"
- save_cache:
key: v1-build-cache-{{ .Branch }}
paths: "_build"
- save_cache:
key: v1-build-cache
paths: "_build"
deploy-staging:
<<: *defaults
steps:
- checkout
- run:
name: Run Heroku setup script
command: bash .circleci/setup-heroku.sh
- add_ssh_keys:
fingerprints:
- "48:a0:87:54:ca:75:32:12:c6:9e:a2:77:a4:7a:08:a4"
- run:
name: Push to Remote Development
command: |
git push --force [email protected]:code-corps-remote-development.git HEAD:refs/heads/master
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-remote-development
heroku restart --app code-corps-remote-development
- run:
name: Push to Staging
command: |
git push --force [email protected]:code-corps-staging.git HEAD:refs/heads/master
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps-staging
heroku restart --app code-corps-staging
- run:
name: Update API Docs
command: |
gem install apiaryio
apiary publish --api-name="codecorpsapidevelop" --path ./blueprint/api.apib
./bin/deploy_docs.sh
deploy-production:
<<: *defaults
steps:
- checkout
- run:
name: Run Heroku setup script
command: bash .circleci/setup-heroku.sh
- add_ssh_keys:
fingerprints:
- "48:a0:87:54:ca:75:32:12:c6:9e:a2:77:a4:7a:08:a4"
- run:
name: Deploy Master to Heroku Production
command: |
git push --force [email protected]:code-corps.git HEAD:refs/heads/master
heroku run "POOL_SIZE=2 mix ecto.migrate" --app code-corps
heroku restart --app code-corps
- run:
name: Update API Docs
command: |
gem install apiaryio
apiary publish --api-name="codecorpsapi" --path ./blueprint/api.apib
workflows:
version: 2
build-deploy:
jobs:
- build
- deploy-staging:
requires:
- build
filters:
branches:
only: develop
- deploy-production:
requires:
- build
filters:
branches:
only: master
16 changes: 16 additions & 0 deletions .circleci/setup-heroku.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
wget https://cli-assets.heroku.com/branches/stable/heroku-linux-amd64.tar.gz
sudo mkdir -p /usr/local/lib /usr/local/bin
sudo tar -xvzf heroku-linux-amd64.tar.gz -C /usr/local/lib
sudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku

cat > ~/.netrc << EOF
machine api.heroku.com
login $HEROKU_LOGIN
password $HEROKU_API_KEY
EOF

cat >> ~/.ssh/config << EOF
VerifyHostKeyDNS yes
StrictHostKeyChecking no
EOF
51 changes: 0 additions & 51 deletions bin/circle_pre_build.sh

This file was deleted.

42 changes: 0 additions & 42 deletions circle.yml

This file was deleted.

4 changes: 2 additions & 2 deletions elixir_buildpack.config
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang_version=20.1
elixir_version=1.5.2
erlang_version=20.2
elixir_version=1.6.1
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule CodeCorps.Mixfile do
def project do
[app: :code_corps,
version: "0.0.1",
elixir: "~> 1.5.2",
elixir: "~> 1.6",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
dialyzer: [ignore_warnings: "dialyzer.ignore-warnings", plt_add_apps: [:kernel, :stdlib], plt_add_deps: :transitive],
Expand Down
10 changes: 6 additions & 4 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%{"approximate_histogram": {:hex, :approximate_histogram, "0.1.1", "198eb36681e763ed4baab6ca0682acec4ef642f60ba272f251d3059052f4f378", [:mix], []},
%{
"approximate_histogram": {:hex, :approximate_histogram, "0.1.1", "198eb36681e763ed4baab6ca0682acec4ef642f60ba272f251d3059052f4f378", [:mix], []},
"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]}]},
"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]}]},
"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [], []},
Expand All @@ -14,7 +15,7 @@
"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, optional: false]}]},
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [], []},
"credo": {:hex, :credo, "0.8.10", "261862bb7363247762e1063713bb85df2bbd84af8d8610d1272cd9c1943bba63", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, optional: false]}]},
"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]}]},
"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"},
"decimal": {:hex, :decimal, "1.4.1", "ad9e501edf7322f122f7fc151cce7c2a0c9ada96f2b0155b8a09a795c2029770", [:mix], []},
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], []},
"earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], []},
Expand Down Expand Up @@ -53,7 +54,7 @@
"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]}]},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], []},
"poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [], []},
"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]}]},
"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"},
"ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], []},
"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]}]},
"scrivener": {:hex, :scrivener, "2.4.0", "c9431804b13ac6a5c4b01eb32188c1ff926898a2d684244d021706841f022e66", [:mix], []},
Expand All @@ -69,4 +70,5 @@
"tzdata": {:hex, :tzdata, "0.5.14", "56f05ea3dd87db946966ab3c7168c0b35025c7ee0e9b4fc130a04631f5611eb1", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, optional: false]}]},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], []},
"uri_query": {:hex, :uri_query, "0.1.2", "ae35b83b472f3568c2c159eee3f3ccf585375d8a94fb5382db1ea3589e75c3b4", [:mix], []},
"uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], []}}
"uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], []},
}

0 comments on commit 4f41648

Please sign in to comment.