Skip to content

Commit

Permalink
Better CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed Aug 4, 2023
1 parent 8a892f8 commit 35b6248
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 124 deletions.
25 changes: 13 additions & 12 deletions .github/check-service.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/usr/bin/env bash

APP_NAME=$1
TIMEOUT=${2:-60} # Default timeout is 60 seconds if not provided
__service=$1

# Give service a chance to start, and also to go into "Restarting" status
sleep "${TIMEOUT}"
__containerID=$(docker-compose ps -q "${__service}")

STATUS=$(docker-compose ps --services --filter "status=running" | grep "${APP_NAME}")
__restart_count=$(docker inspect --format '{{ .RestartCount }}' "$__containerID")
__running=$(docker inspect --format '{{ .State.Running }}' "$__containerID")

if [ -n "$STATUS" ]; then
echo "$APP_NAME is running."
exit 0
if [ "$__running" != "true" ] || [ "$__restart_count" -gt 0 ]; then
echo "$__service is either not running or continuously restarting"
docker-compose ps "${__service}"
docker-compose logs "${__service}"
exit 1
else
echo "$__service is running"
docker-compose ps "${__service}"
exit 0
fi

echo "$APP_NAME is either not started or restarting"
docker-compose ps | grep "${APP_NAME}"
exit 1
2 changes: 1 addition & 1 deletion .github/test.exp → .github/test-ethd-config.exp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ proc no-grafana {} {
}

set timeout 5
spawn ../ethd config
spawn ./ethd config

# Check for the command-line argument
if {$argc > 0} {
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/test-ethd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test ethd
run-name: Test ethd

on:
push:
pull_request:
types: [opened, synchronize, labeled, unlabeled]
branches: [main]

jobs:
test-ethd:
if: |
contains(github.event.pull_request.labels.*.name, 'test-ethd') ||
contains(github.event.pull_request.labels.*.name, 'test-all') ||
github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Expect
run: sudo apt-get install -y expect
- name: Test ethd config
run: expect ./.github/test-ethd-config.exp
40 changes: 15 additions & 25 deletions .github/workflows/test-grafana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,34 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Create .env file
run: |
cp default.env .env
run: cp default.env .env
- name: Set Lighthouse/Geth/Grafana
run: |
source ./.github/helper.sh
COMPOSE_FILE=lighthouse.yml:geth.yml:grafana.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Lighthouse/Geth/Grafana
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Prometheus
run: |
./.github/check-service.sh prometheus
run: ./.github/check-service.sh prometheus
- name: Test metrics exporter
run: |
./.github/check-service.sh ethereum-metrics-exporter
run: ./.github/check-service.sh ethereum-metrics-exporter
- name: Test node exporter
run: |
./.github/check-service.sh node-exporter
- name: Test cryptowat exporter
run: |
./.github/check-service.sh cryptowat-exporter
run: ./.github/check-service.sh node-exporter
- name: Test blackbox exporter
run: |
./.github/check-service.sh blackbox-exporter
run: ./.github/check-service.sh blackbox-exporter
- name: Test json exporter
run: |
./.github/check-service.sh json-exporter
run: ./.github/check-service.sh json-exporter
- name: Test cryptowat exporter
run: ./.github/check-service.sh cryptowat-exporter
- name: Test cadvisor
run: |
./.github/check-service.sh cadvisor
run: ./.github/check-service.sh cadvisor
- name: Test promtail
run: |
./.github/check-service.sh promtail
run: ./.github/check-service.sh promtail
- name: Test Loki
run: |
./.github/check-service.sh loki
run: ./.github/check-service.sh loki
- name: Test Grafana
run: |
./.github/check-service.sh grafana
run: ./.github/check-service.sh grafana
31 changes: 13 additions & 18 deletions .github/workflows/test-lighthouse-reth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,36 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Create .env file
run: |
cp default.env .env
run: cp default.env .env
- name: Set Lighthouse/Reth
run: |
source ./.github/helper.sh
COMPOSE_FILE=lighthouse.yml:reth.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Lighthouse/Reth
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Lighthouse CL
run: |
./.github/check-service.sh consensus
run: ./.github/check-service.sh consensus
- name: Test Lighthouse VC
run: |
./.github/check-service.sh validator
run: ./.github/check-service.sh validator
- name: Test Reth
run: |
./.github/check-service.sh execution
run: ./.github/check-service.sh execution
- name: Set Lighthouse/Reth w/ VC
run: |
source ./.github/helper.sh
COMPOSE_FILE=lighthouse-cl-only.yml:lighthouse-vc-only.yml:reth.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Lighthouse/Reth
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Lighthouse CL
run: |
./.github/check-service.sh consensus
run: ./.github/check-service.sh consensus
- name: Test Lighthouse VC
run: |
./.github/check-service.sh validator
run: ./.github/check-service.sh validator
- name: Test Reth
run: |
./.github/check-service.sh execution
run: ./.github/check-service.sh execution
31 changes: 13 additions & 18 deletions .github/workflows/test-lodestar-erigon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,36 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Create .env file
run: |
cp default.env .env
run: cp default.env .env
- name: Set Lodestar/Erigon
run: |
source ./.github/helper.sh
COMPOSE_FILE=lodestar.yml:erigon.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Lodestar/Erigon
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Lodestar CL
run: |
./.github/check-service.sh consensus
run: ./.github/check-service.sh consensus
- name: Test Lodestar VC
run: |
./.github/check-service.sh validator
run: ./.github/check-service.sh validator
- name: Test Geth
run: |
./.github/check-service.sh execution
run: ./.github/check-service.sh execution
- name: Set Lodestar/Erigon w/ VC
run: |
source ./.github/helper.sh
COMPOSE_FILE=lodestar-cl-only.yml:lodestar-vc-only.yml:erigon.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Lodestar/Erigon
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Lodestar CL
run: |
./.github/check-service.sh consensus
run: ./.github/check-service.sh consensus
- name: Test Lodestar VC
run: |
./.github/check-service.sh validator
run: ./.github/check-service.sh validator
- name: Test Erigon
run: |
./.github/check-service.sh execution
run: ./.github/check-service.sh execution
28 changes: 12 additions & 16 deletions .github/workflows/test-nimbus-nethermind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,34 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Create .env file
run: |
cp default.env .env
run: cp default.env .env
- name: Set Nimbus/Nethermind
run: |
source ./.github/helper.sh
COMPOSE_FILE=nimbus.yml:nethermind.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Nimbus/Nethermind
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Nimbus
run: |
./.github/check-service.sh consensus
run: ./.github/check-service.sh consensus
- name: Test Nethermind
run: |
./.github/check-service.sh execution
run: ./.github/check-service.sh execution
- name: Set Nimbus/Nethermind w/ VC
run: |
source ./.github/helper.sh
COMPOSE_FILE=nimbus-cl-only.yml:nimbus-vc-only.yml:nethermind.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Nimbus/Nethermind
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Nimbus CL
run: |
./.github/check-service.sh consensus
run: ./.github/check-service.sh consensus
- name: Test Nimbus VC
run: |
./.github/check-service.sh validator
run: ./.github/check-service.sh validator
- name: Test Nethermind
run: |
./.github/check-service.sh execution
run: ./.github/check-service.sh execution
31 changes: 13 additions & 18 deletions .github/workflows/test-prysm-geth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,36 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Create .env file
run: |
cp default.env .env
run: cp default.env .env
- name: Set Prysm/Geth
run: |
source ./.github/helper.sh
COMPOSE_FILE=prysm.yml:geth.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Prysm/Geth
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Prysm CL
run: |
./.github/check-service.sh consensus
run: ./.github/check-service.sh consensus
- name: Test Prysm VC
run: |
./.github/check-service.sh validator
run: ./.github/check-service.sh validator
- name: Test Geth
run: |
./.github/check-service.sh execution
run: ./.github/check-service.sh execution
- name: Set Prysm/Geth w/ VC
run: |
source ./.github/helper.sh
COMPOSE_FILE=prysm-cl-only.yml:prysm-vc-only.yml:geth.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Prysm/Geth
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Prysm CL
run: |
./.github/check-service.sh consensus
run: ./.github/check-service.sh consensus
- name: Test Prysm VC
run: |
./.github/check-service.sh validator
run: ./.github/check-service.sh validator
- name: Test Geth
run: |
./.github/check-service.sh execution
run: ./.github/check-service.sh execution
28 changes: 12 additions & 16 deletions .github/workflows/test-teku-besu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,34 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Create .env file
run: |
cp default.env .env
run: cp default.env .env
- name: Set Teku/Besu
run: |
source ./.github/helper.sh
COMPOSE_FILE=teku.yml:besu.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Teku/Besu
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Teku
run: |
./.github/check-service.sh consensus
run: ./.github/check-service.sh consensus
- name: Test Besu
run: |
./.github/check-service.sh execution
run: ./.github/check-service.sh execution
- name: Set Teku/Besu w/ VC
run: |
source ./.github/helper.sh
COMPOSE_FILE=teku-cl-only.yml:teku-vc-only.yml:besu.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Teku/Besu
run: |
./ethd up
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Teku CL
run: |
./.github/check-service.sh consensus
run: ./.github/check-service.sh consensus
- name: Test Teku VC
run: |
./.github/check-service.sh validator
run: ./.github/check-service.sh validator
- name: Test Besu
run: |
./.github/check-service.sh execution
run: ./.github/check-service.sh execution

0 comments on commit 35b6248

Please sign in to comment.