Skip to content

Commit

Permalink
fix: Doc tests re-enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
dhedey committed Sep 1, 2024
1 parent 692a104 commit 95f897a
Show file tree
Hide file tree
Showing 142 changed files with 488 additions and 298 deletions.
70 changes: 61 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ on:
- release\/*
pull_request:

# NOTES:
# - nextest doesn't run doc tests, so we run them separately explicitly. See:
# https://github.com/nextest-rs/nextest/issues/16
# - We run tests from different crates separately for better parallelism
# - The following are run on demand, so aren't tested here:
# > radix-engine-monkey-tests
# > radix-engine-profiling-derive
# > radix-engine-profiling

env:
CARGO_TERM_COLOR: always
SCRYPTO_CARGO_LOCKED: 1
Expand Down Expand Up @@ -55,11 +64,11 @@ jobs:
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Run tests
run: cargo nextest run -p sbor --no-fail-fast --locked
run: cargo nextest run -p sbor -p radix-rust -p sbor-derive -p sbor-derive-common --no-fail-fast --locked
- name: Run doc tests
run: cargo test --doc -p sbor -p radix-rust -p sbor-derive -p sbor-derive-common --no-fail-fast --locked
- name: Run tests (no_std)
run: cargo nextest run -p sbor --no-default-features --features alloc --no-fail-fast --locked
- name: Run derive tests
run: cargo nextest run -p sbor-derive-common --no-fail-fast --locked
run: cargo nextest run -p sbor -p radix-rust --no-default-features --features alloc --no-fail-fast --locked

sbor-integration-tests:
name: Run SBOR integration tests
Expand All @@ -70,6 +79,8 @@ jobs:
uses: ./.github/actions/setup-env
- name: Run tests
run: cargo nextest run -p sbor-tests --no-fail-fast --locked
- name: Run doc tests
run: cargo test --doc -p sbor-tests --no-fail-fast --locked
- name: Run tests (no_std)
run: cargo nextest run -p sbor-tests --no-default-features --features alloc --no-fail-fast --locked
- name: Run bench
Expand All @@ -83,13 +94,15 @@ jobs:
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Run tests
run: cargo nextest run -p scrypto --no-fail-fast --locked
run: cargo nextest run -p scrypto -p scrypto-bindgen --no-fail-fast --locked
- name: Run doc tests
run: cargo test --doc -p scrypto -p scrypto-bindgen --no-fail-fast --locked
- name: Run tests (no_std)
run: cargo nextest run -p scrypto --no-default-features --features alloc --no-fail-fast --locked
- name: Run abi tests
run: cargo nextest run -p radix-blueprint-schema-init --no-fail-fast --locked
- name: Run derive tests
run: cargo nextest run -p scrypto-derive --no-fail-fast --locked
- name: Run doc tests
run: cargo test --doc -p radix-blueprint-schema-init --no-fail-fast --locked

scrypto-derive-tests:
name: Run Scrypto derive tests
Expand All @@ -98,8 +111,10 @@ jobs:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Run tests
run: cargo nextest run -p scrypto-derive-tests --no-fail-fast --locked
- name: Run derive tests
run: cargo nextest run -p scrypto-derive -p scrypto-derive-tests --no-fail-fast --locked
- name: Run doc tests
run: cargo test --doc -p scrypto-derive -p scrypto-derive-tests --no-fail-fast --locked
- name: Run tests with no_std
run: cargo nextest run -p scrypto-derive-tests --no-default-features --features alloc --no-fail-fast --locked

Expand All @@ -112,6 +127,8 @@ jobs:
uses: ./.github/actions/setup-env
- name: Run tests
run: cargo nextest run -p scrypto-compiler --no-fail-fast --locked
- name: Run doc tests
run: cargo test --doc -p scrypto-compiler --no-fail-fast --locked

radix-engine-toolkit-tests:
name: Run Radix Engine Toolkit tests
Expand All @@ -122,6 +139,8 @@ jobs:
uses: ./.github/actions/setup-env
- name: Run tests
run: cargo nextest run -p radix-engine-toolkit --no-fail-fast --locked
- name: Run doc tests
run: cargo test --doc -p radix-engine-toolkit --no-fail-fast --locked

scrypto-examples:
name: Run Scrypto examples
Expand Down Expand Up @@ -180,12 +199,31 @@ jobs:
run: |
cargo nextest run \
-p radix-common \
-p radix-common-derive \
-p radix-native-sdk \
-p radix-sbor-derive \
-p radix-engine-interface \
-p radix-engine \
-p radix-substate-store-impls \
-p radix-substate-store-interface \
-p radix-substate-store-queries \
-p radix-engine-tests \
--no-fail-fast --locked
./check_stack_usage.sh
- name: Run doc tests
run: |
cargo test --doc \
-p radix-common \
-p radix-common-derive \
-p radix-native-sdk \
-p radix-sbor-derive \
-p radix-engine-interface \
-p radix-engine \
-p radix-substate-store-impls \
-p radix-substate-store-interface \
-p radix-substate-store-queries \
-p radix-engine-tests \
--no-fail-fast --locked
radix-engine-release:
# Run tests in release variant.
Expand All @@ -204,9 +242,14 @@ jobs:
cargo nextest run \
--release \
-p radix-common \
-p radix-common-derive \
-p radix-native-sdk \
-p radix-sbor-derive \
-p radix-engine-interface \
-p radix-engine \
-p radix-substate-store-impls \
-p radix-substate-store-interface \
-p radix-substate-store-queries \
-p radix-engine-tests \
--no-fail-fast --locked
Expand All @@ -223,6 +266,8 @@ jobs:
--no-default-features \
--features alloc \
-p radix-common \
-p radix-common-derive \
-p radix-native-sdk \
-p radix-sbor-derive \
-p radix-engine-interface \
-p radix-engine \
Expand Down Expand Up @@ -260,6 +305,8 @@ jobs:
uses: ./.github/actions/setup-env
- name: Run tests
run: cargo nextest run -p radix-transactions --no-fail-fast --locked
- name: Run doc tests
run: cargo test --doc -p radix-transactions --no-fail-fast --locked

radix-transaction-scenarios:
name: Run transaction scenarios
Expand All @@ -270,6 +317,8 @@ jobs:
uses: ./.github/actions/setup-env
- name: Run tests
run: cargo nextest run -p radix-transaction-scenarios --no-fail-fast --locked
- name: Run doc tests
run: cargo test --doc -p radix-transaction-scenarios --no-fail-fast --locked

radix-clis:
name: Run CLI tests
Expand All @@ -293,6 +342,9 @@ jobs:
- name: Run Unit tests
run: cargo nextest run --no-fail-fast --locked
working-directory: radix-clis
- name: Run doc tests
run: cargo test --doc --no-fail-fast --locked
working-directory: radix-clis
- name: Run resim shell tests
run: bash ./tests/resim.sh
working-directory: radix-clis
Expand Down
27 changes: 5 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cd "$(dirname "$0")"
echo "Building the workspace packages and tests (with all extended features)..."

(set -x; cargo build; cargo test --no-run; cargo bench --no-run)
(set -x; cargo build -p radix-engine-profiling --all-features; cargo test -p radix-engine-profiling --all-features --no-run; cargo bench -p radix-engine-profiling --all-features --no-run)

echo "Building scrypto packages and tests using cargo build, to catch errors quickly..."

Expand Down
1 change: 0 additions & 1 deletion examples/everything/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ strip = true # Strip the symbols.
overflow-checks = true # Panic in the case of an overflow.

[lib]
doctest = false
crate-type = ["cdylib", "lib"]

[workspace]
Expand Down
1 change: 0 additions & 1 deletion examples/everything/Cargo.toml_for_scrypto_builder
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ strip = true # Strip the symbols.
overflow-checks = true # Panic in the case of an overflow.

[lib]
doctest = false
crate-type = ["cdylib", "lib"]

[workspace]
Expand Down
1 change: 0 additions & 1 deletion examples/hello-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ strip = true # Strip the symbols.
overflow-checks = true # Panic in the case of an overflow.

[lib]
doctest = false
crate-type = ["cdylib", "lib"]

[workspace]
Expand Down
1 change: 0 additions & 1 deletion examples/no-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ strip = true # Strip the symbols.
overflow-checks = true # Panic in the case of an overflow.

[lib]
doctest = false
crate-type = ["cdylib", "lib"]

[workspace]
Expand Down
1 change: 0 additions & 1 deletion radix-blueprint-schema-init/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ alloc = ["sbor/alloc", "radix-common/alloc", "serde?/alloc"]
serde = ["serde/derive", "sbor/serde", "radix-common/serde"]

[lib]
doctest = false
bench = false
1 change: 0 additions & 1 deletion radix-clis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,4 @@ path = "src/bin/replay.rs"
bench = false

[lib]
doctest = false
bench = false
1 change: 0 additions & 1 deletion radix-clis/tests/blueprints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ strip = true # Strip the symbols.
overflow-checks = true # Panic in the case of an overflow.

[lib]
doctest = false
crate-type = ["cdylib", "lib"]

[workspace]
Expand Down
4 changes: 2 additions & 2 deletions radix-common-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ license-file = "../LICENSE"
repository = "https://github.com/radixdlt/radixdlt-scrypto"

[dependencies]
radix-common = { workspace = true }

proc-macro2 = { workspace = true }
quote = { workspace = true }
syn = { workspace = true, features = ["full", "extra-traits"] }
paste = { workspace = true }
radix-common= { workspace = true }

[lib]
doctest = false
proc-macro = true
bench = false

Expand Down
1 change: 0 additions & 1 deletion radix-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ coverage = []

# Ref: https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
[lib]
doctest = false
bench = false
1 change: 0 additions & 1 deletion radix-engine-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ fuzzing = ["arbitrary", "sbor/fuzzing", "radix-common/fuzzing", "radix-rust/fuzz

# Ref: https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
[lib]
doctest = false
bench = false
1 change: 0 additions & 1 deletion radix-engine-monkey-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ post_run_db_check = ["scrypto-test/post_run_db_check"]
resource_tracker = ["dep:radix-engine-profiling", "radix-engine-profiling-derive/resource_tracker", "radix-engine/resource_tracker", "radix-common/resource_tracker", "scrypto-test/resource_tracker"]

[lib]
doctest = false
bench = false
1 change: 0 additions & 1 deletion radix-engine-profiling-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license-file = "../LICENSE"
repository = "https://github.com/radixdlt/radixdlt-scrypto"

[lib]
doctest = false
proc-macro = true
bench = false

Expand Down
19 changes: 12 additions & 7 deletions radix-engine-profiling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ license-file = "../LICENSE"
repository = "https://github.com/radixdlt/radixdlt-scrypto"

[dependencies]
radix-substate-store-interface = { workspace = true, optional = true }
radix-substate-store-impls = { workspace = true, optional = true }
radix-common = { workspace = true, optional = true }
radix-engine-interface = { workspace = true, optional = true }
radix-substate-store-interface = { workspace = true, optional = true, features = ["std"] }
radix-substate-store-impls = { workspace = true, optional = true, features = ["std"] }
radix-common = { workspace = true, optional = true, features = ["std"] }
radix-engine-interface = { workspace = true, optional = true, features = ["std"] }

fixedstr = { workspace = true }
shared_memory = { workspace = true, optional = true }
plotters = { workspace = true, optional = true }
Expand All @@ -20,12 +21,16 @@ blake2 = { workspace = true, optional = true }
rand = { workspace = true, optional = true }

[lib]
doctest = false
bench = false

[features]
default = []
resource_tracker = ["dep:shared_memory", "radix-common/resource_tracker"]
rocksdb = ["dep:plotters", "dep:linreg", "dep:blake2", "dep:rand", "radix-substate-store-impls/std",
"radix-substate-store-interface/std", "radix-common/std", "radix-engine-interface/std"]
rocksdb = [
"dep:plotters",
"dep:linreg",
"dep:blake2",
"dep:rand",
"radix-substate-store-impls/rocksdb",
]
ram_metrics = []
11 changes: 2 additions & 9 deletions radix-engine-profiling/src/rocks_db_metrics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
use radix_common::prelude::*;
use radix_substate_store_impls::{
memory_db::InMemorySubstateDatabase,
rocks_db::RocksdbSubstateStore,
rocks_db_with_merkle_tree::{BlockBasedOptions, Options, RocksDBWithMerkleTreeSubstateStore},
};
use radix_substate_store_interface::interface::{
CommittableSubstateDatabase, DatabaseUpdate, DatabaseUpdates, DbPartitionKey, DbSortKey,
DbSubstateValue, PartitionDatabaseUpdates, PartitionEntry, SubstateDatabase,
};
use radix_substate_store_impls::{memory_db::*, rocks_db::*, rocks_db_with_merkle_tree::*};
use radix_substate_store_interface::interface::*;
use std::{cell::RefCell, collections::BTreeMap, path::PathBuf, time::Duration};

#[cfg(test)]
Expand Down
Loading

0 comments on commit 95f897a

Please sign in to comment.