Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add lychee #200

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This runs `cargo audit` on all dependencies (only if Cargo deps changed)
# <https://github.com/RustSec/rustsec/tree/main/cargo-audit>

name: Audit

Expand Down Expand Up @@ -27,7 +28,9 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies
run: cargo install cargo-audit --locked

- name: Audit
run: cargo audit
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ jobs:
wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gcc-13.2.0-6-any.pkg.tar.zst https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gcc-libs-13.2.0-6-any.pkg.tar.zst
pacman -U --noconfirm mingw-w64-x86_64-gcc-13.2.0-6-any.pkg.tar.zst mingw-w64-x86_64-gcc-libs-13.2.0-6-any.pkg.tar.zst

- name: Install dependencies (All)
run: cargo install lychee
Comment on lines +126 to +127
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaning towards not mentioning this in CONTRIBUTING.md since:

  • Wrong links are infrequent
  • This CI will show them anyway


- name: Documentation
run: cargo doc --workspace --all-features --no-deps

Expand All @@ -135,6 +138,14 @@ jobs:
cargo test --all-features --workspace
cargo test --package cuprate-blockchain --no-default-features --features redb --features service

# Run `lychee` at:
# 1. The repo root (excluding `target/`)
# 2. Cuprate's cargo documentation
- name: Lychee
run: |
lychee . --exclude target
lychee target/doc/cuprate_*
Comment on lines +141 to +147
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is put inside ci.yml because we need access to target/doc.

This allows for scanning generated documentation, e.g. rpc/types have links that are generated with macros.


# TODO: upload binaries with `actions/upload-artifact@v3`
- name: Build
run: cargo build --all-features --all-targets --workspace
5 changes: 4 additions & 1 deletion .github/workflows/deny.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This runs `cargo deny check` on all dependencies (only if Cargo deps changed)
# <https://github.com/EmbarkStudios/cargo-deny>

name: Deny

Expand All @@ -12,7 +13,7 @@ env:
CARGO_TERM_COLOR: always

jobs:
audit:
deny:

runs-on: ubuntu-latest

Expand All @@ -27,7 +28,9 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies
run: cargo install cargo-deny --locked

- name: Deny
run: cargo deny check
2 changes: 1 addition & 1 deletion consensus/rules/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn check_block_pow(hash: &[u8; 32], difficulty: u128) -> Result<(), BlockErr

/// Returns the penalty free zone
///
/// <https://cuprate.github.io/monero-book/consensus_rules/blocks/weight_limit.html#penalty-free-zone>
/// <https://monero-book.cuprate.org/consensus_rules/blocks/weights.html#penalty-free-zone>
pub fn penalty_free_zone(hf: &HardFork) -> usize {
if hf == &HardFork::V1 {
PENALTY_FREE_ZONE_1
Expand Down
2 changes: 1 addition & 1 deletion consensus/rules/src/transactions/contextual_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub struct TxRingMembersInfo {
/// - The input amounts are *ALL* 0 (RCT)
/// - The top block hash is the same as when this data was retrieved (the blockchain state is unchanged).
///
/// <https://cuprate.github.io/monero-book/consensus_rules/transactions/decoys.html>
/// <https://cuprate.github.io/monero-book/consensus_rules/transactions/inputs.html>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decoys.html doesn't exist anymore, is this a good replacement?

#[derive(Debug, Copy, Clone)]
pub struct DecoyInfo {
/// The number of inputs that have enough outputs on the chain to mix with.
Expand Down
26 changes: 26 additions & 0 deletions lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Enable link caching. This can be helpful to avoid checking the same links on
# multiple runs.
cache = false

# Verbose program output
# Accepts log level: "error", "warn", "info", "debug", "trace"
verbose = "debug"

# Don't show interactive progress bar while checking links.
no_progress = true

# Exclude URLs and mail addresses from checking (supports regex).
exclude = ["^file", "docs.rs"]

# Exclude these filesystem paths from getting checked.
exclude_path = [
# Contains local link meant for `lib.rs`.
"storage/blockchain/README.md",
# Contains local link.
"books/protocol/src/consensus_rules/transactions/outputs.md",
]

# Exclude all private IPs from checking.
# Equivalent to setting `exclude_private`, `exclude_link_local`, and
# `exclude_loopback` to true.
exclude_all_private = true
Loading