Skip to content

Commit

Permalink
ci: link checking (#5252)
Browse files Browse the repository at this point in the history
Signed-off-by: Lohachov Mykhailo <[email protected]>
  • Loading branch information
aoyako authored Nov 27, 2024
1 parent 485ef91 commit 3f9f219
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 7 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/iroha2-doc-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: I2::Doc::Links

# Verify all links in text files and generated documentation
# from source files are valid (return 200-like http code).
# https://github.com/lycheeverse/lychee

on:
pull_request:
branches: [main, stable, lts]
paths:
- '**/*.md'
- '**/*.txt'
- '**/*.html'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
link_checker:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4

- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with:
args: "'**/*.rs' ." # Check rust source and default text files
fail: true
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ To pass the *`check-PR-title`* check, the pull request title must adhere to the
### Git Workflow

- [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the [repository](https://github.com/hyperledger-iroha/iroha/tree/main) and [create a feature branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository) for your contributions.
- [Configure the remote](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-for-a-fork) to sync your fork with the [Hyperledger Iroha repository](https://github.com/hyperledger-iroha/iroha/tree/main).
- [Configure the remote](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-repository-for-a-fork) to sync your fork with the [Hyperledger Iroha repository](https://github.com/hyperledger-iroha/iroha/tree/main).
- Use the [Git Rebase Workflow](https://git-rebase.io/). Avoid using `git pull`. Use `git pull --rebase` instead.
- Use the provided [git hooks](./hooks/) to ease the development process.

Expand Down Expand Up @@ -317,11 +317,9 @@ Code guidelines:
- Use a domain-first modules structure.

Example: don't do `constants::logger`. Instead, invert the hierarchy, putting the object for which it is used first: `iroha_logger::constants`.
- Use [`expect`](https://learning-rust.github.io/docs/e4.unwrap_and_expect.html) with an explicit error message or proof of infallibility instead of `unwrap`.
- Use [`expect`](https://learning-rust.github.io/docs/unwrap-and-expect/) with an explicit error message or proof of infallibility instead of `unwrap`.
- Never ignore an error. If you can't `panic` and can't recover, it at least needs to be recorded in the log.
- Prefer to return a `Result` instead of `panic!`.

Exception: when implementing something that uses `issue_send` instead of `send` ([more about actors](docs/source/guides/actor.md)). Actors and parallelism don't mix; you could deadlock the entire peer, so it's better to `panic!` if something goes wrong. This is a necessary concession for asynchronous programming.
- Group related functionality spatially, preferably inside appropriate modules.

For example, instead of having a block with `struct` definitions and then `impl`s for each individual struct, it is better to have the `impl`s related to that `struct` next to it.
Expand Down
1 change: 0 additions & 1 deletion crates/iroha/examples/tutorial.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! This file contains examples from the Rust tutorial.
//! <https://hyperledger.github.io/iroha-2-docs/guide/rust.html#_2-configuring-iroha-2>
use eyre::{Error, WrapErr};
use iroha::{config::Config, data_model::prelude::Numeric};
Expand Down
2 changes: 1 addition & 1 deletion crates/iroha_wasm_builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ fn cargo_command() -> Command {
if value.contains(INSTRUMENT_COVERAGE_FLAG) {
eprintln!("WARNING: found `{INSTRUMENT_COVERAGE_FLAG}` rustc flag in `{var}` environment variable\n \
This directly interferes with `-Z build-std` flag set by `iroha_wasm_builder`\n \
See https://github.com/rust-lang/wg-cargo-std-aware/issues/68\n \
See https://github.com/rust-lang/wg-cargo-std-aware/issues/68 \n \
Further execution of `cargo` will most probably fail with `could not find profiler-builtins` error");
}
}
Expand Down
16 changes: 16 additions & 0 deletions lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
verbose = "error"
no_progress = true
cache = false

timeout = 20
max_retries = 2

exclude_path = [
"target"
]

exclude = [
"^http[s]?://127.0.0.1",
"^http[s]?://localhost",
"^http[s]?://iroha"
]
2 changes: 1 addition & 1 deletion wasm/libs/default_executor/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `iroha_default_executor`

Use the [Wasm Builder CLI](../../crates/iroha_wasm_builder) in order to build it:
Use the [Wasm Builder CLI](../../../crates/iroha_wasm_builder) in order to build it:

```bash
cargo run --bin iroha_wasm_builder -- \
Expand Down

0 comments on commit 3f9f219

Please sign in to comment.