From c0cdaaa7845bec2c8e4f06d419df68f5bd2db188 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Wed, 4 Mar 2026 13:39:47 +0100 Subject: [PATCH] Remove redundant cargo check/test calls from CI scripts - Remove `cargo check` calls that immediately followed `cargo test` with the same crate and features, as `cargo test` already compiles everything that `cargo check` would. - Add `--tests` to `cargo check` calls that precede `cargo test`, so test code is also checked for compilation errors. - Replace per-member `cargo doc` loop with `cargo doc --workspace`. - Move feature-specific `cargo check` for lightning-transaction-sync into the skip branch only, avoiding redundant work when tests run. - Remove redundant `cargo test -p lightning-custom-message` already covered by the workspace-level `cargo test`. - Fix stale "except lightning-transaction-sync" comments, as that crate was moved back into the workspace in b19848e56. AI tools were used in preparing this commit. --- ci/ci-tests-features.sh | 6 ++---- ci/ci-tests-sync.sh | 19 +++++++------------ ci/ci-tests-workspace.sh | 18 +++++------------- 3 files changed, 14 insertions(+), 29 deletions(-) diff --git a/ci/ci-tests-features.sh b/ci/ci-tests-features.sh index f01e7fd8fec..a98a180b49e 100755 --- a/ci/ci-tests-features.sh +++ b/ci/ci-tests-features.sh @@ -4,14 +4,12 @@ set -eox pipefail # shellcheck source=ci/ci-tests-common.sh source "$(dirname "$0")/ci-tests-common.sh" -echo -e "\n\nChecking and testing lightning with features" +echo -e "\n\nTesting lightning with features" cargo test -p lightning --quiet --color always --features dnssec -cargo check -p lightning --quiet --color always --features dnssec cargo doc -p lightning --quiet --document-private-items --features dnssec -echo -e "\n\nChecking and testing lightning-persister with features" +echo -e "\n\nTesting lightning-persister with features" cargo test -p lightning-persister --quiet --color always --features tokio -cargo check -p lightning-persister --quiet --color always --features tokio cargo doc -p lightning-persister --quiet --document-private-items --features tokio echo -e "\n\nTest backtrace-debug builds" diff --git a/ci/ci-tests-sync.sh b/ci/ci-tests-sync.sh index ef836a60413..cbfb04ef8e4 100755 --- a/ci/ci-tests-sync.sh +++ b/ci/ci-tests-sync.sh @@ -4,28 +4,23 @@ set -eox pipefail # shellcheck source=ci/ci-tests-common.sh source "$(dirname "$0")/ci-tests-common.sh" -echo -e "\n\nChecking and testing Block Sync Clients with features" +echo -e "\n\nTesting Block Sync Clients with features" cargo test -p lightning-block-sync --quiet --color always --features rest-client -cargo check -p lightning-block-sync --quiet --color always --features rest-client cargo test -p lightning-block-sync --quiet --color always --features rpc-client -cargo check -p lightning-block-sync --quiet --color always --features rpc-client cargo test -p lightning-block-sync --quiet --color always --features rpc-client,rest-client -cargo check -p lightning-block-sync --quiet --color always --features rpc-client,rest-client cargo test -p lightning-block-sync --quiet --color always --features rpc-client,rest-client,tokio -cargo check -p lightning-block-sync --quiet --color always --features rpc-client,rest-client,tokio - -echo -e "\n\nChecking Transaction Sync Clients with features." -cargo check -p lightning-transaction-sync --quiet --color always --features esplora-blocking -cargo check -p lightning-transaction-sync --quiet --color always --features esplora-async -cargo check -p lightning-transaction-sync --quiet --color always --features esplora-async-https -cargo check -p lightning-transaction-sync --quiet --color always --features electrum if [ -z "$CI_ENV" ] && [[ -z "$BITCOIND_EXE" || -z "$ELECTRS_EXE" ]]; then echo -e "\n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset." - cargo check -p lightning-transaction-sync --tests + cargo check -p lightning-transaction-sync --tests --quiet --color always + cargo check -p lightning-transaction-sync --tests --quiet --color always --features esplora-blocking + cargo check -p lightning-transaction-sync --tests --quiet --color always --features esplora-async + cargo check -p lightning-transaction-sync --tests --quiet --color always --features esplora-async-https + cargo check -p lightning-transaction-sync --tests --quiet --color always --features electrum else echo -e "\n\nTesting Transaction Sync Clients with features." + cargo test -p lightning-transaction-sync --quiet --color always cargo test -p lightning-transaction-sync --quiet --color always --features esplora-blocking cargo test -p lightning-transaction-sync --quiet --color always --features esplora-async cargo test -p lightning-transaction-sync --quiet --color always --features esplora-async-https diff --git a/ci/ci-tests-workspace.sh b/ci/ci-tests-workspace.sh index 3302f075394..7813c05675d 100755 --- a/ci/ci-tests-workspace.sh +++ b/ci/ci-tests-workspace.sh @@ -1,16 +1,13 @@ #!/bin/bash -#shellcheck disable=SC2002,SC2207 set -eox pipefail # shellcheck source=ci/ci-tests-common.sh source "$(dirname "$0")/ci-tests-common.sh" -echo -e "\n\nChecking the workspace, except lightning-transaction-sync." -cargo check --quiet --color always +echo -e "\n\nChecking the workspace." +cargo check --tests --quiet --color always -WORKSPACE_MEMBERS=( $(cat Cargo.toml | tr '\n' '\r' | sed 's/\r //g' | tr '\r' '\n' | grep '^members =' | sed 's/members.*=.*\[//' | tr -d '"' | tr ',' ' ') ) - -echo -e "\n\nTesting the workspace, except lightning-transaction-sync." +echo -e "\n\nTesting the workspace." cargo test --quiet --color always echo -e "\n\nTesting upgrade from prior versions of LDK" @@ -18,14 +15,9 @@ pushd lightning-tests cargo test --quiet popd -echo -e "\n\nChecking and building docs for all workspace members individually..." -for DIR in "${WORKSPACE_MEMBERS[@]}"; do - cargo check -p "$DIR" --quiet --color always - cargo doc -p "$DIR" --quiet --document-private-items -done +echo -e "\n\nBuilding docs for all workspace members." +cargo doc --workspace --quiet --document-private-items -echo -e "\n\nTest Custom Message Macros" -cargo test -p lightning-custom-message --quiet --color always [ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean # Test that we can build downstream code with only the "release pins".