Skip to content

Commit

Permalink
chore: fix wasm-compatibility ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ncitron committed Oct 31, 2024
1 parent 0629457 commit 9c20586
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: check
args: --target wasm32-unknown-unknown -p common -p consensus-core --no-default-features
arg: --target wasm32-unknown-unknown --workspace --exclude helios-cli
10 changes: 10 additions & 0 deletions opstack/bin/server.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
use std::net::SocketAddr;

#[cfg(not(target_arch = "wasm32"))]
use clap::Parser;
use eyre::Result;
use tracing_subscriber::{EnvFilter, FmtSubscriber};
use url::Url;

#[cfg(not(target_arch = "wasm32"))]
use helios_opstack::{
config::{Network, NetworkConfig},
server::start_server,
};

#[cfg(not(target_arch = "wasm32"))]
#[tokio::main]
async fn main() -> Result<()> {
enable_tracing();
Expand All @@ -34,6 +37,12 @@ async fn main() -> Result<()> {
Ok(())
}

#[cfg(target_arch = "wasm32")]
fn main() -> Result<()> {
eyre::bail!("server not supported in wasm");
}

#[cfg(not(target_arch = "wasm32"))]
fn enable_tracing() {
let env_filter = EnvFilter::builder()
.with_default_directive("helios_opstack=info".parse().unwrap())
Expand All @@ -47,6 +56,7 @@ fn enable_tracing() {
tracing::subscriber::set_global_default(subscriber).expect("subscriber set failed");
}

#[cfg(not(target_arch = "wasm32"))]
#[derive(Parser)]
struct Cli {
#[clap(short, long)]
Expand Down

0 comments on commit 9c20586

Please sign in to comment.