Skip to content

Commit

Permalink
circleci: build docker images once, save for other jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
protolambda authored and mslipper committed Sep 8, 2022
1 parent b67e6a5 commit 5615e87
Showing 1 changed file with 57 additions and 7 deletions.
64 changes: 57 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,63 @@ jobs:
root: .
paths: ["hive"]

# This job runs the optimism test simulations. This requires a virtual
# We run hive once without any simulators to build the client images, which can then be reused in all test jobs.
hive-clients-build:
machine:
image: ubuntu-2004:202201-02
steps:
- checkout
- attach_workspace: { at: "/tmp/build" }
- run:
name: Build hive client docker images
command: "/tmp/build/hive -client=go-ethereum,op-geth,op-proposer,op-batcher,op-node,op-contracts"
- run:
name: Save hive client docker images
command: |
printf "Saving docker images\n"
mkdir -p /tmp/build/hive-clients
clients=(
"go-ethereum"
"op-geth"
"op-proposer"
"op-batcher"
"op-node"
"op-contracts"
)
for cl in clients; do
docker save -o "/tmp/build/hive-clients/$cl" hive/clients/$cl
done
- persist_to_workspace:
root: "/tmp/build"
paths: [ "hive-clients" ]

# The below hive-*-tests jobs runs the optimism test simulations. This requires a virtual
# machine instead of the container-based build environment because hive needs
# to be able to talk to the docker containers it creates.

hive-rpc-tests:
machine:
image: ubuntu-2004:202201-02
steps:
- checkout
- attach_workspace: {at: "/tmp/build"}
- run: &load_client_docker_images
name: Load hive clients
command: |
printf "Loading client docker images\n"
clients=(
"go-ethereum"
"op-geth"
"op-proposer"
"op-batcher"
"op-node"
"op-contracts"
)
for cl in clients; do
docker load -i "/tmp/build/hive-clients/$cl"
done
- run:
command: "/tmp/build/hive -sim=optimism/rpc -client=go-ethereum,op-geth,op-proposer,op-batcher,op-node,op-contracts |& tee /tmp/build/hive-rpc.log"
command: "/tmp/build/hive -sim=optimism/rpc -sim.loglevel=5 -client=go-ethereum,op-geth,op-proposer,op-batcher,op-node,op-contracts |& tee /tmp/build/hive-rpc.log"
- run:
command: "! grep 'pass.*=false' /tmp/build/hive-rpc.log"
- slack/notify:
Expand All @@ -48,8 +94,9 @@ jobs:
steps:
- checkout
- attach_workspace: {at: "/tmp/build"}
- run: *load_client_docker_images
- run:
command: "/tmp/build/hive -sim=optimism/testnet -client=go-ethereum,op-geth,op-proposer,op-batcher,op-node,op-contracts |& tee /tmp/build/hive-testnet.log"
command: "/tmp/build/hive -sim=optimism/testnet -sim.loglevel=5 -client=go-ethereum,op-geth,op-proposer,op-batcher,op-node,op-contracts |& tee /tmp/build/hive-testnet.log"
- run:
command: "! grep 'pass.*=false' /tmp/build/hive-testnet.log"
- slack/notify:
Expand All @@ -67,8 +114,9 @@ jobs:
steps:
- checkout
- attach_workspace: {at: "/tmp/build"}
- run: *load_client_docker_images
- run:
command: "/tmp/build/hive -sim=optimism/p2p -client=go-ethereum,op-geth,op-proposer,op-batcher,op-node,op-contracts |& tee /tmp/build/hive-p2p.log"
command: "/tmp/build/hive -sim=optimism/p2p -sim.loglevel=5 -client=go-ethereum,op-geth,op-proposer,op-batcher,op-node,op-contracts |& tee /tmp/build/hive-p2p.log"
- run:
command: "! grep 'pass.*=false' /tmp/build/hive-p2p.log"
- slack/notify:
Expand Down Expand Up @@ -107,12 +155,14 @@ workflows:
jobs:
- go-test
- build
- hive-rpc-tests:
- hive-clients-build:
requires: ["build"]
- hive-rpc-tests:
requires: ["hive-clients-build"]
context: slack
- hive-testnet-tests:
requires: ["build"]
requires: ["hive-clients-build"]
context: slack
- hive-p2p-tests:
requires: ["build"]
requires: ["hive-clients-build"]
context: slack

0 comments on commit 5615e87

Please sign in to comment.