2019-10-02 01:04:56 +00:00
|
|
|
.PHONY: tests
|
2019-09-07 18:19:54 +00:00
|
|
|
|
2020-05-18 11:24:23 +00:00
|
|
|
EF_TESTS = "testing/ef_tests"
|
|
|
|
STATE_TRANSITION_VECTORS = "testing/state_transition_vectors"
|
2022-02-17 21:47:06 +00:00
|
|
|
EXECUTION_ENGINE_INTEGRATION = "testing/execution_engine_integration"
|
2020-08-14 22:24:27 +00:00
|
|
|
GIT_TAG := $(shell git describe --tags --candidates 1)
|
|
|
|
BIN_DIR = "bin"
|
|
|
|
|
|
|
|
X86_64_TAG = "x86_64-unknown-linux-gnu"
|
|
|
|
BUILD_PATH_X86_64 = "target/$(X86_64_TAG)/release"
|
|
|
|
AARCH64_TAG = "aarch64-unknown-linux-gnu"
|
|
|
|
BUILD_PATH_AARCH64 = "target/$(AARCH64_TAG)/release"
|
2019-09-07 18:19:54 +00:00
|
|
|
|
2021-03-04 00:00:51 +00:00
|
|
|
PINNED_NIGHTLY ?= nightly
|
2022-06-10 04:29:27 +00:00
|
|
|
CLIPPY_PINNED_NIGHTLY=nightly-2022-05-19
|
2021-03-04 00:00:51 +00:00
|
|
|
|
2023-01-20 04:19:29 +00:00
|
|
|
# List of features to use when building natively. Can be overriden via the environment.
|
|
|
|
# No jemalloc on Windows
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
FEATURES?=
|
|
|
|
else
|
|
|
|
FEATURES?=jemalloc
|
|
|
|
endif
|
|
|
|
|
2022-08-15 01:30:56 +00:00
|
|
|
# List of features to use when cross-compiling. Can be overridden via the environment.
|
2023-01-20 04:19:29 +00:00
|
|
|
CROSS_FEATURES ?= gnosis,slasher-lmdb,slasher-mdbx,jemalloc
|
2022-08-15 01:30:56 +00:00
|
|
|
|
2022-09-29 06:13:33 +00:00
|
|
|
# Cargo profile for Cross builds. Default is for local builds, CI uses an override.
|
|
|
|
CROSS_PROFILE ?= release
|
|
|
|
|
2022-11-14 19:14:31 +00:00
|
|
|
# List of features to use when running EF tests.
|
2023-01-12 04:15:08 +00:00
|
|
|
EF_TEST_FEATURES ?=
|
2022-11-14 19:14:31 +00:00
|
|
|
|
2022-09-29 06:13:33 +00:00
|
|
|
# Cargo profile for regular builds.
|
|
|
|
PROFILE ?= release
|
|
|
|
|
2021-10-16 05:07:23 +00:00
|
|
|
# List of all hard forks. This list is used to set env variables for several tests so that
|
|
|
|
# they run for different forks.
|
2023-03-26 15:49:16 +00:00
|
|
|
FORKS=phase0 altair merge capella deneb
|
2021-10-16 05:07:23 +00:00
|
|
|
|
2023-02-28 02:20:49 +00:00
|
|
|
# Extra flags for Cargo
|
|
|
|
CARGO_INSTALL_EXTRA_FLAGS?=
|
|
|
|
|
2020-04-19 02:20:43 +00:00
|
|
|
# Builds the Lighthouse binary in release (optimized).
|
2019-10-02 01:04:56 +00:00
|
|
|
#
|
|
|
|
# Binaries will most likely be found in `./target/release`
|
2019-11-25 04:48:24 +00:00
|
|
|
install:
|
2023-02-28 02:20:49 +00:00
|
|
|
cargo install --path lighthouse --force --locked \
|
|
|
|
--features "$(FEATURES)" \
|
|
|
|
--profile "$(PROFILE)" \
|
|
|
|
$(CARGO_INSTALL_EXTRA_FLAGS)
|
2020-04-19 02:20:43 +00:00
|
|
|
|
|
|
|
# Builds the lcli binary in release (optimized).
|
|
|
|
install-lcli:
|
2023-02-28 02:20:49 +00:00
|
|
|
cargo install --path lcli --force --locked \
|
|
|
|
--features "$(FEATURES)" \
|
|
|
|
--profile "$(PROFILE)" \
|
|
|
|
$(CARGO_INSTALL_EXTRA_FLAGS)
|
2019-09-07 18:19:54 +00:00
|
|
|
|
2020-08-11 05:16:30 +00:00
|
|
|
# The following commands use `cross` to build a cross-compile.
|
|
|
|
#
|
|
|
|
# These commands require that:
|
|
|
|
#
|
|
|
|
# - `cross` is installed (`cargo install cross`).
|
|
|
|
# - Docker is running.
|
|
|
|
# - The current user is in the `docker` group.
|
|
|
|
#
|
|
|
|
# The resulting binaries will be created in the `target/` directory.
|
|
|
|
#
|
|
|
|
# The *-portable options compile the blst library *without* the use of some
|
|
|
|
# optimized CPU functions that may not be available on some systems. This
|
|
|
|
# results in a more portable binary with ~20% slower BLS verification.
|
|
|
|
build-x86_64:
|
2023-08-24 05:54:38 +00:00
|
|
|
cross build --bin lighthouse --target x86_64-unknown-linux-gnu --features "modern,$(CROSS_FEATURES)" --profile "$(CROSS_PROFILE)" --locked
|
2020-08-11 05:16:30 +00:00
|
|
|
build-x86_64-portable:
|
2023-08-24 05:54:38 +00:00
|
|
|
cross build --bin lighthouse --target x86_64-unknown-linux-gnu --features "portable,$(CROSS_FEATURES)" --profile "$(CROSS_PROFILE)" --locked
|
2020-08-11 05:16:30 +00:00
|
|
|
build-aarch64:
|
2023-08-24 05:54:38 +00:00
|
|
|
cross build --bin lighthouse --target aarch64-unknown-linux-gnu --features "$(CROSS_FEATURES)" --profile "$(CROSS_PROFILE)" --locked
|
2020-08-11 05:16:30 +00:00
|
|
|
build-aarch64-portable:
|
2023-08-24 05:54:38 +00:00
|
|
|
cross build --bin lighthouse --target aarch64-unknown-linux-gnu --features "portable,$(CROSS_FEATURES)" --profile "$(CROSS_PROFILE)" --locked
|
2020-08-11 05:16:30 +00:00
|
|
|
|
2020-08-14 22:24:27 +00:00
|
|
|
# Create a `.tar.gz` containing a binary for a specific target.
|
|
|
|
define tarball_release_binary
|
|
|
|
cp $(1)/lighthouse $(BIN_DIR)/lighthouse
|
|
|
|
cd $(BIN_DIR) && \
|
|
|
|
tar -czf lighthouse-$(GIT_TAG)-$(2)$(3).tar.gz lighthouse && \
|
|
|
|
rm lighthouse
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Create a series of `.tar.gz` files in the BIN_DIR directory, each containing
|
|
|
|
# a `lighthouse` binary for a different target.
|
|
|
|
#
|
|
|
|
# The current git tag will be used as the version in the output file names. You
|
|
|
|
# will likely need to use `git tag` and create a semver tag (e.g., `v0.2.3`).
|
|
|
|
build-release-tarballs:
|
|
|
|
[ -d $(BIN_DIR) ] || mkdir -p $(BIN_DIR)
|
|
|
|
$(MAKE) build-x86_64
|
|
|
|
$(call tarball_release_binary,$(BUILD_PATH_X86_64),$(X86_64_TAG),"")
|
|
|
|
$(MAKE) build-x86_64-portable
|
|
|
|
$(call tarball_release_binary,$(BUILD_PATH_X86_64),$(X86_64_TAG),"-portable")
|
|
|
|
$(MAKE) build-aarch64
|
|
|
|
$(call tarball_release_binary,$(BUILD_PATH_AARCH64),$(AARCH64_TAG),"")
|
|
|
|
$(MAKE) build-aarch64-portable
|
|
|
|
$(call tarball_release_binary,$(BUILD_PATH_AARCH64),$(AARCH64_TAG),"-portable")
|
|
|
|
|
2019-11-25 04:48:24 +00:00
|
|
|
# Runs the full workspace tests in **release**, without downloading any additional
|
|
|
|
# test vectors.
|
|
|
|
test-release:
|
2023-07-14 19:59:15 +00:00
|
|
|
cargo test --workspace --release --exclude ef_tests --exclude beacon_chain --exclude slasher --exclude network
|
2019-11-25 04:48:24 +00:00
|
|
|
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
# Runs the full workspace tests in **release**, without downloading any additional
|
|
|
|
# test vectors, using nextest.
|
|
|
|
nextest-release:
|
2023-10-05 05:38:06 +00:00
|
|
|
cargo nextest run --workspace --release --exclude ef_tests --exclude beacon_chain --exclude slasher --exclude network
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
|
2019-11-25 04:48:24 +00:00
|
|
|
# Runs the full workspace tests in **debug**, without downloading any additional test
|
2019-10-02 01:04:56 +00:00
|
|
|
# vectors.
|
2019-11-25 04:48:24 +00:00
|
|
|
test-debug:
|
2023-07-14 19:59:15 +00:00
|
|
|
cargo test --workspace --exclude ef_tests --exclude beacon_chain --exclude network
|
2019-10-29 16:58:39 +00:00
|
|
|
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
# Runs the full workspace tests in **debug**, without downloading any additional test
|
|
|
|
# vectors, using nextest.
|
|
|
|
nextest-debug:
|
2023-10-05 05:38:06 +00:00
|
|
|
cargo nextest run --workspace --exclude ef_tests --exclude beacon_chain --exclude network
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
|
2019-11-25 04:48:24 +00:00
|
|
|
# Runs cargo-fmt (linter).
|
|
|
|
cargo-fmt:
|
|
|
|
cargo fmt --all -- --check
|
2019-10-29 16:58:39 +00:00
|
|
|
|
2020-04-06 10:16:08 +00:00
|
|
|
# Typechecks benchmark code
|
|
|
|
check-benches:
|
2021-07-09 06:15:32 +00:00
|
|
|
cargo check --workspace --benches
|
2020-04-06 10:16:08 +00:00
|
|
|
|
2019-11-25 04:48:24 +00:00
|
|
|
# Runs only the ef-test vectors.
|
|
|
|
run-ef-tests:
|
2021-07-09 06:15:32 +00:00
|
|
|
rm -rf $(EF_TESTS)/.accessed_file_log.txt
|
2022-11-14 19:14:31 +00:00
|
|
|
cargo test --release -p ef_tests --features "ef_tests,$(EF_TEST_FEATURES)"
|
|
|
|
cargo test --release -p ef_tests --features "ef_tests,$(EF_TEST_FEATURES),fake_crypto"
|
|
|
|
cargo test --release -p ef_tests --features "ef_tests,$(EF_TEST_FEATURES),milagro"
|
2021-09-25 05:58:35 +00:00
|
|
|
./$(EF_TESTS)/check_all_files_accessed.py $(EF_TESTS)/.accessed_file_log.txt $(EF_TESTS)/consensus-spec-tests
|
2021-07-09 06:15:32 +00:00
|
|
|
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
# Runs EF test vectors with nextest
|
|
|
|
nextest-run-ef-tests:
|
|
|
|
rm -rf $(EF_TESTS)/.accessed_file_log.txt
|
|
|
|
cargo nextest run --release -p ef_tests --features "ef_tests,$(EF_TEST_FEATURES)"
|
|
|
|
cargo nextest run --release -p ef_tests --features "ef_tests,$(EF_TEST_FEATURES),fake_crypto"
|
|
|
|
cargo nextest run --release -p ef_tests --features "ef_tests,$(EF_TEST_FEATURES),milagro"
|
|
|
|
./$(EF_TESTS)/check_all_files_accessed.py $(EF_TESTS)/.accessed_file_log.txt $(EF_TESTS)/consensus-spec-tests
|
|
|
|
|
2021-10-16 05:07:23 +00:00
|
|
|
# Run the tests in the `beacon_chain` crate for all known forks.
|
|
|
|
test-beacon-chain: $(patsubst %,test-beacon-chain-%,$(FORKS))
|
2021-07-09 06:15:32 +00:00
|
|
|
|
|
|
|
test-beacon-chain-%:
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
env FORK_NAME=$* cargo nextest run --release --features fork_from_env,slasher/lmdb -p beacon_chain
|
2019-10-29 16:58:39 +00:00
|
|
|
|
2021-10-16 05:07:23 +00:00
|
|
|
# Run the tests in the `operation_pool` crate for all known forks.
|
|
|
|
test-op-pool: $(patsubst %,test-op-pool-%,$(FORKS))
|
|
|
|
|
|
|
|
test-op-pool-%:
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
env FORK_NAME=$* cargo nextest run --release \
|
2021-10-16 05:07:23 +00:00
|
|
|
--features 'beacon_chain/fork_from_env'\
|
2022-01-31 22:55:03 +00:00
|
|
|
-p operation_pool
|
2021-10-16 05:07:23 +00:00
|
|
|
|
2023-07-14 19:59:15 +00:00
|
|
|
# Run the tests in the `network` crate for all known forks.
|
|
|
|
test-network: $(patsubst %,test-network-%,$(FORKS))
|
2023-06-15 16:59:10 +00:00
|
|
|
|
2023-07-14 19:59:15 +00:00
|
|
|
test-network-%:
|
2023-10-05 04:21:18 +00:00
|
|
|
env FORK_NAME=$* cargo nextest run --release \
|
2023-07-14 19:59:15 +00:00
|
|
|
--features 'fork_from_env' \
|
2023-06-15 16:59:10 +00:00
|
|
|
-p network
|
2023-07-14 19:59:15 +00:00
|
|
|
|
2022-08-15 01:30:56 +00:00
|
|
|
# Run the tests in the `slasher` crate for all supported database backends.
|
|
|
|
test-slasher:
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
cargo nextest run --release -p slasher --features lmdb
|
|
|
|
cargo nextest run --release -p slasher --no-default-features --features mdbx
|
|
|
|
cargo nextest run --release -p slasher --features lmdb,mdbx # both backends enabled
|
2022-08-15 01:30:56 +00:00
|
|
|
|
2020-05-08 23:37:21 +00:00
|
|
|
# Runs only the tests/state_transition_vectors tests.
|
|
|
|
run-state-transition-tests:
|
|
|
|
make -C $(STATE_TRANSITION_VECTORS) test
|
|
|
|
|
2019-11-25 04:48:24 +00:00
|
|
|
# Downloads and runs the EF test vectors.
|
2019-10-30 09:42:32 +00:00
|
|
|
test-ef: make-ef-tests run-ef-tests
|
2019-09-07 18:19:54 +00:00
|
|
|
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
# Downloads and runs the EF test vectors with nextest.
|
|
|
|
nextest-ef: make-ef-tests nextest-run-ef-tests
|
|
|
|
|
2022-02-17 21:47:06 +00:00
|
|
|
# Runs tests checking interop between Lighthouse and execution clients.
|
|
|
|
test-exec-engine:
|
|
|
|
make -C $(EXECUTION_ENGINE_INTEGRATION) test
|
|
|
|
|
2019-11-25 04:48:24 +00:00
|
|
|
# Runs the full workspace tests in release, without downloading any additional
|
|
|
|
# test vectors.
|
|
|
|
test: test-release
|
2019-10-29 16:58:39 +00:00
|
|
|
|
2019-11-25 04:48:24 +00:00
|
|
|
# Runs the entire test suite, downloading test vectors if required.
|
2022-02-17 21:47:06 +00:00
|
|
|
test-full: cargo-fmt test-release test-debug test-ef test-exec-engine
|
2019-09-07 18:19:54 +00:00
|
|
|
|
2020-04-20 02:35:11 +00:00
|
|
|
# Lints the code for bad style and potentially unsafe arithmetic using Clippy.
|
2020-06-25 14:04:08 +00:00
|
|
|
# Clippy lints are opt-in per-crate for now. By default, everything is allowed except for performance and correctness lints.
|
2020-04-20 02:35:11 +00:00
|
|
|
lint:
|
2023-06-22 02:14:58 +00:00
|
|
|
cargo clippy --workspace --tests $(EXTRA_CLIPPY_OPTS) -- \
|
2022-01-31 22:55:03 +00:00
|
|
|
-D clippy::fn_to_numeric_cast_any \
|
|
|
|
-D warnings \
|
2022-08-12 00:56:39 +00:00
|
|
|
-A clippy::derive_partial_eq_without_eq \
|
2022-01-31 22:55:03 +00:00
|
|
|
-A clippy::from-over-into \
|
|
|
|
-A clippy::upper-case-acronyms \
|
2022-09-23 03:52:46 +00:00
|
|
|
-A clippy::vec-init-then-push \
|
2023-01-27 09:48:42 +00:00
|
|
|
-A clippy::question-mark \
|
|
|
|
-A clippy::uninlined-format-args
|
2020-04-20 02:35:11 +00:00
|
|
|
|
2023-06-22 02:14:58 +00:00
|
|
|
# Lints the code using Clippy and automatically fix some simple compiler warnings.
|
|
|
|
lint-fix:
|
|
|
|
EXTRA_CLIPPY_OPTS="--fix --allow-staged --allow-dirty" $(MAKE) lint
|
|
|
|
|
2022-06-10 04:29:27 +00:00
|
|
|
nightly-lint:
|
|
|
|
cp .github/custom/clippy.toml .
|
2022-07-12 15:54:17 +00:00
|
|
|
cargo +$(CLIPPY_PINNED_NIGHTLY) clippy --workspace --tests --release -- \
|
2022-06-10 04:29:27 +00:00
|
|
|
-A clippy::all \
|
|
|
|
-D clippy::disallowed_from_async
|
|
|
|
rm clippy.toml
|
|
|
|
|
2019-10-02 01:04:56 +00:00
|
|
|
# Runs the makefile in the `ef_tests` repo.
|
|
|
|
#
|
|
|
|
# May download and extract an archive of test vectors from the ethereum
|
|
|
|
# repositories. At the time of writing, this was several hundred MB of
|
|
|
|
# downloads which extracts into several GB of test vectors.
|
|
|
|
make-ef-tests:
|
|
|
|
make -C $(EF_TESTS)
|
2019-09-07 18:19:54 +00:00
|
|
|
|
2022-01-04 20:46:44 +00:00
|
|
|
# Verifies that crates compile with fuzzing features enabled
|
2020-05-05 23:12:28 +00:00
|
|
|
arbitrary-fuzz:
|
2022-01-04 20:46:44 +00:00
|
|
|
cargo check -p state_processing --features arbitrary-fuzz
|
|
|
|
cargo check -p slashing_protection --features arbitrary-fuzz
|
2020-05-05 23:12:28 +00:00
|
|
|
|
2020-05-26 07:04:39 +00:00
|
|
|
# Runs cargo audit (Audit Cargo.lock files for crates with security vulnerabilities reported to the RustSec Advisory Database)
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
audit: install-audit audit-CI
|
|
|
|
|
|
|
|
install-audit:
|
2023-08-28 00:55:28 +00:00
|
|
|
cargo install --force cargo-audit
|
Ultra Fast Super Slick CI (#4755)
Attempting to improve our CI speeds as its recently been a pain point.
Major changes:
- Use a github action to pull stable/nightly rust rather than building it each run
- Shift test suite to `nexttest` https://github.com/nextest-rs/nextest for CI
UPDATE:
So I've iterated on some changes, and although I think its still not optimal I think this is a good base to start from. Some extra things in this PR:
- Shifted where we pull rust from. We're now using this thing: https://github.com/moonrepo/setup-rust . It's got some interesting cache's built in, but was not seeing the gains that Jimmy managed to get. In either case tho, it can pull rust, cargofmt, clippy, cargo nexttest all in < 5s. So I think it's worthwhile.
- I've grouped a few of the check-like tests into a single test called `code-test`. Although we were using github runners in parallel which may be faster, it just seems wasteful. There were like 4-5 tests, where we would pull lighthouse, compile it, then run an action, like clippy, cargo-audit or fmt. I've grouped these into a single action, so we only compile lighthouse once, then in each step we run the checks. This avoids compiling lighthouse like 5 times.
- Ive made doppelganger tests run on our local machines to avoid pulling foundry, building and making lcli which are all now baked into the images.
- We have sccache and do not incremental compile lighthouse
Misc bonus things:
- Cargo update
- Fix web3 signer openssl keys which is required after a cargo update
- Use mock_instant in an LRU cache test to avoid non-deterministic test
- Remove race condition in building web3signer tests
There's still some things we could improve on. Such as downloading the EF tests every run and the web3-signer binary, but I've left these to be out of scope of this PR. I think the above are meaningful improvements.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: antondlr <anton@delaruelle.net>
2023-10-03 06:33:15 +00:00
|
|
|
|
|
|
|
audit-CI:
|
2023-09-22 04:30:56 +00:00
|
|
|
cargo audit
|
2020-05-26 07:04:39 +00:00
|
|
|
|
2021-11-05 04:42:12 +00:00
|
|
|
# Runs `cargo vendor` to make sure dependencies can be vendored for packaging, reproducibility and archival purpose.
|
|
|
|
vendor:
|
|
|
|
cargo vendor
|
|
|
|
|
2020-06-14 00:59:50 +00:00
|
|
|
# Runs `cargo udeps` to check for unused dependencies
|
|
|
|
udeps:
|
2021-03-04 00:00:51 +00:00
|
|
|
cargo +$(PINNED_NIGHTLY) udeps --tests --all-targets --release
|
2020-06-14 00:59:50 +00:00
|
|
|
|
2019-10-02 01:04:56 +00:00
|
|
|
# Performs a `cargo` clean and cleans the `ef_tests` directory.
|
|
|
|
clean:
|
|
|
|
cargo clean
|
|
|
|
make -C $(EF_TESTS) clean
|
2020-05-08 23:37:21 +00:00
|
|
|
make -C $(STATE_TRANSITION_VECTORS) clean
|