test: make test contracts workspace members for shared compilation#174
test: make test contracts workspace members for shared compilation#174
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR restructures the integration-test WASM contracts under near-plugins-derive/tests/contracts/* to be workspace members, enabling shared compilation artifacts (target/) and reducing redundant dependency rebuilds during the test suite.
Changes:
- Adds all test contracts as root workspace members and switches them to
workspace.dependencies/ inherited edition. - Consolidates WASM release optimization settings at the workspace root and centralizes the Rust toolchain pin in the repo root.
- Updates CI to exclude WASM-only contract packages from host-target
cargo test/cargo clippyruns.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| rust-toolchain | Pins the repo toolchain to Rust 1.86.0 and keeps wasm32 target/components. |
| Cargo.toml | Adds test contracts to workspace members, defines workspace.dependencies, and moves release profile settings to workspace root. |
| .github/workflows/test.yml | Excludes WASM-only contract crates from host-target cargo test and cargo clippy; installs wasm target in CI. |
| near-plugins-derive/tests/contracts/access_controllable/src/lib.rs | Rustfmt/edition-2024 import reordering. |
| near-plugins-derive/tests/contracts/access_controllable/Cargo.toml | Switches to edition.workspace and uses workspace dependencies for near-sdk / near-plugins. |
| near-plugins-derive/tests/contracts/access_controllable/rust-toolchain | Removes per-contract toolchain file in favor of repo root toolchain. |
| near-plugins-derive/tests/contracts/ownable/src/lib.rs | Rustfmt/edition-2024 import reordering. |
| near-plugins-derive/tests/contracts/ownable/Cargo.toml | Switches to edition.workspace and uses workspace dependencies for near-sdk / near-plugins. |
| near-plugins-derive/tests/contracts/ownable/rust-toolchain | Removes per-contract toolchain file in favor of repo root toolchain. |
| near-plugins-derive/tests/contracts/pausable/src/lib.rs | Rustfmt/edition-2024 import reordering. |
| near-plugins-derive/tests/contracts/pausable/Cargo.toml | Switches to edition.workspace and uses workspace dependencies for near-sdk / near-plugins. |
| near-plugins-derive/tests/contracts/pausable/rust-toolchain | Removes per-contract toolchain file in favor of repo root toolchain. |
| near-plugins-derive/tests/contracts/pausable_new/src/lib.rs | Rustfmt/edition-2024 import reordering. |
| near-plugins-derive/tests/contracts/pausable_new/Cargo.toml | Switches to edition.workspace and uses workspace dependencies for near-sdk / near-plugins. |
| near-plugins-derive/tests/contracts/pausable_new/rust-toolchain | Removes per-contract toolchain file in favor of repo root toolchain. |
| near-plugins-derive/tests/contracts/pausable_old/src/lib.rs | Rustfmt/edition-2024 import reordering. |
| near-plugins-derive/tests/contracts/pausable_old/Cargo.toml | Switches to edition.workspace and uses workspace dependencies for near-sdk / near-plugins. |
| near-plugins-derive/tests/contracts/pausable_old/rust-toolchain | Removes per-contract toolchain file in favor of repo root toolchain. |
| near-plugins-derive/tests/contracts/upgradable/src/lib.rs | Rustfmt/edition-2024 import reordering. |
| near-plugins-derive/tests/contracts/upgradable/Cargo.toml | Switches to edition.workspace and uses workspace dependencies for near-sdk / near-plugins. |
| near-plugins-derive/tests/contracts/upgradable/rust-toolchain | Removes per-contract toolchain file in favor of repo root toolchain. |
| near-plugins-derive/tests/contracts/upgradable_2/src/lib.rs | Rustfmt/edition-2024 import reordering. |
| near-plugins-derive/tests/contracts/upgradable_2/Cargo.toml | Switches to edition.workspace and uses workspace dependencies for near-sdk / near-plugins. |
| near-plugins-derive/tests/contracts/upgradable_2/rust-toolchain | Removes per-contract toolchain file in favor of repo root toolchain. |
| near-plugins-derive/tests/contracts/upgradable_state_migration/src/lib.rs | Rustfmt/edition-2024 import reordering. |
| near-plugins-derive/tests/contracts/upgradable_state_migration/Cargo.toml | Switches to edition.workspace and uses workspace dependencies for near-sdk / near-plugins. |
| near-plugins-derive/tests/contracts/upgradable_state_migration/rust-toolchain | Removes per-contract toolchain file in favor of repo root toolchain. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Previously, each of the 8 test contracts was a standalone project with its own target directory, causing near-sdk and all dependencies to be recompiled from scratch for each contract (~20 cargo_near_build calls per test run). By making them workspace members, all contracts share the workspace's target directory, so wasm32 dependencies only compile once. This reduces test CI time significantly. Changes: - Add all test contracts as workspace members in root Cargo.toml - Use workspace.dependencies for near-sdk and near-plugins in contracts - Move release profile (wasm optimization settings) to workspace root - Pin toolchain to 1.86.0 in root rust-toolchain (replaces per-contract files) - Delete per-contract rust-toolchain files (now inherited from workspace) - Update CI to exclude wasm-only contracts from host-target commands - Apply edition 2024 formatting to contract source files Closes #173
Add default-members to only include library crates, so plain cargo commands (test, clippy) automatically skip wasm-only contract packages without needing verbose --exclude flags.
858aebf to
2f4fd9b
Compare
nextest runs each test as a separate process, which may improve throughput for sandbox-based integration tests. Also adds flaky test detection with retries in CI.
This reverts commit 274bea0.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
target/directory and wasm32 dependency compilation cachecargo_near_buildcall recompilednear-sdkand all transitive deps from scratch in its own target dir (~20 times per full test run)Stacked on #172 (WarpBuild CI migration)
Changes
[workspace.members]in rootCargo.tomlworkspace.dependenciesfornear-sdkandnear-pluginsin contract Cargo.tomls[profile.release]wasm optimization settings to workspace rootchannel = "1.86.0"in rootrust-toolchain(replaces 8 per-contract files)--excludewasm-only contract packages from host-target commands (cargo test,cargo clippy)Test plan
cargo test -p near-plugins-derive --test ownablepasses locallycargo test -p near-plugins-derive --test pausablepasses locallycargo fmt --all -- --checkpassesCloses #173