From 5615e873b6a9ae6b40e21954bf31175e120c8f4d Mon Sep 17 00:00:00 2001 From: protolambda Date: Fri, 12 Aug 2022 00:31:49 +0200 Subject: [PATCH] circleci: build docker images once, save for other jobs --- .circleci/config.yml | 64 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index aa46331ee5..4da0b3d514 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: @@ -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: @@ -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: @@ -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