-
-
Save tieubao/5d04f5c8d182396adc1fb0897c39f2c0 to your computer and use it in GitHub Desktop.
Codeship Elixir/Phoenix test setup
This file contains hidden or 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 | |
# 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 | |
mix local.hex --force | |
mix local.rebar | |
mix hex.info | |
export MIX_ENV=test | |
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