From d616f34393014af436fe2bf767198c4a4dda1854 Mon Sep 17 00:00:00 2001 From: Izel Nakri Date: Mon, 2 Mar 2020 08:21:41 +0100 Subject: [PATCH] first CI trial --- .circleci/config.yml | 2 +- Dockerfile | 25 ++++++++++++------------ mix.lock | 39 +++++++++++++++++++------------------ rebar.config | 3 +++ test/support/eth_client.exs | 6 +++--- 5 files changed, 39 insertions(+), 36 deletions(-) create mode 100644 rebar.config diff --git a/.circleci/config.yml b/.circleci/config.yml index dddd785..bbe6d6f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,7 +31,7 @@ jobs: 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 + - run: docker exec -it eth mix test test/eth/query_test.exs --seed 0 workflows: version: 2 diff --git a/Dockerfile b/Dockerfile index 11c37aa..727b58d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,34 +5,33 @@ ENV MIX_ENV=$MIX_ENV WORKDIR /code -RUN apt-get update && apt-get -y install curl && curl https://get.volta.sh | bash +RUN apt-get update && apt-get -y install curl make build-essential && curl https://get.volta.sh | bash ENV PATH=$PATH:/root/.volta/bin RUN volta install node@8.9 -ADD ["mix.lock", "mix.exs", "/code/"] +ADD ["package.json", "package-lock.json"] + +RUN npm install + +ADD ["mix.lock", "mix.exs", "rebar.config", "/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 +RUN mix deps.get && MIX_ENV=test mix deps.compile && \ + MIX_ENV=$MIX_ENV mix deps.compile && MIX_ENV=prod mix deps.compile ADD ["config", "lib", "/code/"] -# RUN MIX_ENV=$MIX_ENV mix compile +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 MIX_ENV=test mix compile && MIX_ENV=$MIX_ENV mix compile +ADD . /code/ -# RUN npm install +RUN MIX_ENV=test mix compile && MIX_ENV=$MIX_ENV mix compile CMD ["/bin/bash"] diff --git a/mix.lock b/mix.lock index 6688c00..276665e 100644 --- a/mix.lock +++ b/mix.lock @@ -1,24 +1,25 @@ %{ - "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], []}, - "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], []}, - "earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], []}, - "ethereumex": {:hex, :ethereumex, "0.3.0", "9d5e25dc2f9ed357f9f7f2a49e09b608b41a56283c20f50e896a11af225cc723", [:mix], [{:httpoison, "~> 1.0.0", [hex: :httpoison, optional: false]}, {:poison, "~> 3.1.0", [hex: :poison, optional: false]}]}, - "ex_doc": {:hex, :ex_doc, "0.16.3", "cd2a4cfe5d26e37502d3ec776702c72efa1adfa24ed9ce723bb565f4c30bd31a", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, optional: false]}]}, - "ex_rlp": {:hex, :ex_rlp, "0.2.1", "bd320900d6316cdfe01d365d4bda22eb2f39b359798daeeffd3bd1ca7ba958ec", [:mix], []}, - "hackney": {:hex, :hackney, "1.11.0", "4951ee019df102492dabba66a09e305f61919a8a183a7860236c0fde586134b6", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, optional: false]}, {:idna, "5.1.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, optional: false]}]}, - "hex_prefix": {:hex, :hex_prefix, "0.1.0", "e96b5cbb6ad8493196ce193726240023f5ce0ae0753118a19a5b43e2db0267ca", [:mix], []}, - "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]}]}, + "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, + "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"}, + "earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm"}, + "ethereumex": {:hex, :ethereumex, "0.3.4", "5222472508bf7de46e06590e85da5d7fe49d33a386ecabc71c364c439a99945e", [:mix], [{:httpoison, "~> 1.1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, "~> 3.1.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, + "ex_doc": {:hex, :ex_doc, "0.21.3", "857ec876b35a587c5d9148a2512e952e24c24345552259464b98bfbb883c7b42", [:mix], [{:earmark, "~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, + "ex_rlp": {:hex, :ex_rlp, "0.2.1", "bd320900d6316cdfe01d365d4bda22eb2f39b359798daeeffd3bd1ca7ba958ec", [:mix], [], "hexpm"}, + "hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"}, + "hexate": {:hex, :hexate, "0.6.1", "1cea42e462c1daa32223127d4752e71016c3d933d492b9bb7fa4709a4a0fd50d", [:mix], [], "hexpm"}, + "httpoison": {:hex, :httpoison, "1.1.1", "96ed7ab79f78a31081bb523eefec205fd2900a02cda6dbc2300e7a1226219566", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, + "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"}, "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], []}, - "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []}, + "makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"}, + "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"}, + "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm"}, "mix_erlang_tasks": {:hex, :mix_erlang_tasks, "0.1.0", "36819fec60b80689eb1380938675af215565a89320a9e29c72c70d97512e4649", [:mix], [], "hexpm"}, - "mnemonic": {:hex, :mnemonic, "0.2.1", "dbdb0a835122219068ca69a64e6d1d0eb4be388f92609b2bc4910cf6a236f316", [:mix], []}, - "nif_libsecp256k1": {:hex, :nif_libsecp256k1, "0.0.2", "7548eabb7d04c09c29814f9c8aa8542d7ff2d9b972a8e3c611faef21a24616da", [:rebar3], []}, - "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], []}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], []}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], []}, + "mnemonic": {:hex, :mnemonic, "0.2.1", "dbdb0a835122219068ca69a64e6d1d0eb4be388f92609b2bc4910cf6a236f316", [:mix], [], "hexpm"}, + "nimble_parsec": {:hex, :nimble_parsec, "0.5.3", "def21c10a9ed70ce22754fdeea0810dafd53c2db3219a0cd54cf5526377af1c6", [:mix], [], "hexpm"}, + "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"}, + "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.5", "6eaf7ad16cb568bb01753dbbd7a95ff8b91c7979482b95f38443fe2c8852a79b", [:make, :mix, :rebar3], [], "hexpm"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"}, } diff --git a/rebar.config b/rebar.config new file mode 100644 index 0000000..accbc46 --- /dev/null +++ b/rebar.config @@ -0,0 +1,3 @@ +{deps, [ + {keccakf1600, ".*", {git, "git://github.com/potatosalad/erlang-keccakf1600.git", {branch, "master"}}} +]}. diff --git a/test/support/eth_client.exs b/test/support/eth_client.exs index e2a1aab..6aeca24 100644 --- a/test/support/eth_client.exs +++ b/test/support/eth_client.exs @@ -1,16 +1,16 @@ defmodule ETH.TestClient do def start do spawn(fn -> - "ganache-cli -b=1 -m=\" parent leopard beauty edit tilt what blast next huge need print advice evolve move explain govern grab raccoon gown gravity gloom walnut silver reopen\"" + "node_modules/.bin/ganache-cli -b=1 -m=\" parent leopard beauty edit tilt what blast next huge need print advice evolve move explain govern grab raccoon gown gravity gloom walnut silver reopen\"" |> String.to_charlist() |> :os.cmd() end) - Process.sleep(4000) + Process.sleep(4100) end def stop do - "pkill -f ganache-cli" + "pkill -f node_modules/.bin/ganache-cli" |> String.to_charlist() |> :os.cmd() end