Skip to content

Commit

Permalink
add bin/setup to circle ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrat555 committed Aug 22, 2018
1 parent f6cac22 commit b246b5c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 37 deletions.
13 changes: 2 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@ jobs:
working_directory: ~/app

steps:
- run: sudo apt-get update; sudo apt-get -y install libtool autoconf libgmp3-dev
- checkout
- run: git submodule sync --recursive
- run: git submodule update --recursive --init
- run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin:$PATH' >> $BASH_ENV

- run: mix local.hex --force

- restore_cache:
keys:
- v1-env-cache-{{ arch }}-{{ .Branch }}
Expand All @@ -37,9 +29,8 @@ jobs:
- v1-build-cache-{{ .Branch }}
- v1-build-cache

- run:
command: mix do deps.get, compile
no_output_timeout: 2400
- run: ./bin/setup
no_output_timeout: 2400

- save_cache:
key: v1-env-cache-{{ arch }}-{{ .Branch }}
Expand Down
41 changes: 15 additions & 26 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,24 @@ install_linux_deps() {
esac
}

install_linux_rust() {
install_darwin_deps(){
fancy_echo "Installing dependencies via brew"
brew bundle --file=- <<EOF
brew "automake"
brew "autoconf"
brew "gmp"
brew "libtool"
EOF
}

install_rust() {
curl https://sh.rustup.rs -sSf | sh
if [ $? -ne 0 ]; then
fancy_echo "Rust installation failed"
exit 1
fi
}

install_rust() {
local sys=`uname -s`
case $sys in
Linux*)
install_linux_rust
;;
Darwin*)
brew install rust
;;
*)
fancy_echo "Unknown system"
exit 1
;;
esac
}

install_deps() {
local sys=`uname -s`
echo $sys
Expand All @@ -57,13 +51,7 @@ install_deps() {
install_linux_deps
;;
Darwin*)
fancy_echo "Installing dependencies via brew"
brew bundle --file=- <<EOF
brew "automake"
brew "autoconf"
brew "gmp"
brew "libtool"
EOF
install_darwin_deps
;;
*)
fancy_echo "Unknown system"
Expand All @@ -90,9 +78,9 @@ if ! command -v mix > /dev/null; then
exit 1
fi

ELIXIR_PATCH_VERSION=`elixir -v |grep Elixir | sed -n 's/.*1\.6\.\([0-9]\).*$/\1/p'`
ELIXIR_PATCH_VERSION=`elixir -v |grep Elixir | sed -n 's/.*1\.7\.\([0-9]\).*$/\1/p'`
if [ $ELIXIR_PATCH_VERSION -lt 5 ]; then
fancy_echo "Your elixir version must be ~> 1.6.5"
fancy_echo "Your elixir version must be ~> 1.7.2"
fancy_echo "Your current version:"
elixir -v
exit 1
Expand All @@ -112,6 +100,7 @@ if ! command -v rustc > /dev/null; then
fi

fancy_echo "Installing elixir dependencies and compiling."
mix local.hex --force
mix deps.get
mix do deps.compile, compile

Expand Down

0 comments on commit b246b5c

Please sign in to comment.