Skip to content

Commit

Permalink
chore: fix wasm-compatibility ci (#420)
Browse files Browse the repository at this point in the history
* chore: fix wasm-compatibility ci

* fix ci name
  • Loading branch information
ncitron authored Oct 31, 2024
1 parent 0629457 commit 09d5036
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Add wasm target
run: rustup target add wasm32-unknown-unknown
- name: Check wasm compatibility for common and consensus-core
- name: Check wasm compatibility
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 09d5036

Please sign in to comment.