Skip to content

Commit

Permalink
Crates publish (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyGiorgio authored Apr 17, 2023
1 parent 7907eb4 commit b45af71
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 8 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,37 @@ on:
release:
types: [published]
jobs:
build:
mutiny-core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: clippy
target: wasm32-unknown-unknown
override: true
profile: minimal

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-release-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-release-
cargo-${{ runner.os }}-
- name: Cargo Publish
run: cargo publish -p mutiny-core
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}


mutiny-wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ jobs:
override: true
profile: minimal

- name: Install wasm-pack
run: cargo install wasm-pack
- uses: jetli/[email protected]
with:
version: 'latest'

- uses: actions/cache@v2
with:
Expand All @@ -41,6 +42,7 @@ jobs:
runs-on: ubuntu-latest
env:
RUSTUP_TOOLCHAIN: nightly
WASM_BINDGEN_TEST_TIMEOUT: 60
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
Expand All @@ -51,8 +53,9 @@ jobs:
override: true
profile: minimal

- name: Install wasm-pack
run: cargo install wasm-pack
- uses: jetli/[email protected]
with:
version: 'latest'

- name: Setup trunk
uses: jetli/[email protected]
Expand Down
8 changes: 7 additions & 1 deletion mutiny-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ cargo-features = ["per-package-target"]

[package]
name = "mutiny-core"
version = "0.2.4"
version = "0.2.5"
edition = "2021"
authors = ["Tony Giorgio <[email protected]>", "benthecarman <[email protected]>"]
forced-target = "wasm32-unknown-unknown"
description = "The core SDK for the mutiny node"
license = "MIT"
documentation = "https://docs.rs/mutiny-core"
homepage = "https://mutinywallet.com"
repository = "https://github.com/mutinywallet/mutiny-core"


[dependencies]
ln-websocket-proxy = "0.3.0"
Expand Down
11 changes: 11 additions & 0 deletions mutiny-core/src/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@ mod test {
use uuid::Uuid;
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};

use crate::test::*;

use super::*;

wasm_bindgen_test_configure!(run_in_browser);
Expand Down Expand Up @@ -710,6 +712,9 @@ mod test {

assert!(data.is_some());
assert!(data.unwrap().last_sync_timestamp > 0);

cleanup_indexdb_test().await;
cleanup_test();
}

#[test]
Expand All @@ -735,6 +740,9 @@ mod test {
let read = read_peer_info(&node_id).await.unwrap();

assert!(read.is_none());

cleanup_indexdb_test().await;
cleanup_test();
}

#[test]
Expand All @@ -758,5 +766,8 @@ mod test {

assert!(read.is_some());
assert_eq!(read.unwrap(), expected);

cleanup_indexdb_test().await;
cleanup_test();
}
}
2 changes: 2 additions & 0 deletions mutiny-core/src/keymanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,7 @@ mod tests {
let second_pubkey_again = pubkey_from_keys_manager(&km);

assert_eq!(second_pubkey, second_pubkey_again);

cleanup_test();
}
}
7 changes: 6 additions & 1 deletion mutiny-core/src/ldkstorage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ mod test {

use super::*;

use crate::test::*;

wasm_bindgen_test_configure!(run_in_browser);

fn get_test_persister() -> MutinyNodePersister {
Expand All @@ -356,7 +358,7 @@ mod test {
}

#[test]
fn test_persist_payment_info() {
async fn test_persist_payment_info() {
let persister = get_test_persister();
let preimage = [1; 32];
let payment_hash = PaymentHash([0; 32]);
Expand All @@ -383,5 +385,8 @@ mod test {
assert_eq!(list.len(), 1);
assert_eq!(list[0].0, payment_hash);
assert_eq!(list[0].1.preimage, Some(preimage));

cleanup_indexdb_test().await;
cleanup_test();
}
}
7 changes: 7 additions & 0 deletions mutiny-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ mod test {
}
}
pub(crate) use log;
use rexie::Rexie;

use crate::gossip::GOSSIP_DATABASE_NAME;

pub(crate) fn cleanup_test() {
LocalStorage::clear();
}

pub(crate) async fn cleanup_indexdb_test() {
Rexie::delete(GOSSIP_DATABASE_NAME).await.unwrap();
}
}
2 changes: 1 addition & 1 deletion mutiny-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cargo-features = ["per-package-target"]

[package]
name = "mutiny-wasm"
version = "0.2.4"
version = "0.2.5"
edition = "2021"
authors = ["Tony Giorgio <[email protected]>", "benthecarman <[email protected]>"]
forced-target = "wasm32-unknown-unknown"
Expand Down

0 comments on commit b45af71

Please sign in to comment.