Skip to content

Commit

Permalink
elixir and node versions locked for CI finally!
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Mar 2, 2020
1 parent 914928d commit 10d8cf4
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 28 deletions.
63 changes: 37 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,45 @@
# Elixir CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-elixir/ for more details
version: 2
jobs:
build:
docker:
# specify the version here
- image: elixir:1.6

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: ~/repo
- image: docker:stable-git
working_directory: /code
steps:
- checkout
- setup_remote_docker
- run:
name: Install node@7.10.1
name: Build application Docker image
command: |
docker build -t eth .
- deploy:
name: Push application Docker image
command: |
set +e
touch $BASH_ENV
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
echo 'nvm install v7.10.1' >> $BASH_ENV
echo 'nvm alias default 7.10.1' >> $BASH_ENV
- run: node -v
- run: npm install -g ganache-cli
- run: mix local.hex --force
- run: mix local.rebar --force
- run: mix deps.get
- run: mix test --seed 0
DOCKER_TAG=$(echo eth:${CIRCLE_BRANCH} | tr '/' '_')
DOCKER_TARGET_REMOTE="${HUB_USERNAME}/${DOCKER_TAG}"
echo $HUB_KEY | docker login -u $HUB_USERNAME --password-stdin
docker tag eth "${DOCKER_TARGET_REMOTE}"
docker push "${DOCKER_TARGET_REMOTE}"
test:
docker:
- image: docker:stable-git
working_directory: ~/code
steps:
- setup_remote_docker
- run:
name: Pull and run a docker container
command: |
DOCKER_TAG=$(echo eth:${CIRCLE_BRANCH} | tr '/' '_')
docker pull ${HUB_USERNAME}/${DOCKER_TAG}
docker run -t -d --name="eth" ${HUB_USERNAME}/${DOCKER_TAG} /bin/sh
- run: docker exec -it eth mix test

workflows:
version: 2
build_and_test:
jobs:
- build
- test:
requires:
- build

# https://circleci.com/blog/how-to-build-a-docker-image-on-circleci-2-0/
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM "elixir:1.10.1-slim"

ARG MIX_ENV=dev
ENV MIX_ENV=$MIX_ENV

WORKDIR /code

RUN apt-get update && apt-get -y install curl && curl https://get.volta.sh | bash

ENV PATH=$PATH:/root/.volta/bin

RUN volta install node@8.9

ADD ["mix.lock", "mix.exs", "/code/"]

RUN echo "y" | mix local.hex --if-missing && echo "y" | mix local.rebar --if-missing

RUN mix local.hex --force && mix local.rebar --force && \
mix deps.get
# && MIX_ENV=test mix deps.compile && \
# MIX_ENV=$MIX_ENV mix deps.compile

ADD ["config", "lib", "/code/"]

# RUN MIX_ENV=$MIX_ENV mix compile

ADD ["test", "/code/"]

# RUN MIX_ENV=test mix compile && MIX_ENV=$MIX_ENV mix compile

# ADD . /code/

# RUN MIX_ENV=test mix compile && MIX_ENV=$MIX_ENV mix compile


# RUN npm install

CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule Eth.Mixfile do
{:keccakf1600, "~> 2.0", hex: :keccakf1600_orig},
{:mnemonic, "~> 0.2.1"},
{:poison, "~> 3.1"},
{:libsecp256k1, "~> 0.1.3"}
{:libsecp256k1, "~> 0.1.10"}
]
end

Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"hexate": {:hex, :hexate, "0.6.1", "1cea42e462c1daa32223127d4752e71016c3d933d492b9bb7fa4709a4a0fd50d", [:mix], []},
"httpoison": {:hex, :httpoison, "1.0.0", "1f02f827148d945d40b24f0b0a89afe40bfe037171a6cf70f2486976d86921cd", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, optional: false]}]},
"idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, optional: false]}]},
"keccakf1600": {:hex, :keccakf1600_orig, "2.0.0", "0a7217ddb3ee8220d449bbf7575ec39d4e967099f220a91e3dfca4dbaef91963", [:rebar3], []},
"keccakf1600": {:hex, :keccakf1600_orig, "2.0.0", "0a7217ddb3ee8220d449bbf7575ec39d4e967099f220a91e3dfca4dbaef91963", [:rebar3], [], "hexpm"},
"libsecp256k1": {:hex, :libsecp256k1, "0.1.10", "d27495e2b9851c7765129b76c53b60f5e275bd6ff68292c50536bf6b8d091a4d", [:make, :mix], [{:mix_erlang_tasks, "0.1.0", [hex: :mix_erlang_tasks, repo: "hexpm", optional: false]}], "hexpm"},
"libsecp256k1_nif": {:hex, :libsecp256k1_nif, "0.0.3", "3d30ec8fb6a7032c4a3b75cb36ed509f397d33c5e44c53c20b800c1b07f5ab2d", [:rebar3], []},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []},
Expand Down

0 comments on commit 10d8cf4

Please # to comment.