-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(ci): improve hive
workflow
#9320
Changes from all commits
efe5ad6
530cbe2
7ea4088
6dcc6c5
f91b00c
323ea67
4ad86e1
7a1b252
1246773
33adc59
a92aaad
c7c8453
66569ae
6c91315
339c474
9e6b109
0be7767
79050c0
39fb8c3
d912c90
61825cd
a8ee7fe
2743f3d
24a2710
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# Create the hive_assets directory | ||
mkdir hive_assets/ | ||
|
||
cd hivetests | ||
go build . | ||
|
||
./hive -client reth # first builds and caches the client | ||
|
||
# Run each hive command in the background for each simulator and wait | ||
echo "Building images" | ||
./hive -client reth --sim "pyspec" -sim.timelimit 1s || true & | ||
./hive -client reth --sim "ethereum/engine" -sim.timelimit 1s || true & | ||
./hive -client reth --sim "devp2p" -sim.timelimit 1s || true & | ||
./hive -client reth --sim "ethereum/rpc-compat" -sim.timelimit 1s || true & | ||
./hive -client reth --sim "smoke/genesis" -sim.timelimit 1s || true & | ||
./hive -client reth --sim "smoke/network" -sim.timelimit 1s || true & | ||
./hive -client reth --sim "ethereum/sync" -sim.timelimit 1s || true & | ||
wait | ||
|
||
# Run docker save in parallel and wait | ||
echo "Saving images" | ||
docker save hive/hiveproxy:latest -o ../hive_assets/hiveproxy.tar & | ||
docker save hive/simulators/devp2p:latest -o ../hive_assets/devp2p.tar & | ||
docker save hive/simulators/ethereum/engine:latest -o ../hive_assets/engine.tar & | ||
docker save hive/simulators/ethereum/rpc-compat:latest -o ../hive_assets/rpc_compat.tar & | ||
docker save hive/simulators/ethereum/pyspec:latest -o ../hive_assets/pyspec.tar & | ||
docker save hive/simulators/smoke/genesis:latest -o ../hive_assets/smoke_genesis.tar & | ||
docker save hive/simulators/smoke/network:latest -o ../hive_assets/smoke_network.tar & | ||
docker save hive/simulators/ethereum/sync:latest -o ../hive_assets/ethereum_sync.tar & | ||
wait | ||
|
||
# Make sure we don't rebuild images on the CI jobs | ||
git apply ../.github/assets/hive/no_sim_build.diff | ||
go build . | ||
mv ./hive ../hive_assets/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,14 +36,6 @@ engine-withdrawals: | |
- Withdrawals Fork on Canonical Block 8 / Side Block 7 - 10 Block Re-Org Sync (Paris) (reth) | ||
- Withdrawals Fork on Canonical Block 8 / Side Block 9 - 10 Block Re-Org (Paris) (reth) | ||
- Withdrawals Fork on Canonical Block 8 / Side Block 9 - 10 Block Re-Org Sync (Paris) (reth) | ||
|
||
# https://github.com/paradigmxyz/reth/issues/8304#issuecomment-2208515839 | ||
- Sync after 2 blocks - Withdrawals on Block 1 - Single Withdrawal Account - No Transactions (Paris) (reth) | ||
- Sync after 2 blocks - Withdrawals on Block 1 - Single Withdrawal Account (Paris) (reth) | ||
- Sync after 2 blocks - Withdrawals on Genesis - Single Withdrawal Account (Paris) (reth) | ||
- Sync after 2 blocks - Withdrawals on Block 2 - Multiple Withdrawal Accounts - No Transactions (Paris) (reth) | ||
- Sync after 2 blocks - Withdrawals on Block 2 - Multiple Withdrawal Accounts (Paris) (reth) | ||
- Sync after 128 blocks - Withdrawals on Block 2 - Multiple Withdrawal Accounts (Paris) (reth) | ||
Comment on lines
-39
to
-46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. has been resolved somehow: https://github.com/paradigmxyz/reth/actions/runs/9801063333/job/27084334016 so no longer an expected failure |
||
|
||
# https://github.com/paradigmxyz/reth/issues/8305 | ||
# https://github.com/paradigmxyz/reth/issues/6217 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# List of tar files to load | ||
IMAGES=( | ||
"/tmp/hiveproxy.tar" | ||
"/tmp/devp2p.tar" | ||
"/tmp/engine.tar" | ||
"/tmp/rpc_compat.tar" | ||
"/tmp/pyspec.tar" | ||
"/tmp/smoke_genesis.tar" | ||
"/tmp/smoke_network.tar" | ||
"/tmp/ethereum_sync.tar" | ||
"/tmp/reth_image.tar" | ||
) | ||
|
||
# Loop through the images and load them | ||
for IMAGE_TAR in "${IMAGES[@]}"; do | ||
echo "Loading image $IMAGE_TAR..." | ||
docker load -i "$IMAGE_TAR" & | ||
done | ||
|
||
wait | ||
|
||
docker image ls -a |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
diff --git a/internal/libdocker/builder.go b/internal/libdocker/builder.go | ||
index 4731c9d..d717f52 100644 | ||
--- a/internal/libdocker/builder.go | ||
+++ b/internal/libdocker/builder.go | ||
@@ -7,9 +7,7 @@ import ( | ||
"fmt" | ||
"io" | ||
"io/fs" | ||
- "os" | ||
"path/filepath" | ||
- "strings" | ||
|
||
"github.com/ethereum/hive/internal/libhive" | ||
docker "github.com/fsouza/go-dockerclient" | ||
@@ -53,24 +51,8 @@ func (b *Builder) BuildClientImage(ctx context.Context, client libhive.ClientDes | ||
|
||
// BuildSimulatorImage builds a docker image of a simulator. | ||
func (b *Builder) BuildSimulatorImage(ctx context.Context, name string) (string, error) { | ||
- dir := b.config.Inventory.SimulatorDirectory(name) | ||
- buildContextPath := dir | ||
- buildDockerfile := "Dockerfile" | ||
- // build context dir of simulator can be overridden with "hive_context.txt" file containing the desired build path | ||
- if contextPathBytes, err := os.ReadFile(filepath.Join(filepath.FromSlash(dir), "hive_context.txt")); err == nil { | ||
- buildContextPath = filepath.Join(dir, strings.TrimSpace(string(contextPathBytes))) | ||
- if strings.HasPrefix(buildContextPath, "../") { | ||
- return "", fmt.Errorf("cannot access build directory outside of Hive root: %q", buildContextPath) | ||
- } | ||
- if p, err := filepath.Rel(buildContextPath, filepath.Join(filepath.FromSlash(dir), "Dockerfile")); err != nil { | ||
- return "", fmt.Errorf("failed to derive relative simulator Dockerfile path: %v", err) | ||
- } else { | ||
- buildDockerfile = p | ||
- } | ||
- } | ||
tag := fmt.Sprintf("hive/simulators/%s:latest", name) | ||
- err := b.buildImage(ctx, buildContextPath, buildDockerfile, tag, nil) | ||
- return tag, err | ||
+ return tag, nil | ||
} | ||
|
||
// BuildImage creates a container by archiving the given file system, | ||
diff --git a/internal/libdocker/proxy.go b/internal/libdocker/proxy.go | ||
index a53e5af..0bb2ea9 100644 | ||
--- a/internal/libdocker/proxy.go | ||
+++ b/internal/libdocker/proxy.go | ||
@@ -16,7 +16,7 @@ const hiveproxyTag = "hive/hiveproxy" | ||
|
||
// Build builds the hiveproxy image. | ||
func (cb *ContainerBackend) Build(ctx context.Context, b libhive.Builder) error { | ||
- return b.BuildImage(ctx, hiveproxyTag, hiveproxy.Source) | ||
+ return nil | ||
} | ||
|
||
// ServeAPI starts the API server. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
# set -x | ||
|
||
cd hivetests/ | ||
|
||
sim="${1}" | ||
limit="${2}" | ||
|
||
run_hive() { | ||
hive --sim "${sim}" --sim.limit "${limit}" --sim.parallelism 4 --client reth 2>&1 | tee /tmp/log || true | ||
} | ||
|
||
check_log() { | ||
tail -n 1 /tmp/log | sed -r 's/\x1B\[[0-9;]*[mK]//g' | ||
} | ||
|
||
attempt=0 | ||
max_attempts=5 | ||
|
||
while [ $attempt -lt $max_attempts ]; do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added retrying logic, since sometimes the test suite will execute 0 tests of the suite in the beginning of the github action. discv4 example: attempt1: https://github.com/paradigmxyz/reth/actions/runs/9799640716/job/27060462135 latest: https://github.com/paradigmxyz/reth/actions/runs/9799976365/job/27061391662 |
||
run_hive | ||
|
||
# Check if no tests were run. sed removes ansi colors | ||
if check_log | grep -q "suites=0"; then | ||
echo "no tests were run, retrying in 5 seconds" | ||
sleep 5 | ||
attempt=$((attempt + 1)) | ||
continue | ||
fi | ||
|
||
# Check the last line of the log for "finished", "tests failed", or "test failed" | ||
if check_log | grep -Eq "(finished|tests? failed)"; then | ||
exit 0 | ||
else | ||
exit 1 | ||
fi | ||
done | ||
exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hive will always try to rebuild the image as far as i could tell, so we patch it