-
Notifications
You must be signed in to change notification settings - Fork 2.1k
chore: add internal markdown link check #21831
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
Changes from all commits
038894f
296c651
0333673
31a303b
6b04cf6
33a9b6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| ROOT_DIR="$(git rev-parse --show-toplevel)" | ||
|
|
||
| cd "${ROOT_DIR}" | ||
|
|
||
| MARKDOWN_FILES=() | ||
| while IFS= read -r file; do | ||
| MARKDOWN_FILES+=("${file}") | ||
| done < <( | ||
| git -C "${ROOT_DIR}" ls-files 'README.md' 'CONTRIBUTING.md' 'docs/**/*.md' 'datafusion-cli/README.md' 'datafusion-examples/README.md' 'dev/**/*.md' | ||
| ) | ||
|
|
||
| lychee --no-progress --config "${ROOT_DIR}/lychee.toml" "${MARKDOWN_FILES[@]}" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: These paths are relative to the repository root, but
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes sense @Weijun-H, i just added |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,6 +186,34 @@ tested in the same way using the [doc_comment] crate. See the end of | |
| [doc_comment]: https://docs.rs/doc-comment/latest/doc_comment | ||
| [core/src/lib.rs]: https://github.com/apache/datafusion/blob/main/datafusion/core/src/lib.rs#L583 | ||
|
|
||
| ## Documentation Link Checks | ||
|
|
||
| Run the internal markdown link check locally: | ||
|
|
||
| ```shell | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is very nice
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for local we need to document mapfile is needed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and also mapfile is not available on macOS
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and cargo install lychee |
||
| source ci/scripts/utils/tool_versions.sh | ||
| cargo install lychee --locked --version "${LYCHEE_VERSION}" | ||
| bash ci/scripts/markdown_link_check.sh | ||
| ``` | ||
|
|
||
| Notes: | ||
|
|
||
| - The script is run with `bash` and is compatible with the default Bash on macOS (no `mapfile` dependency). | ||
| - The CI configuration currently checks internal markdown links only. External `http(s)` and `mailto` links are excluded to avoid flaky failures. | ||
|
|
||
| When a link is broken, lychee prints the file and URL/path that failed. For example: | ||
|
|
||
| ```text | ||
| [docs/source/user-guide/cli/overview.md]: | ||
| [ERROR] file:///.../docs/source/user-guide/cli/missing-page.md | Cannot find file: File not found. Check if file exists and path is correct | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, lychee doesn't refer to a specific line in the md file?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is some sample file name, but when there is link broken it will not show line number, but exactly file name and link broken line, but not number. |
||
| ``` | ||
|
|
||
| Rust doc comments are validated by rustdoc in CI and can be checked locally with: | ||
|
|
||
| ```shell | ||
| bash ci/scripts/rust_docs.sh | ||
| ``` | ||
|
|
||
| ## Benchmarks | ||
|
|
||
| ### Criterion Benchmarks | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| timeout = 20 | ||
| max_retries = 2 | ||
| retry_wait_time = 2 | ||
|
|
||
| exclude_path = [ | ||
| "target", | ||
| "docs/build", | ||
| "datafusion/core/benches/tpch-csv", | ||
| ] | ||
|
|
||
| exclude = [ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not check http and https links?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i already had talk with @comphead in the #21747 (comment) i excluded external links because they frequently cause flaky CI runs. Things like temporary network hiccups, third-party site downtime, or github API rate limits (429 Too Many Requests) can lead to false positives and unnecessarily block PRs. anyway, if you prefer stricter validation and don't mind the occasional flakiness, I'm happy to remove these exclusions, we can always just ignore specific flaky domains as they pop up. Let me know how you'd like to proceed. |
||
| "^http://", | ||
| "^https://", | ||
| "^mailto:", | ||
| ] | ||
Uh oh!
There was an error while loading. Please reload this page.