Skip to content

Commit

Permalink
chore(go): introduce ci infra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Apr 1, 2024
1 parent d17a9e1 commit 943a04b
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Go CI
name: mev-commit-ci

on:
push:
Expand Down Expand Up @@ -45,15 +45,17 @@ jobs:
- name: Sync
run: go work sync

- name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.57.2
args: --verbose ${{ env.GO_LINT_DIRS }}
# TODO(mrekucci): Re-enable when the repo is finalized.
# - name: Lint
# uses: golangci/golangci-lint-action@v4
# with:
# version: v1.57.2
# args: --verbose ${{ env.GO_LINT_DIRS }}

- name: Build
run: go list -f '{{.Dir}}/...' -m | xargs go build

- name: Test
run: go list -f '{{.Dir}}/...' -m | xargs go test
# TODO(mrekucci): Re-enable when tests are passing.
# - name: Test
# run: go list -f '{{.Dir}}/...' -m | xargs go test

66 changes: 66 additions & 0 deletions .github/workflows/mev-commit-infra-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Deploy and Test mev-commit infra

on:
workflow_run:
workflows: ["mev-commit-ci"]
types:
- completed

jobs:
deploy_and_test:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install jq
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Setup Docker Compose
run: |
sudo rm /usr/local/bin/docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- name: Build and Start Services
run: cd p2p && set -x && ./mev-commit-cli.sh start mev-commit --datadog-key "${{ secrets.DATADOG_API_KEY }}"

- name: Check Service Endpoints
run: |
ips=("172.29.9.100" "172.29.9.101" "172.29.9.102") # Example IP addresses, adjust as needed
for ip in "${ips[@]}"; do
echo "Checking service at $ip"
success=false
attempts=0
while [ $attempts -lt 3 ]; do
response=$(curl -s "$ip:13523/topology")
buildersCount=$(echo "$response" | jq '.connected_peers.builders | length')
searchersCount=$(echo "$response" | jq '.connected_peers.searchers | length')
if [[ -n "$response" && "$buildersCount" -gt 0 || "$searchersCount" -gt 0 ]]; then
echo "Service at $ip is OK"
success=true
break
else
echo "Service check failed for $ip. Retrying in 30 seconds..."
attempts=$(( $attempts + 1 ))
sleep 30
fi
done
if [ "$success" == "false" ]; then
echo "Service check failed for $ip after 3 attempts, failing"
exit 1
fi
done
- name: Stop Services
run: cd p2p && ./mev-commit-cli.sh stop mev-commit
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ linters:
- complexity
- performance
disable:
- musttag # TODO: re-enable when external/geth is bumped to go1.21
- musttag # TODO(mrekucci): re-enable when external/geth is bumped to go1.21

run:
timeout: 15m
Expand Down
7 changes: 7 additions & 0 deletions p2p/integrationtest/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BIDDER_REGISTRY=0x02CcEcB19c6D7EFe583C8b97022cB4b4C0B65608
PROVIDER_REGISTRY=0x070cE6161AD79a3BC7aEa222FdfC6AD171Ca83F3
PRECONF_CONTRACT=0x4DfF34f74aE5C48a5050eb54e7cEDAb9DEF03715

RPC_URL=http://sl-bootnode:8545
PRIVATE_KEY=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
L1_RPC_URL="https://sepolia.infura.io/v3/"

0 comments on commit 943a04b

Please sign in to comment.