Optimise github actions (#363)

* Hash mix files with glob.

* NPM and dialyzer caching.

* Fix yaml.

* Incorrect hashFiles call.

* Fix blockscout npm path.

* Build dialyzer cache in build cache phase.

* Actually do dialyzer in it's own job to prevent blocking other jobs.

* Add meaningful names.

* Remove sweeping windows log.

* Remove test branch.

* Use env vars for otp and elixir release versions.

* Fix templating.
pull/4552/head
Donald Hutchison 3 years ago
parent af6a4466a4
commit 29b97b22c4
  1. 470
      .github/workflows/config.yml
  2. 2
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex
  3. 16
      mix.exs

@ -11,125 +11,210 @@ on:
env: env:
MIX_ENV: test MIX_ENV: test
OTP_VERSION: '23.3.4.1'
ELIXIR_VERSION: '1.11.4'
jobs: jobs:
build: build-and-cache:
name: Build and Cache deps
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: mix local.hex --force
- run: mix local.rebar --force
- name: "ELIXIR_VERSION.lock" - name: "ELIXIR_VERSION.lock"
run: echo "${ELIXIR_VERSION}" > ELIXIR_VERSION.lock run: echo "${ELIXIR_VERSION}" > ELIXIR_VERSION.lock
- name: "OTP_VERSION.lock" - name: "OTP_VERSION.lock"
run: echo "${OTP_VERSION}" > OTP_VERSION.lock run: echo "${OTP_VERSION}" > OTP_VERSION.lock
- run: mix deps.get
- run: npm install - name: Restore Mix Deps Cache
uses: actions/cache@v2
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-
- name: Conditionally build Mix deps cache
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
mix deps.compile
cd deps/libsecp256k1
make
- name: Restore Explorer NPM Cache
uses: actions/cache@v2
id: explorer-npm-cache
with:
path: apps/explorer/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-${{ hashFiles('apps/explorer/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-
- name: Conditionally build Explorer NPM Cache
if: steps.explorer-npm-cache.outputs.cache-hit != 'true'
run: npm install
working-directory: apps/explorer working-directory: apps/explorer
- run: npm install
working-directory: apps/block_scout_web/assets - name: Restore Blockscout Web NPM Cache
- run: npm rebuild node-sass uses: actions/cache@v2
id: blockscoutweb-npm-cache
with:
path: apps/block_scout_web/assets/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-${{ hashFiles('apps/block_scout_web/assets/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-
- name: Conditionally build Blockscout Web NPM Cache
if: steps.blockscoutweb-npm-cache.outputs.cache-hit != 'true'
run: npm install
working-directory: apps/block_scout_web/assets working-directory: apps/block_scout_web/assets
- run: mix compile
- run: make
working-directory: "deps/libsecp256k1"
- name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/block_scout_web/assets"
credo: credo:
name: Credo
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: mix local.hex --force
- run: mix local.rebar --force - name: Restore Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: mix compile id: deps-cache
- run: make with:
working-directory: "deps/libsecp256k1" path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- run: mix credo - run: mix credo
check_formatted: check_formatted:
name: Code formatting checks
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: mix local.hex --force
- run: mix local.rebar --force - name: Restore Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: mix compile id: deps-cache
- run: make with:
working-directory: "deps/libsecp256k1" path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- run: mix format --check-formatted - run: mix format --check-formatted
dialyzer: dialyzer:
name: Dialyzer static analysis
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: mix local.hex --force
- run: mix local.rebar --force - name: Restore Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: mix compile id: deps-cache
- run: make with:
working-directory: "deps/libsecp256k1" path: |
- name: Unpack PLT cache deps
run: | _build
mkdir -p _build/test key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
cp plts/dialyxir*.plt _build/test/ || true restore-keys: |
mkdir -p ~/.mix ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
cp plts/dialyxir*.plt ~/.mix/ || true
- run: mix dialyzer --plt - name: Restore Dialyzer Cache
- name: Pack PLT cache uses: actions/cache@v2
id: dialyzer-cache
with:
path: priv/plts
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-mixlockhash-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-"
- name: Conditionally build Dialyzer Cache
if: steps.dialyzer-cache.output.cache-hit != 'true'
run: | run: |
mkdir -p plts mkdir -p priv/plts
cp _build/test/dialyxir*.plt plts/ mix dialyzer --plt
cp ~/.mix/dialyxir*.plt plts/
- run: mix dialyzer --halt-exit-status - run: mix dialyzer --halt-exit-status
name: Run Dialyzer
gettext: gettext:
name: Missing translation keys check
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: mix local.hex --force
- run: mix local.rebar --force - name: Restore Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: mix compile id: deps-cache
- run: make with:
working-directory: "deps/libsecp256k1" path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- run: | - run: |
mix gettext.extract --merge | tee stdout.txt mix gettext.extract --merge | tee stdout.txt
! grep "Wrote " stdout.txt ! grep "Wrote " stdout.txt
working-directory: "apps/block_scout_web" working-directory: "apps/block_scout_web"
sobelow: sobelow:
name: Sobelow security analysis
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: mix local.hex --force
- run: mix local.rebar --force - name: Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: mix deps.compile id: deps-cache
- run: mix compile with:
- run: make path: |
working-directory: "deps/libsecp256k1" deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Scan explorer for vulnerabilities - name: Scan explorer for vulnerabilities
run: mix sobelow --config run: mix sobelow --config
working-directory: "apps/explorer" working-directory: "apps/explorer"
@ -137,57 +222,99 @@ jobs:
run: mix sobelow --config run: mix sobelow --config
working-directory: "apps/block_scout_web" working-directory: "apps/block_scout_web"
eslint: eslint:
name: ESLint
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: mix local.hex --force
- run: mix local.rebar --force - name: Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: npm install id: deps-cache
working-directory: apps/explorer with:
- run: npm install path: |
working-directory: apps/block_scout_web/assets deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Restore Explorer NPM Cache
uses: actions/cache@v2
id: explorer-npm-cache
with:
path: apps/explorer/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-${{ hashFiles('apps/explorer/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-
- name: Restore Blockscout Web NPM Cache
uses: actions/cache@v2
id: blockscoutweb-npm-cache
with:
path: apps/block_scout_web/assets/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-${{ hashFiles('apps/block_scout_web/assets/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-
- run: npm rebuild node-sass - run: npm rebuild node-sass
working-directory: apps/block_scout_web/assets working-directory: apps/block_scout_web/assets
- run: mix compile
- run: make
working-directory: "deps/libsecp256k1"
- name: Build assets - name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/block_scout_web/assets" working-directory: "apps/block_scout_web/assets"
- run: ./node_modules/.bin/eslint --format=junit --output-file="test/eslint/junit.xml" js/** - run: ./node_modules/.bin/eslint --format=junit --output-file="test/eslint/junit.xml" js/**
working-directory: apps/block_scout_web/assets working-directory: apps/block_scout_web/assets
jest: jest:
name: JS Tests
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: mix local.hex --force
- run: mix local.rebar --force - name: Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: npm install id: deps-cache
working-directory: apps/explorer with:
- run: npm install path: |
working-directory: apps/block_scout_web/assets deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Restore Blockscout Web NPM Cache
uses: actions/cache@v2
id: blockscoutweb-npm-cache
with:
path: apps/block_scout_web/assets/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-${{ hashFiles('apps/block_scout_web/assets/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-
- run: npm rebuild node-sass - run: npm rebuild node-sass
working-directory: apps/block_scout_web/assets working-directory: apps/block_scout_web/assets
- run: mix compile
- run: make
working-directory: "deps/libsecp256k1"
- name: Build assets - name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/block_scout_web/assets" working-directory: "apps/block_scout_web/assets"
- run: ./node_modules/.bin/jest - run: ./node_modules/.bin/jest
working-directory: apps/block_scout_web/assets working-directory: apps/block_scout_web/assets
test_parity_mox_ethereum_jsonrpc: test_parity_mox_ethereum_jsonrpc:
name: EthereumJSONRPC Tests
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
services: services:
postgres: postgres:
image: postgres image: postgres
@ -211,25 +338,22 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV - run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV
- run: mix local.hex --force
- run: mix local.rebar --force - name: Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: npm install id: deps-cache
working-directory: apps/explorer with:
- run: npm install path: |
working-directory: apps/block_scout_web/assets deps
- run: npm rebuild node-sass _build
working-directory: apps/block_scout_web/assets key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
- run: mix compile restore-keys: |
- run: make ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
working-directory: "deps/libsecp256k1"
- name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/block_scout_web/assets"
- run: ./bin/install_chrome_headless.sh - run: ./bin/install_chrome_headless.sh
- name: mix test --exclude no_parity - name: mix test --exclude no_parity
run: | run: |
@ -243,7 +367,9 @@ jobs:
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox" ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
test_parity_mox_explorer: test_parity_mox_explorer:
name: Explorer Tests
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
services: services:
postgres: postgres:
image: postgres image: postgres
@ -267,25 +393,31 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV - run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV
- run: mix local.hex --force
- run: mix local.rebar --force - name: Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: npm install id: deps-cache
working-directory: apps/explorer with:
- run: npm install path: |
working-directory: apps/block_scout_web/assets deps
- run: npm rebuild node-sass _build
working-directory: apps/block_scout_web/assets key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
- run: mix compile restore-keys: |
- run: make ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
working-directory: "deps/libsecp256k1"
- name: Build assets - name: Restore Explorer NPM Cache
run: node node_modules/webpack/bin/webpack.js --mode development uses: actions/cache@v2
working-directory: "apps/block_scout_web/assets" id: explorer-npm-cache
with:
path: apps/explorer/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-${{ hashFiles('apps/explorer/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm
- run: ./bin/install_chrome_headless.sh - run: ./bin/install_chrome_headless.sh
- name: mix test --exclude no_parity - name: mix test --exclude no_parity
run: | run: |
@ -301,7 +433,9 @@ jobs:
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox" ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
test_parity_mox_indexer: test_parity_mox_indexer:
name: Indexer Tests
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
services: services:
postgres: postgres:
image: postgres image: postgres
@ -325,26 +459,25 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV - run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV
- run: mix local.hex --force
- run: mix local.rebar --force - name: Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: npm install id: deps-cache
working-directory: apps/explorer with:
- run: npm install path: |
working-directory: apps/block_scout_web/assets deps
- run: npm rebuild node-sass _build
working-directory: apps/block_scout_web/assets key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
- run: mix compile restore-keys: |
- run: make ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
working-directory: "deps/libsecp256k1"
- name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/block_scout_web/assets"
- run: ./bin/install_chrome_headless.sh - run: ./bin/install_chrome_headless.sh
- name: mix test --exclude no_parity - name: mix test --exclude no_parity
run: | run: |
mix ecto.create --quiet mix ecto.create --quiet
@ -358,8 +491,11 @@ jobs:
PGUSER: postgres PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox" ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox" ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
test_parity_mox_block_scout_web: test_parity_mox_block_scout_web:
name: Blockscout Web Tests
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: build-and-cache
services: services:
postgres: postgres:
image: postgres image: postgres
@ -383,26 +519,50 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-elixir@v1 - uses: actions/setup-elixir@v1
with: with:
otp-version: '23.3.4.1' otp-version: ${{ env.OTP_VERSION }}
elixir-version: '1.11.4' elixir-version: ${{ env.ELIXIR_VERSION }}
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV - run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV
- run: mix local.hex --force
- run: mix local.rebar --force - name: Mix Deps Cache
- run: mix deps.get uses: actions/cache@v2
- run: npm install id: deps-cache
working-directory: apps/explorer with:
- run: npm install path: |
working-directory: apps/block_scout_web/assets deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Restore Explorer NPM Cache
uses: actions/cache@v2
id: explorer-npm-cache
with:
path: apps/explorer/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-${{ hashFiles('apps/explorer/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-
- name: Restore Blockscout Web NPM Cache
uses: actions/cache@v2
id: blockscoutweb-npm-cache
with:
path: apps/block_scout_web/assets/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-${{ hashFiles('apps/block_scout_web/assets/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-
- run: npm rebuild node-sass - run: npm rebuild node-sass
working-directory: apps/block_scout_web/assets working-directory: apps/block_scout_web/assets
- run: mix compile
- run: make
working-directory: "deps/libsecp256k1"
- name: Build assets - name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/block_scout_web/assets" working-directory: "apps/block_scout_web/assets"
- run: ./bin/install_chrome_headless.sh - run: ./bin/install_chrome_headless.sh
- name: mix test --exclude no_parity - name: mix test --exclude no_parity
run: | run: |
mix ecto.create --quiet mix ecto.create --quiet

@ -104,8 +104,6 @@ defmodule EthereumJSONRPC.RollingWindow do
# Public for testing # Public for testing
defp sweep(table, delete_match_spec, replace_match_spec) do defp sweep(table, delete_match_spec, replace_match_spec) do
Logger.debug(fn -> "Sweeping windows" end)
# Delete any rows where all windows empty # Delete any rows where all windows empty
:ets.match_delete(table, delete_match_spec) :ets.match_delete(table, delete_match_spec)

@ -10,11 +10,7 @@ defmodule BlockScout.Mixfile do
version: "2.0", version: "2.0",
apps_path: "apps", apps_path: "apps",
deps: deps(), deps: deps(),
dialyzer: [ dialyzer: dialyzer(),
plt_add_deps: :transitive,
plt_add_apps: ~w(ex_unit mix)a,
ignore_warnings: ".dialyzer-ignore"
],
elixir: "~> 1.10", elixir: "~> 1.10",
preferred_cli_env: [ preferred_cli_env: [
credo: :test, credo: :test,
@ -36,6 +32,16 @@ defmodule BlockScout.Mixfile do
## Private Functions ## Private Functions
defp dialyzer() do
[
plt_add_deps: :transitive,
plt_add_apps: ~w(ex_unit mix)a,
ignore_warnings: ".dialyzer-ignore",
plt_core_path: "priv/plts",
plt_file: {:no_warn, "priv/plts/dialyzer.plt"}
]
end
defp aliases(env) do defp aliases(env) do
[ [
# to match behavior of `mix test` in `apps/indexer`, which needs to not start applications for `indexer` to # to match behavior of `mix test` in `apps/indexer`, which needs to not start applications for `indexer` to

Loading…
Cancel
Save