Skip to content

Commit

Permalink
Merge pull request #48 from aurora-is-near/sync-17-06
Browse files Browse the repository at this point in the history
Sync with origin
  • Loading branch information
spilin authored Jul 5, 2024
2 parents 4f7841d + e5f7271 commit d5e433b
Show file tree
Hide file tree
Showing 430 changed files with 24,828 additions and 5,000 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ body:
attributes:
label: Elixir & Erlang/OTP versions
description: Elixir & Erlang/OTP versions.
placeholder: Elixir 1.14.5 (compiled with Erlang/OTP 25)
placeholder: Elixir 1.16.3 (compiled with Erlang/OTP 26)
validations:
required: true

Expand Down
23 changes: 0 additions & 23 deletions .github/actions/setup-repo-and-short-sha/action.yml

This file was deleted.

65 changes: 62 additions & 3 deletions .github/actions/setup-repo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,69 @@ inputs:
docker-password:
description: 'Docker password'
required: true
docker-remote-multi-platform:
description: 'Docker remote multi-platform builder'
required: true
default: 'false'
docker-arm-host:
description: 'Docker remote arm builder'
required: false
docker-arm-host-key:
description: 'Docker remote arm builder ssh private key'
required: false
docker-image:
description: 'Docker image'
required: true
default: blockscout/blockscout
outputs:
docker-builder:
description: 'Docker builder'
value: ${{ steps.builder_local.outputs.name || steps.builder_multi.outputs.name }}
docker-tags:
description: 'Docker metadata tags'
value: ${{ steps.meta.outputs.tags }}
docker-labels:
description: 'Docker metadata labels'
value: ${{ steps.meta.outputs.labels }}
docker-platforms:
description: 'Docker build platforms'
value: ${{ steps.builder_local.outputs.platforms || steps.builder_multi.outputs.platforms }}
runs:
using: "composite"
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up SSH key
shell: bash
run: |
mkdir -p ~/.ssh
echo "${{ inputs.docker-arm-host-key }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Find builder
if: ${{ inputs.docker-remote-multi-platform }}
shell: bash
run: echo "BUILDER_IP=$(./.github/scripts/select-builder.sh ${{ inputs.docker-arm-host }} ubuntu ~/.ssh/id_rsa)" >> $GITHUB_ENV
- name: Set up SSH
if: ${{ inputs.docker-remote-multi-platform }}
uses: MrSquaare/ssh-setup-action@523473d91581ccbf89565e12b40faba93f2708bd # v1.1.0
with:
host: ${{ env.BUILDER_IP }}
private-key: ${{ inputs.docker-arm-host-key }}

- name: Set up Docker Buildx
if: ${{ !inputs.docker-remote-multi-platform }}
uses: docker/setup-buildx-action@v3
id: builder_local
with:
platforms: linux/amd64

- name: Set up Multi-platform Docker Buildx
if: ${{ inputs.docker-remote-multi-platform }}
uses: docker/setup-buildx-action@v3
id: builder_multi
with:
platforms: linux/amd64
append: |
- endpoint: ssh://ubuntu@${{ env.BUILDER_IP }}
platforms: linux/arm64/v8
- name: Log in to Docker Hub
uses: docker/login-action@v3
Expand All @@ -26,4 +81,8 @@ runs:
id: meta
uses: docker/metadata-action@v5
with:
images: blockscout/blockscout
images: ${{ inputs.docker-image }}

- name: Add SHORT_SHA env property with commit short sha
shell: bash
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
44 changes: 44 additions & 0 deletions .github/scripts/select-builder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# Check if a domain is provided as an argument
if [ -z "$1" ]; then
echo "Usage: $0 <domain>"
exit 1
fi

DOMAIN=$1
SSH_USER=$2
SSH_KEY=$3

# Resolve A records
IP_LIST=$(dig +short A $DOMAIN)
if [ -z "$IP_LIST" ]; then
echo "No IPs found for domain $DOMAIN"
exit 1
fi

MIN_LA=1000000
BEST_BUILDER=""

for IP in $IP_LIST; do
# Check if the host is reachable via SSH
ssh -o StrictHostKeychecking=no -o ConnectTimeout=5 -o BatchMode=yes -i $SSH_KEY $SSH_USER@$IP "exit" 2>/dev/null
if [ $? -eq 0 ]; then
# Get the load average
LA=$(ssh -o StrictHostKeychecking=no -i $SSH_KEY $SSH_USER@$IP "uptime | awk -F'load average:' '{ print \$2 }' | cut -d, -f1" 2>/dev/null)
if [ $? -eq 0 ]; then
# Compare and find the minimum load average
LA=$(echo $LA | xargs) # Trim whitespace
if (( $(echo "$LA < $MIN_LA" | bc -l) )); then
MIN_LA=$LA
BEST_BUILDER=$IP
fi
fi
fi
done

if [ -n "$BEST_BUILDER" ]; then
echo "$BEST_BUILDER" | tr -d '[:space:]'
else
echo "No reachable hosts found."
fi
13 changes: 7 additions & 6 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
push:
branches:
- master
- production-arbitrum
- production-core
- production-eth-experimental
- production-eth-goerli
- production-eth-sepolia
- production-filecoin
- production-fuse
- production-optimism
- production-immutable
Expand All @@ -29,13 +29,11 @@ on:
types: [opened, synchronize, reopened, labeled]
branches:
- master
- production-optimism
- production-zksync

env:
MIX_ENV: test
OTP_VERSION: ${{ vars.OTP_VERSION || '25.3.2.8' }}
ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION || '1.14.5' }}
OTP_VERSION: ${{ github.ref_name == '9256/merge' && '26.2.5.1' || vars.OTP_VERSION }}
ELIXIR_VERSION: ${{ github.ref_name == '9256/merge' && '1.16.3' || vars.ELIXIR_VERSION }}
ACCOUNT_AUTH0_DOMAIN: "blockscoutcom.us.auth0.com"

jobs:
Expand Down Expand Up @@ -583,6 +581,7 @@ jobs:
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }}
WETH_TOKEN_TRANSFERS_FILTERING_ENABLED: "true"
test_nethermind_mox_indexer:
strategy:
fail-fast: false
Expand Down Expand Up @@ -649,6 +648,7 @@ jobs:
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }}
WETH_TOKEN_TRANSFERS_FILTERING_ENABLED: "true"
test_nethermind_mox_block_scout_web:
strategy:
fail-fast: false
Expand Down Expand Up @@ -749,3 +749,4 @@ jobs:
ACCOUNT_REDIS_URL: "redis://localhost:6379"
SOURCIFY_INTEGRATION_ENABLED: "true"
CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }}
WETH_TOKEN_TRANSFERS_FILTERING_ENABLED: "true"
97 changes: 97 additions & 0 deletions .github/workflows/pre-release-arbitrum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Pre-release for Arbitrum

on:
workflow_dispatch:
inputs:
number:
type: number
required: true

env:
OTP_VERSION: ${{ vars.OTP_VERSION }}
ELIXIR_VERSION: ${{ vars.ELIXIR_VERSION }}

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ vars.RELEASE_VERSION }}
steps:
- uses: actions/checkout@v4
- name: Setup repo
uses: ./.github/actions/setup-repo
id: setup
with:
docker-username: ${{ secrets.DOCKER_USERNAME }}
docker-password: ${{ secrets.DOCKER_PASSWORD }}
docker-remote-multi-platform: true
docker-arm-host: ${{ secrets.ARM_RUNNER_HOSTNAME }}
docker-arm-host-key: ${{ secrets.ARM_RUNNER_KEY }}

- name: Build and push Docker image for Arbitrum (indexer + API)
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
push: true
tags: blockscout/blockscout-arbitrum:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
labels: ${{ steps.setup.outputs.docker-labels }}
platforms: |
linux/amd64
linux/arm64/v8
build-args: |
DISABLE_WEBAPP=false
API_V1_READ_METHODS_DISABLED=false
API_V1_WRITE_METHODS_DISABLED=false
CACHE_EXCHANGE_RATES_PERIOD=
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
ADMIN_PANEL_ENABLED=false
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
- name: Build and push Docker image for Arbitrum (indexer)
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
push: true
tags: blockscout/blockscout-arbitrum:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-indexer
labels: ${{ steps.setup.outputs.docker-labels }}
platforms: |
linux/amd64
linux/arm64/v8
build-args: |
DISABLE_API=true
DISABLE_WEBAPP=true
CACHE_EXCHANGE_RATES_PERIOD=
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
ADMIN_PANEL_ENABLED=false
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
- name: Build and push Docker image for Arbitrum (API)
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
push: true
tags: blockscout/blockscout-arbitrum:${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}-api
labels: ${{ steps.setup.outputs.docker-labels }}
platforms: |
linux/amd64
linux/arm64/v8
build-args: |
DISABLE_INDEXER=true
DISABLE_WEBAPP=true
CACHE_EXCHANGE_RATES_PERIOD=
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
ADMIN_PANEL_ENABLED=false
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
Loading

0 comments on commit d5e433b

Please sign in to comment.