Skip to content

Wire up hive tests to CI #117

Description

@ArtiomTr

Would be nice to run hive tests on CI. To do this, start from makefile target - test-hive.

I don't have deep understanding in hive, but in my understanding, you roughly have to do something like this:

# Hive version to use
HIVE_VERSION ?= <commit_hash>

# we define the test-hive target, with two dependencies:
#   * ./hive/hive  - a hive binary, that will be built from source;
#   * docker-local - local docker image for grandine.
.PHONY: test-hive
test-hive: ./hive/hive docker-local
  # TODO: run hive here

# define a hive binary, that is being built from source. Notice that it is not defined as .PHONY target,
# because we point to a real binary, to utilize make caching.
./hive/hive:
  git clone https://github.com/ethereum/hive --depth 1 # do a shallow clone
  @cd hive && git switch $(HIVE_VERSION) # switch to necessary version
  @cd hive && go build ... # build hive binary

So as a result, you should get a test-hive makefile target, so you can run hive locally via:

make test-hive

Please don't forget to double-check if caching works properly - in general, hive shouldn't be rebuilt itself, unless HIVE_VERSION changes (or someone clears hive directory by themselves).

After test-hive makefile target works properly, create a github workflow file at .github/workflows/hive.yaml. This workflow will just checkout current repo, then run make test-hive.

Checklist

Self-check your solution before submitting:

  • Verify make test-hive works, on a clean repo checkout, without additional setup (apart from system installation, like go toolchain);
  • Verify that running make test-hive second time doesn't rebuild hive itself;
  • Verify that running make test-hive HIVE_VERSION=<some_other_commit_hash> rebuilds hive properly and re-runs tests;
  • Verify that modifying code in grandine (you can just insert some print in ./lean_client/src/main.rs`) rebuilds docker image and re-runs hive tests;
  • Verify that your script runs all hive tests, available for grandine lean client;
  • Verify your CI works (not necessarily passes, just runs tests) on your own fork;
  • Verify that make clean cleans up hive directory;
  • Don't forget to update README.md - include section what needs to be installed (probably only go toolchain) for running hive tests, and how to run them.

Don't forget to copy-paste this checklist into your PR, and tick all the boxes.

Recommendations

You can check how zeam have configured their CI pipeline. Also, feel free to use AI tools for this task.

Also, please avoid external script files (separate .bash/.sh files) - try to keep all configuration inside of single Makefile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions