diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef6183d199..56d5a2bd43 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: - name: Compile NPM run: | cd applications/launchpad/gui-vue - npm install + npm ci npm run build - name: toolchain uses: actions-rs/toolchain@v1 @@ -80,7 +80,7 @@ jobs: command: clippy args: --all-targets -- -D warnings build: - name: build + name: check nightly runs-on: ubuntu-18.04 steps: - name: checkout @@ -114,7 +114,7 @@ jobs: - name: Compile NPM run: | cd applications/launchpad/gui-vue - npm install + npm ci npm run build - name: toolchain uses: actions-rs/toolchain@v1 @@ -122,6 +122,57 @@ jobs: toolchain: ${{ env.toolchain }} components: clippy, rustfmt override: true + - name: cargo check + uses: actions-rs/cargo@v1 + with: + command: check + args: --release --all-targets + build-stable: + name: check stable + runs-on: ubuntu-18.04 + steps: + - name: checkout + uses: actions/checkout@v2 + - name: caching + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-${{ runner.cpu-model }}-stable-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-${{ runner.cpu-model }}-stable-build- + ${{ runner.os }}-${{ runner.cpu-model }}-stable- + - name: ubuntu dependencies + run: | + sudo apt-get update && \ + sudo apt-get -y install \ + build-essential \ + libgtk-3-dev \ + libwebkit2gtk-4.0-dev \ + libsoup2.4-dev \ + curl \ + wget \ + libappindicator3-dev \ + patchelf \ + librsvg2-dev \ + libprotobuf-dev \ + protobuf-compiler + - name: Compile NPM + run: | + cd applications/launchpad/gui-vue + npm ci + npm run build + - name: toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + - name: rustup show + run: | + rustup show - name: cargo build uses: actions-rs/cargo@v1 with: @@ -163,7 +214,7 @@ jobs: - name: Compile NPM run: | cd applications/launchpad/gui-vue - npm install + npm ci npm run build - name: toolchain uses: actions-rs/toolchain@v1 @@ -173,4 +224,4 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --release + args: --release --all-targets diff --git a/applications/tari_collectibles/src-tauri/src/app_state.rs b/applications/tari_collectibles/src-tauri/src/app_state.rs index 8f2fa32163..b13a8bf9d3 100644 --- a/applications/tari_collectibles/src-tauri/src/app_state.rs +++ b/applications/tari_collectibles/src-tauri/src/app_state.rs @@ -74,11 +74,8 @@ impl ConcurrentAppState { pub async fn connect_base_node_client(&self) -> Result { let lock = self.inner.read().await; - let client = BaseNodeClient::connect(format!( - "http://{}", - lock.config.base_node_grpc_address.to_string() - )) - .await?; + let client = + BaseNodeClient::connect(format!("http://{}", lock.config.base_node_grpc_address)).await?; Ok(client) } diff --git a/applications/tari_collectibles/src-tauri/src/main.rs b/applications/tari_collectibles/src-tauri/src/main.rs index 85c77fb3b4..dabc4efb8b 100644 --- a/applications/tari_collectibles/src-tauri/src/main.rs +++ b/applications/tari_collectibles/src-tauri/src/main.rs @@ -1,4 +1,3 @@ -#![feature(array_methods)] #![cfg_attr( all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows" diff --git a/base_layer/key_manager/Cargo.toml b/base_layer/key_manager/Cargo.toml index cb8d4b9a87..cd281d6ecf 100644 --- a/base_layer/key_manager/Cargo.toml +++ b/base_layer/key_manager/Cargo.toml @@ -32,7 +32,7 @@ serde_json = "1.0.39" thiserror = "1.0.26" strum_macros = "0.22" strum = { version = "0.22", features = ["derive"] } -wasm-bindgen = { version = "0.2", features = ["serde-serialize", "nightly"] } +wasm-bindgen = { version = "0.2", features = ["serde-serialize", "nightly"], optional = true } wasm-bindgen-test = "0.3.28" [dev-dependencies] @@ -41,3 +41,4 @@ sha2 = "0.9.8" [features] avx2 = ["tari_crypto/avx2"] js = ["getrandom/js", "js-sys"] +wasm = ["wasm-bindgen", "js"] diff --git a/base_layer/key_manager/Makefile b/base_layer/key_manager/Makefile index efa926462c..41689d327c 100644 --- a/base_layer/key_manager/Makefile +++ b/base_layer/key_manager/Makefile @@ -1,19 +1,17 @@ -.PHONY: test +toolchain=nightly-2021-11-20 +.phony: test test: - wasm-pack test --node --features js - -.PHONY: build + rustup run $(toolchain) wasm-pack test --node --features wasm +.phony: build build: - wasm-pack build --target bundler . -- --features js - -.PHONY: install + rustup run $(toolchain) wasm-pack build --target bundler . -- --features wasm +.phony: install install: - wasm-pack build --out-dir=../../applications/tari_web_extension/src/key_manager/ --target bundler . -- --features js - -.PHONY: web + rustup run $(toolchain) wasm-pack build --out-dir=../../applications/tari_web_extension/src/key_manager/ --target bundler . -- --features wasm +.phony: web web: - wasm-pack build --target web . -- --features js \ No newline at end of file + rustup run $(toolchain) wasm-pack build --target web . -- --features wasm \ No newline at end of file diff --git a/base_layer/key_manager/src/lib.rs b/base_layer/key_manager/src/lib.rs index e9985c70de..ef4b1825e0 100644 --- a/base_layer/key_manager/src/lib.rs +++ b/base_layer/key_manager/src/lib.rs @@ -13,4 +13,5 @@ pub mod mnemonic; pub mod mnemonic_wordlists; // https://github.com/rustwasm/wasm-bindgen/issues/2774 #[allow(clippy::unused_unit)] +#[cfg(feature = "wasm")] pub mod wasm; diff --git a/base_layer/key_manager/src/wasm.rs b/base_layer/key_manager/src/wasm.rs index aed0835ddb..9534ed1722 100644 --- a/base_layer/key_manager/src/wasm.rs +++ b/base_layer/key_manager/src/wasm.rs @@ -190,7 +190,7 @@ mod test { let next_key = response.key_manager.next_key().unwrap(); assert_eq!( next_key.k.to_hex(), - "5a14f1205cfeb10d53af46e82b70e8832a544206f524b404e7a346148532910a".to_string() + "5c06999ed20e18bbb76245826141f8ae8700a648d87ec4da5a2a7507ce4b5f0e".to_string() ) } diff --git a/comms/dht/src/lib.rs b/comms/dht/src/lib.rs index cb75344910..d2cd185154 100644 --- a/comms/dht/src/lib.rs +++ b/comms/dht/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(map_entry_replace)] #![doc(html_root_url = "https://docs.rs/tower-filter/0.3.0-alpha.2")] #![cfg_attr(not(debug_assertions), deny(unused_variables))] #![cfg_attr(not(debug_assertions), deny(unused_imports))] diff --git a/comms/dht/src/store_forward/local_state.rs b/comms/dht/src/store_forward/local_state.rs index 50965dbdad..3dc064b80c 100644 --- a/comms/dht/src/store_forward/local_state.rs +++ b/comms/dht/src/store_forward/local_state.rs @@ -41,9 +41,9 @@ impl SafLocalState { pub fn register_inflight_request(&mut self, peer: NodeId) { match self.inflight_saf_requests.entry(peer) { - Entry::Occupied(entry) => { + Entry::Occupied(mut entry) => { let (count, _) = *entry.get(); - entry.replace_entry((count + 1, Instant::now())); + *entry.get_mut() = (count + 1, Instant::now()); }, Entry::Vacant(entry) => { entry.insert((1, Instant::now())); @@ -53,11 +53,11 @@ impl SafLocalState { pub fn mark_infight_response_received(&mut self, peer: NodeId) -> Option { match self.inflight_saf_requests.entry(peer) { - Entry::Occupied(entry) => { + Entry::Occupied(mut entry) => { let (count, ts) = *entry.get(); let reduced_count = count - 1; if reduced_count > 0 { - entry.replace_entry((reduced_count, ts)); + *entry.get_mut() = (reduced_count, ts); } else { entry.remove(); }