From d8075dae281b7600581eebaa521e5608264e7cac Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Tue, 22 Oct 2019 12:56:29 -0700 Subject: [PATCH 1/7] Add proper error for lock --- lib/src/commands.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/commands.rs b/lib/src/commands.rs index e0e4c72..eb0f270 100644 --- a/lib/src/commands.rs +++ b/lib/src/commands.rs @@ -356,7 +356,11 @@ impl Command for LockCommand { fn exec(&self, args: &[&str], lightclient: &LightClient) -> String { if args.len() != 0 { - return self.help(); + let mut h = vec![]; + h.push("Extra arguments to lock. Did you mean 'encrypt'?"); + h.push(""); + + return format!("{}\n{}", h.join("\n"), self.help()); } match lightclient.wallet.write().unwrap().lock() { From 13a89f8c82f3ff45398b68f19c8d72d1e9446933 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Tue, 22 Oct 2019 12:56:36 -0700 Subject: [PATCH 2/7] Github build action --- lib/.github/workflows/rust.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/.github/workflows/rust.yml diff --git a/lib/.github/workflows/rust.yml b/lib/.github/workflows/rust.yml new file mode 100644 index 0000000..06a66bb --- /dev/null +++ b/lib/.github/workflows/rust.yml @@ -0,0 +1,28 @@ +name: Rust + +on: [push, pull_request] + +jobs: + build: + name: Build on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: 1.38.0 + override: true + - name: cargo fetch + uses: actions-rs/cargo@v1 + with: + command: fetch + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --verbose --release --all + \ No newline at end of file From 4a62949bdb40ee79e4286694db0bd43ea8cede57 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Tue, 22 Oct 2019 13:00:10 -0700 Subject: [PATCH 3/7] Move actions to root --- {lib/.github => .github}/workflows/rust.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {lib/.github => .github}/workflows/rust.yml (100%) diff --git a/lib/.github/workflows/rust.yml b/.github/workflows/rust.yml similarity index 100% rename from lib/.github/workflows/rust.yml rename to .github/workflows/rust.yml From be2eaad44386f69baaf2cec853b3e81b59326fbe Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Tue, 22 Oct 2019 13:21:18 -0700 Subject: [PATCH 4/7] Refactor into cargo workspace --- .github/workflows/rust.yml | 7 ++++++- Cargo.toml | 23 +++++------------------ cli/Cargo.toml | 18 ++++++++++++++++++ {src => cli/src}/main.rs | 0 lib/Cargo.toml | 3 --- 5 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 cli/Cargo.toml rename {src => cli/src}/main.rs (100%) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 06a66bb..a13abeb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,5 +24,10 @@ jobs: uses: actions-rs/cargo@v1 with: command: build - args: --verbose --release --all + args: --verbose --release --all --tests + - name: Run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --verbose --release --all \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 4b0a909..1e7b3f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,21 +1,8 @@ -[package] -name = "zecwallet-cli" -version = "1.1.0" -edition = "2018" - -[dependencies] -rustyline = "5.0.2" -clap = "2.33" -log = "0.4" -log4rs = "0.8.3" -shellwords = "1.0.0" -json = "0.12.0" -http = "0.1" -byteorder = "1" -tiny-bip39 = "0.6.2" - -zecwalletlitelib = { path = "./lib/" } - +[workspace] +members = [ + "lib", + "cli", +] [profile.release] debug = false \ No newline at end of file diff --git a/cli/Cargo.toml b/cli/Cargo.toml new file mode 100644 index 0000000..bb0e67c --- /dev/null +++ b/cli/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "zecwallet-cli" +version = "1.1.0" +edition = "2018" + +[dependencies] +rustyline = "5.0.2" +clap = "2.33" +log = "0.4" +log4rs = "0.8.3" +shellwords = "1.0.0" +json = "0.12.0" +http = "0.1" +byteorder = "1" +tiny-bip39 = "0.6.2" + +zecwalletlitelib = { path = "../lib/" } + diff --git a/src/main.rs b/cli/src/main.rs similarity index 100% rename from src/main.rs rename to cli/src/main.rs diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 459ff9e..c3c3688 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -72,6 +72,3 @@ tower-grpc-build = { git = "https://github.com/tower-rs/tower-grpc", features = [dev-dependencies] tempdir = "0.3.7" - -[profile.release] -debug = false \ No newline at end of file From 8de18436eed75db6f9510de22c0e1c3b6003e161 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Tue, 22 Oct 2019 13:38:08 -0700 Subject: [PATCH 5/7] Add x-compile --- .github/workflows/rust.yml | 69 +++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a13abeb..083fa8a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -30,4 +30,71 @@ jobs: with: command: test args: --verbose --release --all - \ No newline at end of file + - name: Upload + uses: actions/upload-artifact@v1 + with: + name: ${{ matrix.os }}-zecwallet-cli + path: target/release/zecwallet-cli + + linux_arm7: + name: Linux ARMv7 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: armv7-unknown-linux-gnueabihf + override: true + - uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --target armv7-unknown-linux-gnueabihf + - name: Upload + uses: actions/upload-artifact@v1 + with: + name: linux_armv7-zecwallet-cli + path: target/armv7-unknown-linux-gnueabihf/release/zecwallet-cli + + linux_aarch64: + name: Linux ARM64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: aarch64-unknown-linux-gnu + override: true + - uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --target aarch64-unknown-linux-gnu + - name: Upload + uses: actions/upload-artifact@v1 + with: + name: linux_aarch64-zecwallet-cli + path: target/aarch64-unknown-linux-gnu/release/zecwallet-cli + + linux_mingw: + name: Linux mingw + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-pc-windows-gnu + override: true + - uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --target x86_64-pc-windows-gnu + - name: Upload + uses: actions/upload-artifact@v1 + with: + name: linux_mingw-zecwallet-cli + path: target/x86_64-pc-windows-gnu/release/zecwallet-cli.exe From 101cdc9cfa8a41dd891e67b6f563e3768f7d35af Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Tue, 22 Oct 2019 14:05:14 -0700 Subject: [PATCH 6/7] debug --- .github/workflows/rust.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 083fa8a..746fd97 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -30,6 +30,9 @@ jobs: with: command: test args: --verbose --release --all + - run: pwd + - run: ls target/ + - run: ls target/release/ - name: Upload uses: actions/upload-artifact@v1 with: @@ -51,6 +54,9 @@ jobs: use-cross: true command: build args: --target armv7-unknown-linux-gnueabihf + - run: pwd + - run: ls target/ + - run: ls target/release/ - name: Upload uses: actions/upload-artifact@v1 with: @@ -71,7 +77,10 @@ jobs: with: use-cross: true command: build - args: --target aarch64-unknown-linux-gnu + args: --target aarch64-unknown-linux-gnu + - run: pwd + - run: ls target/ + - run: ls target/release/ - name: Upload uses: actions/upload-artifact@v1 with: @@ -93,6 +102,9 @@ jobs: use-cross: true command: build args: --target x86_64-pc-windows-gnu + - run: pwd + - run: ls target/ + - run: ls target/release/ - name: Upload uses: actions/upload-artifact@v1 with: From 30f692735023526d39bb473e1fa56b7e762611e5 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Tue, 22 Oct 2019 14:18:31 -0700 Subject: [PATCH 7/7] Fix upload error --- .github/workflows/rust.yml | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 746fd97..422cf60 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,15 +24,12 @@ jobs: uses: actions-rs/cargo@v1 with: command: build - args: --verbose --release --all --tests + args: --verbose --release --all - name: Run tests uses: actions-rs/cargo@v1 with: command: test args: --verbose --release --all - - run: pwd - - run: ls target/ - - run: ls target/release/ - name: Upload uses: actions/upload-artifact@v1 with: @@ -53,10 +50,7 @@ jobs: with: use-cross: true command: build - args: --target armv7-unknown-linux-gnueabihf - - run: pwd - - run: ls target/ - - run: ls target/release/ + args: --release --target armv7-unknown-linux-gnueabihf - name: Upload uses: actions/upload-artifact@v1 with: @@ -77,36 +71,10 @@ jobs: with: use-cross: true command: build - args: --target aarch64-unknown-linux-gnu - - run: pwd - - run: ls target/ - - run: ls target/release/ + args: --release --target aarch64-unknown-linux-gnu - name: Upload uses: actions/upload-artifact@v1 with: name: linux_aarch64-zecwallet-cli path: target/aarch64-unknown-linux-gnu/release/zecwallet-cli - linux_mingw: - name: Linux mingw - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: x86_64-pc-windows-gnu - override: true - - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --target x86_64-pc-windows-gnu - - run: pwd - - run: ls target/ - - run: ls target/release/ - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: linux_mingw-zecwallet-cli - path: target/x86_64-pc-windows-gnu/release/zecwallet-cli.exe