Skip to content

Commit

Permalink
Configure CircleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooklyn Zelenka committed Aug 29, 2016
1 parent 930d2b4 commit 0ad5813
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 5 deletions.
16 changes: 11 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
machine:
environment:
PATH: "$HOME/.asdf/bin:$HOME/.asdf/shims:$PATH"

dependencies:
pre:
- script/ci/prepare.sh
- test/prepare_ci.sh
- "MIX_ENV=test mix deps.compile"
- "MIX_ENV=test mix compile"
cache_directories:
- ~/dependencies
- ~/.mix
- _build
- ~/.asdf
- deps
- _build

test:
override:
- script/ci/tests.sh
- mix test
- mix credo --strict
2 changes: 2 additions & 0 deletions elixir_buildpack.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
erlang_version=18.3
elixir_version=1.3.1
42 changes: 42 additions & 0 deletions test/prepare_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
# ensure exit codes other than 0 fail the build
set -e

# asdf
# -- install if not installed before
# -- add plugins if not added before
function asdfPlugin {
asdf plugin-add $1 https://github.com/HashNuke/asdf-$1.git
}

# Set up Figaro environment variables
# This line can be removed if our PR to FigaroElixir is accepted:
# https://github.com/KamilLelonek/figaro-elixir/pull/1
touch $HOME/$CIRCLE_PROJECT_REPONAME/config/application.yml

if ! asdf | grep version; then git clone https://github.com/HashNuke/asdf.git ~/.asdf; fi
if ! asdf plugin-list | grep erlang; then $(asdfPlugin "erlang"); fi
if ! asdf plugin-list | grep elixir; then $(asdfPlugin "elixir"); fi

# extract vars from elixir_buildpack.config
. elixir_buildpack.config

# write .tool-versions
if [ ! -f .tool-versions ]; then
echo "erlang $erlang_version" >> .tool-versions
echo "elixir $elixir_version" >> .tool-versions
fi

# install erlang/elixir
asdf install erlang $erlang_version
asdf install elixir $elixir_version

# get dependencies
if [ ! -e $HOME/.mix/rebar ]; then
yes | mix local.rebar
fi

yes | mix deps.get

# exit successfully
exit 0

0 comments on commit 0ad5813

Please sign in to comment.