diff --git a/.github/workflows/_setup-e2e.yml b/.github/workflows/_setup-e2e.yml index 317400d58..6af0a0822 100644 --- a/.github/workflows/_setup-e2e.yml +++ b/.github/workflows/_setup-e2e.yml @@ -23,6 +23,7 @@ on: default: "stable-release" env: CACHE_SHARED_KEY: stable-release + STRATUS_PROFILE: ci CACHE_PATH: | ~/.cargo/registry/index/ ~/.cargo/registry/cache/ diff --git a/.github/workflows/build-debug-cache.yml b/.github/workflows/build-debug-cache.yml index e49afa9ca..67c12fece 100644 --- a/.github/workflows/build-debug-cache.yml +++ b/.github/workflows/build-debug-cache.yml @@ -65,8 +65,10 @@ jobs: # importer-offline) the e2e consumers require. run: | source <(cargo llvm-cov show-env --export-prefix) - cargo test --no-run - cargo build --features dev + # --profile ci strips debug symbols from dependencies (stratus itself keeps + # full debug). Consumers run with STRATUS_PROFILE=ci so they hit this cache. + cargo test --no-run --profile ci + cargo build --features dev --profile ci - name: Rust Cache - Save shared key uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 diff --git a/.github/workflows/e2e-contracts-rocks.yml b/.github/workflows/e2e-contracts-rocks.yml index 9f58ed546..dddbf6c70 100644 --- a/.github/workflows/e2e-contracts-rocks.yml +++ b/.github/workflows/e2e-contracts-rocks.yml @@ -31,6 +31,9 @@ on: env: CACHE_SHARED_KEY: stable-release + # Use the `ci` profile (deps stripped of debug symbols; stratus keeps full debug). + # See [profile.ci] in Cargo.toml and profile_flag in the justfile. + STRATUS_PROFILE: ci CACHE_PATH: | ~/.cargo/registry/index/ ~/.cargo/registry/cache/ diff --git a/.github/workflows/e2e-leader-fake-leader.yml b/.github/workflows/e2e-leader-fake-leader.yml index 0df887fc4..1b64c0f30 100644 --- a/.github/workflows/e2e-leader-fake-leader.yml +++ b/.github/workflows/e2e-leader-fake-leader.yml @@ -31,6 +31,9 @@ on: env: CACHE_SHARED_KEY: stable-release + # Use the `ci` profile (deps stripped of debug symbols; stratus keeps full debug). + # See [profile.ci] in Cargo.toml and profile_flag in the justfile. + STRATUS_PROFILE: ci CACHE_PATH: | ~/.cargo/registry/index/ ~/.cargo/registry/cache/ diff --git a/.github/workflows/e2e-leader-follower.yml b/.github/workflows/e2e-leader-follower.yml index a75b737b2..e9c6f350c 100644 --- a/.github/workflows/e2e-leader-follower.yml +++ b/.github/workflows/e2e-leader-follower.yml @@ -31,6 +31,9 @@ on: env: CACHE_SHARED_KEY: stable-release + # Use the `ci` profile (deps stripped of debug symbols; stratus keeps full debug). + # See [profile.ci] in Cargo.toml and profile_flag in the justfile. + STRATUS_PROFILE: ci CACHE_PATH: | ~/.cargo/registry/index/ ~/.cargo/registry/cache/ diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index e79b69cb5..128c62297 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -30,6 +30,9 @@ on: env: CACHE_SHARED_KEY: stable-release + # Use the `ci` profile (deps stripped of debug symbols; stratus keeps full debug). + # See [profile.ci] in Cargo.toml and profile_flag in the justfile. + STRATUS_PROFILE: ci CACHE_PATH: | ~/.cargo/registry/index/ ~/.cargo/registry/cache/ diff --git a/Cargo.toml b/Cargo.toml index 440f3ce74..62c423083 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -262,5 +262,13 @@ expect_used = "warn" panic = "warn" +# CI-only profile: strips debug symbols from dependencies to keep the shared +# `stable-release` cache small, while keeping full debug info for stratus itself. +[profile.ci] +inherits = "dev" + +[profile.ci.package."*"] +debug = false + [profile.release] lto = "fat" diff --git a/justfile b/justfile index 2fa59d049..bb70527e3 100644 --- a/justfile +++ b/justfile @@ -8,6 +8,7 @@ export CARGO_COMMAND := env("CARGO_COMMAND", "") # Global arguments that can be passed to receipts. nightly_flag := if env("NIGHTLY", "") =~ "(true|1)" { "+nightly" } else { "" } release_flag := if env("RELEASE", "") =~ "(true|1)" { "--release" } else { "" } +profile_flag := if env("STRATUS_PROFILE", "") != "" { "--profile " + env("STRATUS_PROFILE", "") } else { "" } database_url := env("DATABASE_URL", "postgres://postgres:123@0.0.0.0:5432/stratus") # Project: Show available tasks @@ -110,8 +111,8 @@ stratus-test *args="": FEATURES="dev,replication" fi echo "leader features: " $FEATURES - cargo build --features $FEATURES - cargo run --bin stratus --features $FEATURES -- --leader --rocks-cf-size-metrics-interval 30s {{args}} > stratus.log & + cargo build {{profile_flag}} --features $FEATURES + cargo run {{profile_flag}} --bin stratus --features $FEATURES -- --leader --rocks-cf-size-metrics-interval 30s {{args}} > stratus.log & just _wait_for_stratus # Bin: Stratus main service as leader while performing memory-profiling, producing a heap dump every 2^32 allocated bytes (~4gb) @@ -134,8 +135,8 @@ stratus-follower-test *args="": FEATURES="dev,replication" fi echo "follower features: " $FEATURES - cargo build --features $FEATURES - LOCAL_ENV_PATH=config/stratus-follower.env.local cargo run --bin stratus --features $FEATURES -- --follower --rocks-cf-size-metrics-interval 30s {{args}} -a 0.0.0.0:3001 > stratus_follower.log & + cargo build {{profile_flag}} --features $FEATURES + LOCAL_ENV_PATH=config/stratus-follower.env.local cargo run {{profile_flag}} --bin stratus --features $FEATURES -- --follower --rocks-cf-size-metrics-interval 30s {{args}} -a 0.0.0.0:3001 > stratus_follower.log & just _wait_for_stratus 3001 # Bin: Stratus main service as fake leader (imports blocks like a follower, executes/mines locally like a leader) @@ -144,8 +145,8 @@ stratus-fake-leader-test *args="": source <(just coverage-env) FEATURES="dev" echo "fake-leader features: " $FEATURES - cargo build --features $FEATURES - LOCAL_ENV_PATH=config/stratus-follower.env.local cargo run --bin stratus --features $FEATURES -- --fake-leader --rocks-cf-size-metrics-interval 30s {{args}} -a 0.0.0.0:3001 > stratus_fake_leader.log & + cargo build {{profile_flag}} --features $FEATURES + LOCAL_ENV_PATH=config/stratus-follower.env.local cargo run {{profile_flag}} --bin stratus --features $FEATURES -- --fake-leader --rocks-cf-size-metrics-interval 30s {{args}} -a 0.0.0.0:3001 > stratus_fake_leader.log & just _wait_for_stratus 3001 # Bin: Download external RPC blocks and receipts to temporary storage @@ -155,8 +156,8 @@ rpc-downloader *args="": rpc-downloader-test *args="": #!/bin/bash source <(just coverage-env) - cargo build - cargo run --bin rpc-downloader -- {{args}} > rpc-downloader.log + cargo build {{profile_flag}} + cargo run {{profile_flag}} --bin rpc-downloader -- {{args}} > rpc-downloader.log # Bin: Import external RPC blocks from temporary storage to Stratus storage importer-offline *args="": @@ -165,8 +166,8 @@ importer-offline *args="": importer-offline-test *args="": #!/bin/bash source <(just coverage-env) - cargo build - cargo run --bin importer-offline -- {{args}} --rocks-file-descriptors-limit=65536 > importer-offline.log + cargo build {{profile_flag}} + cargo run {{profile_flag}} --bin importer-offline -- {{args}} --rocks-file-descriptors-limit=65536 > importer-offline.log # ------------------------------------------------------------------------------ # Test tasks @@ -175,11 +176,11 @@ importer-offline-test *args="": test: #!/bin/bash source <(just coverage-env) - cargo test + cargo test {{profile_flag}} if command -v cargo-llvm-cov >/dev/null 2>&1; then mkdir -p target/llvm-cov/reports - cargo llvm-cov report --html --ignore-filename-regex data_migration.rs - cargo llvm-cov report --lcov --output-path target/llvm-cov/reports/rust_tests.info --ignore-filename-regex data_migration.rs + cargo llvm-cov report {{profile_flag}} --html --ignore-filename-regex data_migration.rs + cargo llvm-cov report {{profile_flag}} --lcov --output-path target/llvm-cov/reports/rust_tests.info --ignore-filename-regex data_migration.rs fi @@ -205,8 +206,8 @@ run-test recipe="" *args="": if command -v cargo-llvm-cov >/dev/null 2>&1; then echo "Generating reports" mkdir -p target/llvm-cov/reports - cargo llvm-cov report --html --ignore-filename-regex data_migration.rs - cargo llvm-cov report --lcov --output-path target/llvm-cov/reports/{{recipe}}.info --ignore-filename-regex data_migration.rs + cargo llvm-cov report {{profile_flag}} --html --ignore-filename-regex data_migration.rs + cargo llvm-cov report {{profile_flag}} --lcov --output-path target/llvm-cov/reports/{{recipe}}.info --ignore-filename-regex data_migration.rs fi exit $result_code