Skip to content

Commit 9132979

Browse files
committed
Circle CI
1 parent 61ec395 commit 9132979

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

circle.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dependencies:
2+
pre:
3+
- script/ci/prepare.sh
4+
cache_directories:
5+
- ~/dependencies
6+
- ~/.mix
7+
- _build
8+
- deps
9+
10+
test:
11+
override:
12+
- script/ci/tests.sh

script/ci/prepare.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
export ERLANG_VERSION="18.0"
6+
export ELIXIR_VERSION="v1.3.0"
7+
8+
# If you have a elixir_buildpack.config, do this instead:
9+
#export ERLANG_VERSION=$(cat elixir_buildpack.config | grep erlang_version | tr "=" " " | awk '{ print $2 }')
10+
#export ELIXIR_VERSION=v$(cat elixir_buildpack.config | grep elixir_version | tr "=" " " | awk '{ print $2 }')
11+
12+
export INSTALL_PATH="$HOME/dependencies"
13+
14+
export ERLANG_PATH="$INSTALL_PATH/otp_src_$ERLANG_VERSION"
15+
export ELIXIR_PATH="$INSTALL_PATH/elixir_$ELIXIR_VERSION"
16+
17+
mkdir -p $INSTALL_PATH
18+
cd $INSTALL_PATH
19+
20+
# Install erlang
21+
if [ ! -e $ERLANG_PATH/bin/erl ]; then
22+
curl -OL http://www.erlang.org/download/otp_src_$ERLANG_VERSION.tar.gz
23+
tar xzf otp_src_$ERLANG_VERSION.tar.gz
24+
cd $ERLANG_PATH
25+
./configure --enable-smp-support \
26+
--enable-m64-build \
27+
--disable-native-libs \
28+
--disable-sctp \
29+
--enable-threads \
30+
--enable-kernel-poll \
31+
--disable-hipe \
32+
--without-javac
33+
make
34+
35+
# Symlink to make it easier to setup PATH to run tests
36+
ln -sf $ERLANG_PATH $INSTALL_PATH/erlang
37+
fi
38+
39+
# Install elixir
40+
export PATH="$ERLANG_PATH/bin:$PATH"
41+
42+
if [ ! -e $ELIXIR_PATH/bin/elixir ]; then
43+
git clone https://github.com/elixir-lang/elixir $ELIXIR_PATH
44+
cd $ELIXIR_PATH
45+
git checkout $ELIXIR_VERSION
46+
make
47+
48+
# Symlink to make it easier to setup PATH to run tests
49+
ln -sf $ELIXIR_PATH $INSTALL_PATH/elixir
50+
fi
51+
52+
export PATH="$ERLANG_PATH/bin:$ELIXIR_PATH/bin:$PATH"
53+
54+
# Install package tools
55+
if [ ! -e $HOME/.mix/rebar ]; then
56+
yes Y | LC_ALL=en_GB.UTF-8 mix local.hex
57+
yes Y | LC_ALL=en_GB.UTF-8 mix local.rebar
58+
fi
59+
60+
# Fetch and compile dependencies and application code (and include testing tools)
61+
export MIX_ENV="test"
62+
cd $HOME/$CIRCLE_PROJECT_REPONAME
63+
mix do deps.get, deps.compile, compile

script/ci/tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
export MIX_ENV="test"
4+
export PATH="$HOME/dependencies/erlang/bin:$HOME/dependencies/elixir/bin:$PATH"
5+
6+
mix test

0 commit comments

Comments
 (0)