Add a CI workflow for checking links in .rs, .md, and .toml files acc… (#4098)

* Add a CI workflow for checking links in .rs, .md, and .toml files accross esp-hal workspace

fix dead links

* exclude unpublished crate documentation's links

* Add .lycheeignore with excluded links

* play with patterns

* don't forget to remove
This commit is contained in:
Juraj Sadel 2025-09-12 12:48:04 +02:00 committed by GitHub
parent f41c86a902
commit a5a0833318
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 75 additions and 21 deletions

View File

@ -7,7 +7,7 @@ To help us review it efficiently, please ensure you've gone through the followin
- [ ] I have updated existing examples or added new ones (if applicable).
- [ ] I have used `cargo xtask fmt-packages` command to ensure that all changed code is formatted correctly.
- [ ] My changes were added to the [`CHANGELOG.md`](https://github.com/esp-rs/esp-hal/blob/main/esp-hal/CHANGELOG.md) in the **_proper_** section.
- [ ] I have added necessary changes to user code to the [Migration Guide](https://github.com/esp-rs/esp-hal/blob/main/esp-hal/MIGRATING-0.21.md).
- [ ] I have added necessary changes to user code to the latest [Migration Guide](https://github.com/esp-rs/esp-hal/blob/main/esp-hal).
- [ ] My changes are in accordance to the [esp-rs developer guidelines](https://github.com/esp-rs/esp-hal/blob/main/documentation/DEVELOPER-GUIDELINES.md)
#### Extra:

View File

@ -190,3 +190,25 @@ jobs:
# Run host tests for all applicable packages:
- run: cargo xtask host-tests
# --------------------------------------------------------------------------
# Check links in .rs, .md, and .toml files
link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lycheeverse/lychee-action@v2
with:
args: |
--verbose
--no-progress
--format detailed
--timeout 7
--max-concurrency 6
--accept "200,301,302"
--exclude-path ".*/target/.*|.*/static\.files/.*|.*/docs/.*"
'./**/*.rs'
'./**/*.md'
'./**/*.toml'

28
.lycheeignore Normal file
View File

@ -0,0 +1,28 @@
# Local/private network addresses
# Local/private network addresses (protocol-aware)
^https?://localhost
^https?://127\.0\.0\.1
^https?://0\.0\.0\.0
.*\.local
^https?://192\.168\..*
^https?://10\..*
^https?://172\.(1[6-9]|2[0-9]|3[0-1])\..*
# Template placeholders
%7B[^%]+%7D
\{[^}]+\}
# GitHub compare links (ignore only these)
^https://github\.com/.*/compare/.*\.\.\..*
# GitHub patterns
releases/tag/$
# Shield.io badges
img\.shields\.io/badge/MSRV-
# TODO: remove once released
docs\.espressif\.com/projects/rust/esp-preempt/latest/
docs\.espressif\.com/projects/rust/esp-radio-preempt-driver/latest/
docs\.espressif\.com/projects/rust/esp-radio/latest/
docs\.espressif\.com/projects/rust/esp-sync/latest/

View File

@ -54,7 +54,7 @@ When browsing the examples, we recommend viewing the tag for the `esp-hal` relea
- [The Embedded Rust Book](https://docs.rust-embedded.org/book/index.html)
- [The Embedonomicon](https://docs.rust-embedded.org/embedonomicon/)
- [The Rust on ESP Book](https://docs.espressif.com/projects/rust/esp-hal/latest/)
- [Embedded Rust (no_std) on Espressif](https://esp-rs.github.io/no_std-training/)
- [Embedded Rust (no_std) on Espressif](https://docs.espressif.com/projects/rust/no_std-training/)
## Contributing

View File

@ -126,7 +126,7 @@ This will use `rustfmt` to ensure that all source code is formatted correctly pr
* Resolve merge conflicts if they arise, using resources like [this git tutorial] for help.
[Link your PR]: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
[Allow edits from maintainers]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-forkmember
[Allow edits from maintainers]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork#enabling-repository-maintainer-permissions-on-existing-pull-requests
[Changelog]: esp-hal/CHANGELOG.md
[migration guide]: esp-hal/MIGRATING-0.20.md
[suggested changes]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request

View File

@ -39,7 +39,6 @@ mod calibration;
// https://github.com/espressif/esp-idf/blob/903af13e8/components/soc/esp32c3/include/soc/regi2c_saradc.h
// https://github.com/espressif/esp-idf/blob/903af13e8/components/soc/esp32c6/include/soc/regi2c_saradc.h
// https://github.com/espressif/esp-idf/blob/903af13e8/components/soc/esp32h2/include/soc/regi2c_saradc.h
// https://github.com/espressif/esp-idf/blob/903af13e8/components/soc/esp32h4/include/soc/regi2c_saradc.h
cfg_if::cfg_if! {
if #[cfg(adc_adc1)] {
const ADC_VAL_MASK: u16 = 0xfff;

View File

@ -17,7 +17,7 @@
//! Visit the [Debug Assist] example for an example of using the Debug
//! Assistant.
//!
//! [Debug Assist]: https://github.com/esp-rs/esp-hal/blob/main/examples/src/bin/debug_assist.rs
//! [Debug Assist]: https://github.com/esp-rs/esp-hal/blob/main/examples/peripheral/debug_assist/src/main.rs
//!
//! ## Implementation State
//! - Bus write access logging is not available via this API

View File

@ -30,7 +30,7 @@
//! ## Examples
//! Visit the [HMAC] example to learn how to use the HMAC accelerator
//!
//! [HMAC]: https://github.com/esp-rs/esp-hal/blob/main/examples/src/bin/hmac.rs
//! [HMAC]: https://github.com/esp-rs/esp-hal/blob/main/examples/peripheral/hmac/src/main.rs
use core::convert::Infallible;

View File

@ -31,7 +31,7 @@
//! Visit the [USB Serial] example for an example of using the USB OTG
//! peripheral.
//!
//! [USB Serial]: https://github.com/esp-rs/esp-hal/blob/main/examples/src/bin/usb_serial.rs
//! [USB Serial]: https://github.com/esp-rs/esp-hal/blob/main/examples/peripheral/usb_serial/src/main.rs
//!
//! ## Implementation State
//! - Low-speed (LS) is not supported.

View File

@ -17,7 +17,7 @@
//! detailed study of how to use this LP Core please visit [the repository
//! with corresponding example].
//!
//! [the repository with corresponding example]: https://github.com/esp-rs/esp-hal/blob/main/examples/src/bin/lp_core_basic.rs
//! [the repository with corresponding example]: https://github.com/esp-rs/esp-hal/blob/main/examples/peripheral/lp_core/src/main.rs
use crate::peripherals::{LP_AON, LP_CORE, LP_PERI, LPWR, PMU};

View File

@ -97,7 +97,7 @@ fn main() -> Result<(), Box<dyn Error>> {
{
let message = format!(
"esp-radio should be built with optimization level 2, 3 or s - yours is {level}.
See https://github.com/esp-rs/esp-radio",
See https://github.com/esp-rs/esp-hal/tree/main/esp-radio",
);
print_warning(message);
}

View File

@ -30,6 +30,7 @@ const SSID: &str = env!("SSID");
const PASSWORD: &str = env!("PASSWORD");
const STATIC_IP: &str = env!("STATIC_IP");
const GATEWAY_IP: &str = env!("GATEWAY_IP");
const FERRIS_GIF: &str = "https://rustacean.net/more-crabby-things/dancing-ferris.gif";
#[main]
fn main() -> ! {
@ -158,16 +159,20 @@ fn main() -> ! {
}
if !time_out {
socket.write_all(
b"HTTP/1.0 200 OK\r\n\r\n\
<html>\
<body>\
<h1>Hello Rust! Hello esp-radio!</h1>\
<img src=\"https://rustacean.net/more-crabby-things/dancing-ferris.gif\"/>
</body>\
</html>\r\n\
"
).unwrap();
if !time_out {
write!(
socket,
"HTTP/1.0 200 OK\r\n\r\n\
<html>\
<body>\
<h1>Hello Rust! Hello esp-radio!</h1>\
<img src=\"{}\"/>\
</body>\
</html>\r\n",
FERRIS_GIF
)
.unwrap();
}
socket.flush().unwrap();
}

View File

@ -56,7 +56,7 @@ fn main() {
match args.extcap.run().unwrap() {
ExtcapStep::Interfaces(interfaces_step) => {
let metadata = Metadata {
help_url: "http://github.com/esp-rs/esp-radio".into(),
help_url: "https://github.com/esp-rs/esp-hal/tree/main/esp-radio".into(),
display_description: "esp-radio".into(),
..r_extcap::cargo_metadata!()
};

View File

@ -56,7 +56,7 @@ fn main() {
match args.extcap.run().unwrap() {
ExtcapStep::Interfaces(interfaces_step) => {
let metadata = Metadata {
help_url: "http://github.com/esp-rs".into(),
help_url: "https://github.com/esp-rs/esp-hal/tree/main/esp-radio/src/ieee802154".into(),
display_description: "esp-ieee802154".into(),
..r_extcap::cargo_metadata!()
};