diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..e6b32796 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,44 @@ +name: Build & Test Pop-CLI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Free up space on runner + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.5.0 + with: + cache-on-failure: true + cache-all-crates: true + + - uses: actions/checkout@v3 + - name: Check Feature Contracts Excl. + run: cargo check --no-default-features --features contract + + - uses: actions/checkout@v3 + - name: Check Features Parachain Excl. + run: cargo check --no-default-features --features parachain + + - uses: actions/checkout@v3 + - name: Build default features + run: cargo build + + - name: Run tests + run: cargo test --verbose \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 96645bf0..d8b0b5a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,16 +25,17 @@ strum = "0.26" strum_macros = "0.26" tempfile = "3.8" tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } +url = { version = "2.5", optional = true } walkdir = "2.4" # contracts contract-build = { version = "4.0.0-rc.3", optional = true } contract-extrinsics = { version = "4.0.0-rc.3", optional = true } sp-core = { version = "30.0.0", optional = true } -subxt-signer = { version = "0.34.0", features = ["subxt", "sr25519"], optional = true } -subxt = { version = "0.34.0", optional = true } -ink_env = { version = "5.0.0-rc.2", optional = true } -sp-weights = { version ="29.0.0", optional = true } +subxt-signer = { version = "0.34.0", features = ["subxt", "sr25519"], optional = true } +subxt = { version = "0.34.0", optional = true } +ink_env = { version = "5.0.0-rc.2", optional = true } +sp-weights = { version = "29.0.0", optional = true } ansi_term = "0.12.1" # parachains @@ -46,7 +47,6 @@ serde = { version = "1.0", features = ["derive"], optional = true } symlink = { version = "0.1", optional = true } toml_edit = { version = "0.22", optional = true } tracing-subscriber = { version = "0.3", optional = true } -url = { version = "2.5", optional = true } zombienet-sdk = { git = "https://github.com/r0gue-io/zombienet-sdk", branch = "pop", optional = true } zombienet-support = { git = "https://github.com/r0gue-io/zombienet-sdk", branch = "pop", optional = true } @@ -60,6 +60,7 @@ contract = [ "dep:subxt", "dep:ink_env", "dep:sp-weights", + "dep:url", ] parachain = [ "dep:dirs", diff --git a/src/commands/build/mod.rs b/src/commands/build/mod.rs index d429d764..f957b94f 100644 --- a/src/commands/build/mod.rs +++ b/src/commands/build/mod.rs @@ -1,6 +1,8 @@ use clap::{Args, Subcommand}; +#[cfg(feature = "contract")] pub(crate) mod contract; +#[cfg(feature = "parachain")] pub(crate) mod parachain; #[derive(Args)] diff --git a/src/commands/call/mod.rs b/src/commands/call/mod.rs index c64c0227..084c7e08 100644 --- a/src/commands/call/mod.rs +++ b/src/commands/call/mod.rs @@ -1,5 +1,6 @@ use clap::{Args, Subcommand}; +#[cfg(feature = "contract")] pub(crate) mod contract; #[derive(Args)] diff --git a/src/commands/test/mod.rs b/src/commands/test/mod.rs index 486793f3..53682e54 100644 --- a/src/commands/test/mod.rs +++ b/src/commands/test/mod.rs @@ -1,5 +1,6 @@ use clap::{Args, Subcommand}; +#[cfg(feature = "contract")] pub mod contract; #[derive(Args)] diff --git a/src/engines/mod.rs b/src/engines/mod.rs index a8484b61..f8411ace 100644 --- a/src/engines/mod.rs +++ b/src/engines/mod.rs @@ -1,4 +1,7 @@ +#[cfg(feature = "contract")] pub mod contract_engine; pub mod generator; +#[cfg(feature = "parachain")] pub mod pallet_engine; +#[cfg(feature = "parachain")] pub mod parachain_engine; diff --git a/src/helpers.rs b/src/helpers.rs index ed60b605..1c503c55 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -53,6 +53,7 @@ pub(crate) fn clone_and_degit(url: &str, target: &Path) -> Result<()> { /// Resolve pallet path /// For a template it should be `