Last active
January 11, 2016 17:38
-
-
Save faizaanshamsi/e67905582c3eff1fb22e to your computer and use it in GitHub Desktop.
Circle CI for Elixir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Taken and modified from: https://gist.github.com/joakimk/48ed80f1a7adb5f5ea27 | |
* line 4 and 13 of circle.yml reference a script/ci structure. Modify to suit. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies: | |
pre: | |
- bash ./script/ci/prepare.sh | |
cache_directories: | |
- ~/dependencies | |
- ~/.mix | |
- _build | |
- deps | |
test: | |
override: | |
- bash ./script/ci/tests.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
export ERLANG_VERSION="18.1" | |
export ELIXIR_VERSION="v1.1.0" | |
# If you have a elixir_buildpack.config, do this instead: | |
#export ERLANG_VERSION=$(cat elixir_buildpack.config | grep erlang_version | tr "=" " " | awk '{ print $2 }') | |
#export ELIXIR_VERSION=v$(cat elixir_buildpack.config | grep elixir_version | tr "=" " " | awk '{ print $2 }') | |
export INSTALL_PATH="$HOME/dependencies" | |
export ERLANG_PATH="$INSTALL_PATH/otp_src_$ERLANG_VERSION" | |
export ELIXIR_PATH="$INSTALL_PATH/elixir_$ELIXIR_VERSION" | |
mkdir -p $INSTALL_PATH | |
cd $INSTALL_PATH | |
# Install erlang | |
if [ ! -e $ERLANG_PATH/bin/erl ]; then | |
curl -O http://www.erlang.org/download/otp_src_$ERLANG_VERSION.tar.gz | |
tar xzf otp_src_$ERLANG_VERSION.tar.gz | |
cd $ERLANG_PATH | |
./configure --enable-smp-support \ | |
--enable-m64-build \ | |
--disable-native-libs \ | |
--disable-sctp \ | |
--enable-threads \ | |
--enable-kernel-poll \ | |
--disable-hipe \ | |
--without-javac | |
make | |
# Symlink to make it easier to setup PATH to run tests | |
ln -sf $ERLANG_PATH $INSTALL_PATH/erlang | |
fi | |
# Install elixir | |
export PATH="$ERLANG_PATH/bin:$PATH" | |
if [ ! -e $ELIXIR_PATH/bin/elixir ]; then | |
git clone https://github.com/elixir-lang/elixir $ELIXIR_PATH | |
cd $ELIXIR_PATH | |
git checkout $ELIXIR_VERSION | |
make | |
# Symlink to make it easier to setup PATH to run tests | |
ln -sf $ELIXIR_PATH $INSTALL_PATH/elixir | |
fi | |
export PATH="$ERLANG_PATH/bin:$ELIXIR_PATH/bin:$PATH" | |
# Install package tools | |
if [ ! -e $HOME/.mix/rebar ]; then | |
yes Y | LC_ALL=en_GB.UTF-8 mix local.hex | |
yes Y | LC_ALL=en_GB.UTF-8 mix local.rebar | |
fi | |
# Fetch and compile dependencies and application code (and include testing tools) | |
export MIX_ENV="test" | |
cd $HOME/$CIRCLE_PROJECT_REPONAME | |
mix do deps.get, deps.compile, compile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export MIX_ENV="test" | |
export PATH="$HOME/dependencies/erlang/bin:$HOME/dependencies/elixir/bin:$PATH" | |
mix test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment