comprehensive-rust
comprehensive-rust copied to clipboard
Check for broken links in CI
After #571 and #917 (thanks @eepeep and @djmitche!), it's becoming clear to me that we should check for broken links in our CI pipeline. The check should catch both 404 Not Found, but also know how to detect broken #fragments since those were the ones that became outdated in the past.
Since links can come and go at any moment, this test will not be super reliable — we might therefore want to only run it when something is merged into main. If it fails, people like me who are subscribed to the repository will get a mail and that should be enough for us to react.
We should take a look at https://github.com/lycheeverse/lychee for this. It looks like it will do everything we need (and more!). In particular, I love that it has a --cache option: we should be able to cache the checks in a GitHub action for 5 or 10 days or so to not spend time checking the same links again and again.
I don't know about lychee, but I've previously used mdbook-linkcheck like this:
https://github.com/google/rust-design-faq/blob/main/book.toml#L21 https://github.com/google/rust-design-faq/blob/main/.github/workflows/main.yml#L23