Skip to content

Commit

Permalink
CI: check links
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Apr 18, 2024
1 parent 2bd9ee6 commit ccd3c09
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copied from https://github.com/rerun-io/rerun_template
on: [push, pull_request]

name: Link checker

jobs:
link-checker:
name: Check links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Restore link checker cache
uses: actions/cache@v3
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

# Check https://github.com/lycheeverse/lychee on how to run locally.
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1.9.0
with:
fail: true
lycheeVersion: "0.14.3"
# When given a directory, lychee checks only markdown, html and text files, everything else we have to glob in manually.
args: |
--base . --cache --max-cache-age 1d . "**/*.rs" "**/*.toml" "**/*.hpp" "**/*.cpp" "**/CMakeLists.txt" "**/*.py" "**/*.yml"
61 changes: 61 additions & 0 deletions lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copied from https://github.com/rerun-io/rerun_template

################################################################################
# Config for the link checker lychee.
#
# Download & learn more at:
# https://github.com/lycheeverse/lychee
#
# Example config:
# https://github.com/lycheeverse/lychee/blob/master/lychee.example.toml
#
# Run `lychee . --dump` to list all found links that are being checked.
#
# Note that by default lychee will only check markdown and html files,
# to check any other files you have to point to them explicitly, e.g.:
# `lychee **/*.rs`
# To make things worse, `exclude_path` is ignored for these globs,
# so local runs with lots of gitignored files will be slow.
# (https://github.com/lycheeverse/lychee/issues/1405)
#
# This unfortunately doesn't list anything for non-glob checks.
################################################################################

# Maximum number of concurrent link checks.
# Workaround for "too many open files" error on MacOS, see https://github.com/lycheeverse/lychee/issues/1248
max_concurrency = 32

# Check links inside `<code>` and `<pre>` blocks as well as Markdown code blocks.
include_verbatim = true

# Proceed for server connections considered insecure (invalid TLS).
insecure = true

# Exclude these filesystem paths from getting checked.
exclude_path = [
# Unfortunately lychee doesn't yet read .gitignore https://github.com/lycheeverse/lychee/issues/1331
# The following entries are there because of that:
".git",
"__pycache__",
"_deps/",
".pixi",
"build",
"target_ra",
"target_wasm",
"target",
"venv",
]

# Exclude URLs and mail addresses from checking (supports regex).
exclude = [
# Local links that require further setup.
'http://127.0.0.1',
'http://localhost',

# Api endpoints.
'https://fonts.googleapis.com/', # Font API entrypoint, not a link.
'https://fonts.gstatic.com/', # Font API entrypoint, not a link.

# Avoid rate limiting.
'https://crates.io/crates/.*', # Avoid crates.io rate-limiting
]

0 comments on commit ccd3c09

Please sign in to comment.