Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add build/test checks #20

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }

Expand All @@ -60,6 +60,7 @@ contract = [
"dep:subxt",
"dep:ink_env",
"dep:sp-weights",
"dep:url",
]
parachain = [
"dep:dirs",
Expand Down
2 changes: 2 additions & 0 deletions src/commands/build/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use clap::{Args, Subcommand};

#[cfg(feature = "contract")]
pub(crate) mod contract;
#[cfg(feature = "parachain")]
pub(crate) mod parachain;

#[derive(Args)]
Expand Down
1 change: 1 addition & 0 deletions src/commands/call/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use clap::{Args, Subcommand};

#[cfg(feature = "contract")]
pub(crate) mod contract;

#[derive(Args)]
Expand Down
1 change: 1 addition & 0 deletions src/commands/test/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use clap::{Args, Subcommand};

#[cfg(feature = "contract")]
pub mod contract;

#[derive(Args)]
Expand Down
3 changes: 3 additions & 0 deletions src/engines/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub(crate) fn clone_and_degit(url: &str, target: &Path) -> Result<()> {
/// Resolve pallet path
/// For a template it should be `<template>/pallets/`
/// For no path, it should just place it in the current working directory
#[cfg(feature = "parachain")]
pub(crate) fn resolve_pallet_path(path: Option<String>) -> PathBuf {
use std::process;

Expand Down
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod style;

#[cfg(feature = "parachain")]
mod git;
#[cfg(feature = "parachain")]
#[cfg(any(feature = "contract", feature = "parachain"))]
mod helpers;
#[cfg(feature = "parachain")]
mod parachains;
Expand Down Expand Up @@ -37,12 +37,14 @@ enum Commands {
Build(commands::build::BuildArgs),
/// Call a smart contract.
#[clap(alias = "c")]
#[cfg(feature = "contract")]
Call(commands::call::CallArgs),
/// Deploy a parachain or smart contract.
#[clap(alias = "u")]
Up(commands::up::UpArgs),
/// Test a smart contract.
#[clap(alias = "t")]
#[cfg(feature = "contract")]
Test(commands::test::TestArgs),
}

Expand All @@ -64,8 +66,8 @@ async fn main() -> Result<()> {
#[cfg(feature = "contract")]
commands::build::BuildCommands::Contract(cmd) => cmd.execute(),
},
#[cfg(feature = "contract")]
Commands::Call(args) => Ok(match &args.command {
#[cfg(feature = "contract")]
commands::call::CallCommands::Contract(cmd) => cmd.execute().await?,
}),
Commands::Up(args) => Ok(match &args.command {
Expand All @@ -74,8 +76,8 @@ async fn main() -> Result<()> {
#[cfg(feature = "contract")]
commands::up::UpCommands::Contract(cmd) => cmd.execute().await?,
}),
#[cfg(feature = "contract")]
Commands::Test(args) => match &args.command {
#[cfg(feature = "contract")]
commands::test::TestCommands::Contract(cmd) => cmd.execute(),
},
}
Expand Down
Loading