Skip to content

Commit

Permalink
[refactor]: Move to clap.
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandr Petrosyan <a-p-petrosyan@yandex.ru>
  • Loading branch information
appetrosyan committed Apr 25, 2022
1 parent e73bf08 commit 3f69633
Show file tree
Hide file tree
Showing 32 changed files with 270 additions and 431 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/iroha2-dev-pr-wasm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
- "wasm/**.json"
- "wasm/**.toml"
- "wasm/**.yml"
- "data_model/**.rs"
- "data_model/**.toml"

env:
RUSTC_BOOTSTRAP: 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Run tests
run: mold -run cargo test --quiet --workspace --no-fail-fast -- --skip unstable_network --test-threads 2 || true
env:
RUSTFLAGS: "-Zinstrument-coverage"
RUSTFLAGS: "-C instrument-coverage"
LLVM_PROFILE_FILE: "iroha-%p-%m.profraw"
- name: Generate a grcov coverage report
run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/iroha2-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ jobs:
with:
context: .
push: true
tags: hyperledger/iroha2:crypto-cli-dev
tags: hyperledger/iroha2:kagami-dev
build-args: |
TARGET_DIR=release
PROFILE=--release
BIN=iroha_crypto_cli
BIN=kagami
- name: Build and push load-rs:dev docker image
run: |
run: |
sleep 10s
echo "wait to other workflow"
- uses: convictional/trigger-workflow-and-wait@v1.6.0
Expand Down Expand Up @@ -112,11 +112,11 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: cargo-crypto-cli-build-release
path: target/release/iroha_crypto_cli
path: target/release/kagami
- name: Run schema generation
run: |
mkdir -p target/schema
cargo run -p iroha_schema_bin > target/schema/schema.json
cargo run --bin kagami -- schema > target/schema/schema.json
- name: Upload schema
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
- name: Run tests
run: mold -run cargo test --workspace --no-fail-fast -- --skip unstable_network || true
env:
RUSTFLAGS: "-Zinstrument-coverage"
RUSTFLAGS: "-C instrument-coverage"
RUSTC_BOOTSTRAP: 1
LLVM_PROFILE_FILE: "iroha-%p-%m.profraw"
- name: Generate a grcov coverage report
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/iroha2-push-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
with:
context: .
push: true
tags: hyperledger/iroha2:crypto-cli-dev-nightly-${{ github.sha }}
tags: hyperledger/iroha2:kagami-dev-nightly-${{ github.sha }}
build-args: |
TARGET_DIR=release
PROFILE=--release
BIN=iroha_crypto_cli
BIN=kagami
8 changes: 4 additions & 4 deletions .github/workflows/iroha2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Run tests
run: mold -run cargo test --quiet --workspace --no-fail-fast -- --skip unstable_network --test-threads 2 || true
env:
RUSTFLAGS: "-Zinstrument-coverage"
RUSTFLAGS: "-C instrument-coverage"
LLVM_PROFILE_FILE: "iroha-%p-%m.profraw"
- name: Generate a grcov coverage report
run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
with:
context: .
push: true
tags: hyperledger/iroha2:stable-client-cli
tags: hyperledger/iroha2:client-cli-stable
build-args: |
TARGET_DIR=release
PROFILE=--release
Expand All @@ -69,11 +69,11 @@ jobs:
with:
context: .
push: true
tags: hyperledger/iroha2:stable-crypto-cli
tags: hyperledger/iroha2:kagami-stable
build-args: |
TARGET_DIR=release
PROFILE=--release
BIN=iroha_crypto_cli
BIN=kagami
- name: Build and push load-rs:release docker image
run: |
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The following is a short set of guidelines for contributing to Iroha.
* Fix your issue of choice.
* Write [tests](https://doc.rust-lang.org/cargo/commands/cargo-test.html). Ensure they all pass (`cargo test`).
* Fix [`clippy`](https://lib.rs/crates/cargo-lints) warnings: `cargo lints clippy --workspace --benches --tests --examples --all-features`
* Format code `cargo +nightly fmt --all` and generate docs `cargo run --bin iroha_docs >"docs/source/references/config.md" && git add "docs/source/references/config.md"`
* Format code `cargo +nightly fmt --all` and generate docs `cargo run --bin kagami -- docs >"docs/source/references/config.md" && git add "docs/source/references/config.md"`
* `git pull -r hyperledger iroha2-dev`, `git commit -s`, `git push <your-fork>`, and [create a pull request](https://github.com/hyperledger/iroha/compare) to the `iroha2-dev` branch on GitHub.

### Reporting Bugs
Expand Down Expand Up @@ -149,7 +149,7 @@ Set the `LOG_FILE_PATH` environment variable to an appropriate location to store
- Limit the first line of your commit message to 50 characters or less.
- The first line of your commit message should contain the summary of the work you've done. If you need more than one line, leave a blank line between each paragraph and describe your changes in the middle. The last line must be the sign-off.
- Use the [Git Rebase Workflow](https://git-rebase.io/). Avoid using `git pull` use `git pull --rebase` instead.
- If you modify the Schema (check by generating the schema with `iroha_schema_bin` and diff), you should make all changes to the schema in a separate commit with the message `[schema]`.
- If you modify the Schema (check by generating the schema with `kagami schema` and diff), you should make all changes to the schema in a separate commit with the message `[schema]`.
- Generally, try to stick to one commit per meaningful change.
- If you fixed several issues in one PR, give them separate commits.
- As mentioned previously changes to the `schema` and the API should be done in appropriate commits separate from the rest of your work.
Expand Down
89 changes: 17 additions & 72 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ members = [
"p2p",
"permissions_validators",
"schema",
"schema/bin",
"schema/gen",
"schema/derive",
"substrate",
"telemetry",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Iroha project mainly consists of the following crates:
* [`iroha_config`](config), which handles configuration, generating documentation for options and run-time changes
* [`iroha_core`](core) — the primary library used by all other crates which includes the peer's endpoint management
* [`iroha_crypto`](crypto) — cryptographic aspects of Iroha
* [`iroha_crypto_cli`](crypto_cli), which is used to generate cryptographic keys
* [`kagami`](tools/kagami), which is used to generate cryptographic keys, default genesis, configuration reference, and schema
* [`iroha_data_model`](data_model), which defines common data models in Iroha
* [`iroha_futures`](futures) — technical crate used for `async` programming
* [`iroha_logger`](logger), which uses `tracing` to provide logging facilities
Expand Down
4 changes: 2 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ bridge = ["iroha_core/bridge"]
dex = ["iroha_core/dex"]
telemetry = ["iroha_telemetry", "iroha_core/telemetry"]
dev-telemetry = ["iroha_core/dev-telemetry", "iroha_telemetry"]
schema-endpoint = ["iroha_schema_bin"]
schema-endpoint = ["iroha_schema_gen"]
test-network = []

[badges]
Expand All @@ -39,7 +39,7 @@ iroha_version = { version = "=2.0.0-pre-rc.3", path = "../version", features = [
iroha_config = { version = "=2.0.0-pre-rc.3", path = "../config" }
iroha_crypto = { version = "=2.0.0-pre-rc.3", path = "../crypto" }
iroha_p2p = { version = "=2.0.0-pre-rc.3", path = "../p2p" }
iroha_schema_bin = { version = "=2.0.0-pre-rc.3", path = "../schema/bin", optional = true }
iroha_schema_gen = { version = "=2.0.0-pre-rc.3", path = "../schema/gen", optional = true }

eyre = "0.6.5"
futures = { version = "0.3.17", default-features = false, features = ["std", "async-await"] }
Expand Down
10 changes: 5 additions & 5 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ This flag can be combined with the `--features` flag in order to precisely speci

### Generating Keys

We highly recommend that any non-testing deployment generate a new key pair, with the recommended algorithm `Ed25519`. For convenience, you can use the provided [`iroha_crypto_cli`](../crypto_cli/README.md). For example,
We highly recommend that any non-testing deployment generate a new key pair, with the recommended algorithm `Ed25519`. For convenience, you can use the provided [`kagami`](../tools/kagami/README.md). For example,

<!-- TODO, update the links for the release version. -->

```bash
cargo run --bin iroha_crypto_cli
cargo run --bin kagami -- crypto
```

should produce
Expand All @@ -65,13 +65,13 @@ Private key: 0311152fad9308482f51ca2832fdfab18e1c74f36c6adb198e3ef0213fe42fd8bdf
Digest function: ed25519
```

**NOTE**: to see the command-line options for `iroha_crypto_cli` you must first terminate the arguments passed to `cargo`, so the command for running the `iroha_crypto_cli` binary with JSON formatting is
**NOTE**: to see the command-line options for `kagami` you must first terminate the arguments passed to `cargo`, so the command for running the `kagami` binary with JSON formatting is

```bash
cargo run --bin iroha_crypto_cli -- --json
cargo run --bin kagami -- crypto --json
```

**NOTE**: The `iroha_crypto_cli` binary can be run without `cargo` using the `<IROHA REPO ROOT>/target/release/iroha_crypto_cli` binary.
**NOTE**: The `kagami` binary can be run without `cargo` using the `<IROHA REPO ROOT>/target/release/kagami` binary.

### Configuration file

Expand Down
Loading

0 comments on commit 3f69633

Please sign in to comment.