Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
blockscout/.circleci/config.yml

420 lines
11 KiB

version: 2
jobs:
build:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.6.5-node-browsers
environment:
MIX_ENV: test
# match POSTGRES_PASSWORD for postgres image below
PGPASSWORD: postgres
# match POSTGRES_USER for postgres image below
PGUSER: postgres
working_directory: ~/app
steps:
- checkout
- run: mix local.hex --force
- run: mix local.rebar --force
- run:
name: "ELIXIR_VERSION.lock"
command: echo "${ELIXIR_VERSION}" > ELIXIR_VERSION.lock
- run:
name: "OTP_VERSION.lock"
command: echo "${OTP_VERSION}" > OTP_VERSION.lock
- restore_cache:
keys:
- v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
- v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
- v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
- run: mix deps.get
- restore_cache:
keys:
- v6-npm-install-{{ .Branch }}-{{ checksum "apps/explorer_web/assets/package-lock.json" }}
- v6-npm-install-{{ .Branch }}
- v6-npm-install
- run:
command: npm install
working_directory: "apps/explorer"
- save_cache:
key: v3-npm-install-{{ .Branch }}-{{ checksum "apps/explorer/package-lock.json" }}
paths: "apps/explorer/node_modules"
- save_cache:
key: v3-npm-install-{{ .Branch }}
paths: "apps/explorer/node_modules"
- save_cache:
key: v3-npm-install
paths: "apps/explorer/node_modules"
- run:
command: npm install
working_directory: "apps/explorer_web/assets"
- save_cache:
key: v6-npm-install-{{ .Branch }}-{{ checksum "apps/explorer_web/assets/package-lock.json" }}
paths: "apps/explorer_web/assets/node_modules"
- save_cache:
key: v6-npm-install-{{ .Branch }}
paths: "apps/explorer_web/assets/node_modules"
- save_cache:
key: v6-npm-install
paths: "apps/explorer_web/assets/node_modules"
- run: mix compile
# `deps` needs to be cached with `_build` because `_build` will symlink into `deps`
- save_cache:
key: v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
paths:
- deps
- _build
- save_cache:
key: v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
paths:
- deps
- _build
- save_cache:
key: v6-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
paths:
- deps
- _build
- run:
name: Build assets
command: node node_modules/webpack/bin/webpack.js --mode development
working_directory: "apps/explorer_web/assets"
- persist_to_workspace:
root: .
paths:
- .circleci
- .credo.exs
- .dialyzer-ignore
- .formatter.exs
- .git
- .gitignore
- ELIXIR_VERSION.lock
- Gemfile
- Gemfile.lock
- OTP_VERSION.lock
- _build
- apps
- bin
- config
- deps
- doc
- mix.exs
- mix.lock
- appspec.yml
check_formatted:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.6.5
environment:
MIX_ENV: test
working_directory: ~/app
steps:
- attach_workspace:
at: .
- run: mix format --check-formatted
credo:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.6.5
environment:
MIX_ENV: test
working_directory: ~/app
steps:
- attach_workspace:
at: .
- run: mix local.hex --force
- run: mix credo
deploy_aws:
docker:
# Ensure .tool-versions matches
- image: circleci/python:2.7-stretch
working_directory: ~/app
steps:
- attach_workspace:
at: .
- add_ssh_keys:
fingerprints:
- "c4:fd:a8:f8:48:a8:09:e5:3e:be:30:62:4d:6f:6f:36"
- run:
name: Deploy to AWS
command: bin/deploy
dialyzer:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.6.5
environment:
MIX_ENV: test
working_directory: ~/app
steps:
- attach_workspace:
at: .
- run: mix local.hex --force
- restore_cache:
keys:
- v6-mix-dailyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
- v6-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
- v6-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
- run:
name: Unpack PLT cache
command: |
mkdir -p _build/test
cp plts/dialyxir*.plt _build/test/ || true
mkdir -p ~/.mix
cp plts/dialyxir*.plt ~/.mix/ || true
- run: mix dialyzer --plt
- run:
name: Pack PLT cache
command: |
mkdir -p plts
cp _build/test/dialyxir*.plt plts/
cp ~/.mix/dialyxir*.plt plts/
- save_cache:
key: v6-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
paths:
- plts
- save_cache:
key: v6-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
paths:
- plts
- save_cache:
key: v6-mix-dialyzer-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
paths:
- plts
- run: mix dialyzer --halt-exit-status
eslint:
docker:
# Ensure .tool-versions matches
- image: circleci/node:9.10.1
working_directory: ~/app
steps:
- attach_workspace:
at: .
- run:
name: ESLint
command: ./node_modules/.bin/eslint --format=junit --output-file="test/eslint/junit.xml" js/**
working_directory: apps/explorer_web/assets
- store_test_results:
path: apps/explorer_web/assets/test
gettext:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.6.5
environment:
MIX_ENV: test
working_directory: ~/app
steps:
- attach_workspace:
at: .
- run: mix local.hex --force
- run:
name: Check for missed translations
command: |
mix gettext.extract --merge | tee stdout.txt
! grep "Wrote " stdout.txt
working_directory: "apps/explorer_web"
- store_artifacts:
path: apps/explorer_web/priv/gettext
jest:
docker:
# Ensure .tool-versions matches
- image: circleci/node:9.10.1
working_directory: ~/app
steps:
- attach_workspace:
at: .
- run:
name: Jest
command: ./node_modules/.bin/jest
working_directory: apps/explorer_web/assets
sobelow:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.6.5
environment:
MIX_ENV: test
working_directory: ~/app
steps:
- attach_workspace:
at: .
- run: mix local.hex --force
- run:
name: Scan explorer for vulnerabilities
command: mix sobelow --config
working_directory: "apps/explorer"
- run:
name: Scan explorer_web for vulnerabilities
command: mix sobelow --config
working_directory: "apps/explorer_web"
test_geth:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.6.5-node-browsers
environment:
MIX_ENV: test
# match POSTGRES_PASSWORD for postgres image below
PGPASSWORD: postgres
# match POSTGRES_USER for postgres image below
PGUSER: postgres
ETHEREUM_JSONRPC_VARIANT: geth
- image: circleci/postgres:10.3-alpine
environment:
# Match apps/explorer/config/test.exs config :explorerer, Explorer.Repo, database
POSTGRES_DB: explorer_test
# match PGPASSWORD for elixir image above
POSTGRES_PASSWORD: postgres
# match PGUSER for elixir image above
POSTGRES_USER: postgres
working_directory: ~/app
steps:
- attach_workspace:
at: .
- run: mix local.hex --force
- run: mix local.rebar --force
- run:
name: Wait for DB
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run: mix coveralls.circle --exclude no_geth --parallel --umbrella
- store_test_results:
path: _build/test/junit
test_parity:
docker:
# Ensure .tool-versions matches
- image: circleci/elixir:1.6.5-node-browsers
environment:
MIX_ENV: test
# match POSTGRES_PASSWORD for postgres image below
PGPASSWORD: postgres
# match POSTGRES_USER for postgres image below
PGUSER: postgres
ETHEREUM_JSONRPC_VARIANT: parity
- image: circleci/postgres:10.3-alpine
environment:
# Match apps/explorer/config/test.exs config :explorerer, Explorer.Repo, database
POSTGRES_DB: explorer_test
# match PGPASSWORD for elixir image above
POSTGRES_PASSWORD: postgres
# match PGUSER for elixir image above
POSTGRES_USER: postgres
working_directory: ~/app
steps:
- attach_workspace:
at: .
- run: mix local.hex --force
- run: mix local.rebar --force
- run:
name: Wait for DB
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run: mix coveralls.circle --parallel --umbrella
- store_test_results:
path: _build/test/junit
workflows:
version: 2
primary:
jobs:
- build
- check_formatted:
requires:
- build
- credo:
requires:
- build
- deploy_aws:
filters:
branches:
only:
- production
- staging
- /deploy-[A-Za-z0-9]+$/
requires:
- check_formatted
- credo
- eslint
- jest
- sobelow
- test_parity
- test_geth
- dialyzer:
requires:
- build
- eslint:
requires:
- build
- gettext:
requires:
- build
- jest:
requires:
- build
- sobelow:
requires:
- build
- test_parity:
requires:
- build
- test_geth:
requires:
- build