Skip to content

Instantly share code, notes, and snippets.

@xingxing
Forked from paulgoetze/codeship-elixir.sh
Created December 3, 2016 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xingxing/fe0a3c899e1d9129ec7b463310f4af92 to your computer and use it in GitHub Desktop.
Save xingxing/fe0a3c899e1d9129ec7b463310f4af92 to your computer and use it in GitHub Desktop.
Codeship Elixir/Phoenix test setup
#!/bin/bash
# Erlang
ERLANG_VERSION=${ERLANG_VERSION:-19.0}
ERLANG_CACHED_DOWNLOAD="${HOME}/cache/OTP-${ERLANG_VERSION}.tar.gz"
ERLANG_DIR=${ERLANG_DIR:="$HOME/erlang"}
# Elixir
ELIXIR_VERSION=${ELIXIR_VERSION:-1.3.1}
ELIXIR_CACHED_DOWNLOAD="${HOME}/cache/elixir-v${ELIXIR_VERSION}.zip"
ELIXIR_DIR=${ELIXIR_DIR:="$HOME/elixir"}
# Erlang download
echo Installing Erlang version ${ERLANG_VERSION}
wget --continue --output-document "${ERLANG_CACHED_DOWNLOAD}" "https://s3.amazonaws.com/heroku-buildpack-elixir/erlang/cedar-14/OTP-${ERLANG_VERSION}.tar.gz"
mkdir "${ERLANG_DIR}"
tar -xaf "${ERLANG_CACHED_DOWNLOAD}" --strip-components=1 --directory "${ERLANG_DIR}"
${ERLANG_DIR}/Install -minimal ${ERLANG_DIR}
export PATH="${ERLANG_DIR}/bin:$PATH"
# Elixir download
echo Installing Erlang version ${ELIXIR_VERSION}
wget --continue --output-document "${ELIXIR_CACHED_DOWNLOAD}" "https://s3.amazonaws.com/s3.hex.pm/builds/elixir/v${ELIXIR_VERSION}.zip"
mkdir ${ELIXIR_DIR}
cd ${ELIXIR_DIR}
unzip -q ${ELIXIR_CACHED_DOWNLOAD}
export PATH="${ELIXIR_DIR}/bin:$PATH"
cd -
# copy the sample file to the actual test config
cp config/sample.test.exs config/test.exs
export MIX_ENV=test
mix local.hex --force
mix local.rebar
mix hex.info
mix deps.get
mix deps.compile
mix ecto.create
# in test settings:
# $ mix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment