diff --git a/.circleci/config.yml b/.circleci/config.yml index 4c7a08cd73..46858a84a2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,10 +14,9 @@ jobs: working_directory: ~/app steps: - - run: wget -O /tmp/phantomjs.tar.gz https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.5.0-beta-linux-ubuntu-xenial-x86_64.tar.gz - - run: tar -zxvf /tmp/phantomjs.tar.gz -C /tmp - - run: sudo mv /tmp/phantomjs-2.5.0-beta-ubuntu-xenial/bin/phantomjs /usr/local/bin/phantomjs - - run: sudo chmod a+x /usr/local/bin/phantomjs + - run: + command: ./.circleci/install_chrome_headless.sh + no_output_timeout: 2400 - run: sudo apt-get update; sudo apt-get -y install autoconf build-essential libgmp3-dev libtool @@ -35,30 +34,30 @@ jobs: - restore_cache: keys: - - v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} - - v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} - - v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} + - v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} + - v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} + - v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} - run: mix deps.get - restore_cache: keys: - - v8-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }} - - v8-npm-install-{{ .Branch }} - - v8-npm-install + - v7-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }} + - v7-npm-install-{{ .Branch }} + - v7-npm-install - run: command: npm install working_directory: "apps/explorer" - save_cache: - key: v4-npm-install-{{ .Branch }}-{{ checksum "apps/explorer/package-lock.json" }} + key: v3-npm-install-{{ .Branch }}-{{ checksum "apps/explorer/package-lock.json" }} paths: "apps/explorer/node_modules" - save_cache: - key: v4-npm-install-{{ .Branch }} + key: v3-npm-install-{{ .Branch }} paths: "apps/explorer/node_modules" - save_cache: - key: v4-npm-install + key: v3-npm-install paths: "apps/explorer/node_modules" - run: @@ -66,13 +65,13 @@ jobs: working_directory: "apps/block_scout_web/assets" - save_cache: - key: v8-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }} + key: v7-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }} paths: "apps/block_scout_web/assets/node_modules" - save_cache: - key: v8-npm-install-{{ .Branch }} + key: v7-npm-install-{{ .Branch }} paths: "apps/block_scout_web/assets/node_modules" - save_cache: - key: v8-npm-install + key: v7-npm-install paths: "apps/block_scout_web/assets/node_modules" - run: mix compile @@ -85,17 +84,17 @@ jobs: # `deps` needs to be cached with `_build` because `_build` will symlink into `deps` - save_cache: - key: v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} + key: v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} paths: - deps - _build - save_cache: - key: v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} + key: v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} paths: - deps - _build - save_cache: - key: v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} + key: v7-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} paths: - deps - _build @@ -193,9 +192,9 @@ jobs: - restore_cache: keys: - - v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} - - v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} - - v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} + - v7-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} + - v7-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} + - v7-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} - run: name: Unpack PLT cache @@ -215,15 +214,15 @@ jobs: cp ~/.mix/dialyxir*.plt plts/ - save_cache: - key: v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} + key: v7-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }} paths: - plts - save_cache: - key: v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} + key: v7-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }} paths: - plts - save_cache: - key: v8-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} + key: v7-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }} paths: - plts @@ -361,10 +360,10 @@ jobs: steps: - attach_workspace: at: . - - run: wget -O /tmp/phantomjs.tar.gz https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.5.0-beta-linux-ubuntu-xenial-x86_64.tar.gz - - run: tar -zxvf /tmp/phantomjs.tar.gz -C /tmp - - run: sudo mv /tmp/phantomjs-2.5.0-beta-ubuntu-xenial/bin/phantomjs /usr/local/bin/phantomjs - - run: sudo chmod a+x /usr/local/bin/phantomjs + + - run: + command: ./.circleci/install_chrome_headless.sh + no_output_timeout: 2400 - run: mix local.hex --force - run: mix local.rebar --force @@ -416,10 +415,9 @@ jobs: - attach_workspace: at: . - - run: wget -O /tmp/phantomjs.tar.gz https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.5.0-beta-linux-ubuntu-xenial-x86_64.tar.gz - - run: tar -zxvf /tmp/phantomjs.tar.gz -C /tmp - - run: sudo mv /tmp/phantomjs-2.5.0-beta-ubuntu-xenial/bin/phantomjs /usr/local/bin/phantomjs - - run: sudo chmod a+x /usr/local/bin/phantomjs + - run: + command: ./.circleci/install_chrome_headless.sh + no_output_timeout: 2400 - run: mix local.hex --force - run: mix local.rebar --force @@ -471,10 +469,9 @@ jobs: - attach_workspace: at: . - - run: wget -O /tmp/phantomjs.tar.gz https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.5.0-beta-linux-ubuntu-xenial-x86_64.tar.gz - - run: tar -zxvf /tmp/phantomjs.tar.gz -C /tmp - - run: sudo mv /tmp/phantomjs-2.5.0-beta-ubuntu-xenial/bin/phantomjs /usr/local/bin/phantomjs - - run: sudo chmod a+x /usr/local/bin/phantomjs + - run: + command: ./.circleci/install_chrome_headless.sh + no_output_timeout: 2400 - run: mix local.hex --force - run: mix local.rebar --force @@ -526,10 +523,9 @@ jobs: - attach_workspace: at: . - - run: wget -O /tmp/phantomjs.tar.gz https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.5.0-beta-linux-ubuntu-xenial-x86_64.tar.gz - - run: tar -zxvf /tmp/phantomjs.tar.gz -C /tmp - - run: sudo mv /tmp/phantomjs-2.5.0-beta-ubuntu-xenial/bin/phantomjs /usr/local/bin/phantomjs - - run: sudo chmod a+x /usr/local/bin/phantomjs + - run: + command: ./.circleci/install_chrome_headless.sh + no_output_timeout: 2400 - run: mix local.hex --force - run: mix local.rebar --force diff --git a/.circleci/install_chrome_headless.sh b/.circleci/install_chrome_headless.sh new file mode 100755 index 0000000000..42a73c877a --- /dev/null +++ b/.circleci/install_chrome_headless.sh @@ -0,0 +1,11 @@ +export DISPLAY=:99.0 +sh -e /etc/init.d/xvfb start +export CHROMEDRIVER_VERSION=`curl -s http://chromedriver.storage.googleapis.com/LATEST_RELEASE` +curl -L -O "http://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" +unzip chromedriver_linux64.zip +sudo chmod +x chromedriver +sudo mv chromedriver /usr/local/bin +sudo add-apt-repository ppa:ubuntu-toolchain-r/test --yes +sudo apt-get update +sudo apt-get --only-upgrade install google-chrome-stable +sudo apt-get install libstdc++6-4.7-dev diff --git a/apps/block_scout_web/config/test.exs b/apps/block_scout_web/config/test.exs index 1c695a15bc..6fcd9c18a9 100644 --- a/apps/block_scout_web/config/test.exs +++ b/apps/block_scout_web/config/test.exs @@ -16,7 +16,7 @@ config :logger, :block_scout_web, path: Path.absname("logs/test/block_scout_web.log") # Configure wallaby -config :wallaby, screenshot_on_failure: true +config :wallaby, screenshot_on_failure: true, driver: Wallaby.Experimental.Chrome config :explorer, Explorer.ExchangeRates, enabled: false, store: :none diff --git a/apps/block_scout_web/test/block_scout_web/controllers/chain_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/chain_controller_test.exs index d76bba629c..7cd68c60a4 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/chain_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/chain_controller_test.exs @@ -72,7 +72,7 @@ defmodule BlockScoutWeb.ChainControllerTest do conn = get(conn(), "/token_autocomplete?q=magic") - Enum.count(json_response(conn, 200)) == 1 + assert Enum.count(json_response(conn, 200)) == 1 end end