From 37114814d216e5ec6cca99a0c41d03da7cb60ab2 Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Wed, 20 Dec 2023 12:41:15 -0800 Subject: [PATCH] Update workflow. --- .github/workflows/ci.yml | 11 ++++++++--- .github/workflows/release.yml | 1 - Cargo.toml | 4 ++++ src/lib.rs | 13 ++++--------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6aa88e6..8eda2ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: - uses: actions/checkout@v3 - uses: moonrepo/setup-rust@v1 with: + cache: false components: rustfmt - run: cargo fmt --all --check lint: @@ -31,6 +32,7 @@ jobs: - uses: actions/checkout@v3 - uses: moonrepo/setup-rust@v1 with: + cache: false components: clippy - run: cargo clippy --workspace --all-targets test: @@ -44,7 +46,10 @@ jobs: - uses: actions/checkout@v3 - uses: moonrepo/setup-rust@v1 with: - bins: cargo-wasi, cargo-nextest + bins: cargo-nextest cache: false - - run: cargo wasi build - - run: cargo nextest run + - uses: moonrepo/setup-toolchain@v0 + with: + proto-version: 0.26.0-rc.2 + - uses: moonrepo/build-proto-plugin@v0 + - run: cargo nextest run --no-default-features diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 683752b..4da0eb2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,6 @@ jobs: - uses: moonrepo/setup-rust@v1 with: cache: false - targets: wasm32-wasi - uses: moonrepo/build-proto-plugin@v0 - if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} uses: ncipollo/release-action@v1 diff --git a/Cargo.toml b/Cargo.toml index b4ac19d..a333285 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,10 @@ proto_pdk_test_utils = { version = "0.14.4" } # , path = "../../proto/crat starbase_sandbox = "0.1.12" tokio = { version = "1.35.1", features = ["full"] } +[features] +default = ["wasm"] +wasm = [] + [profile.release] codegen-units = 1 debug = false diff --git a/src/lib.rs b/src/lib.rs index 8d89e9a..4620c58 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,13 +1,8 @@ -mod toolchain_toml; - -// WASM cannot be executed through the test runner and we need to avoid building -// WASM code for non-WASM targets. We can solve both of these with a cfg flag. - -#[cfg(not(test))] +#[cfg(feature = "wasm")] mod helpers; - -#[cfg(not(test))] +#[cfg(feature = "wasm")] mod proto; +mod toolchain_toml; -#[cfg(not(test))] +#[cfg(feature = "wasm")] pub use proto::*;