-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripts to verify anchors in CI (#3128)
* add link anchor check in CI * fix 29 anchors
- Loading branch information
Showing
29 changed files
with
61 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,23 @@ version: 2 | |
jobs: | ||
lint: | ||
docker: | ||
- image: circleci/ruby:2.4.1-node | ||
- image: circleci/node:lts | ||
working_directory: ~/pingcap/docs | ||
steps: | ||
- checkout | ||
|
||
- run: | ||
name: Setup | ||
command: | | ||
mkdir ~/.npm-global | ||
npm config set prefix '~/.npm-global' | ||
echo 'export PATH=~/.npm-global/bin:$PATH' >> $BASH_ENV | ||
echo 'export NODE_PATH=~/.npm-global/lib/node_modules:$NODE_PATH' >> $BASH_ENV | ||
- run: | ||
name: "Install markdownlint" | ||
command: | | ||
sudo npm install -g [email protected] | ||
npm install -g [email protected] | ||
- run: | ||
name: "Lint README" | ||
|
@@ -29,6 +37,11 @@ jobs: | |
command: | | ||
scripts/verify-links.sh | ||
- run: | ||
name: "Check link anchors" | ||
command: | | ||
scripts/verify-link-anchors.sh | ||
build: | ||
docker: | ||
- image: andelf/doc-build:0.1.9 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
# | ||
# In addition to verify-links.sh, this script additionally check anchors. | ||
# | ||
# See https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally if you meet permission problems when executing npm install. | ||
|
||
ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd) | ||
cd $ROOT | ||
|
||
npm install -g remark-cli remark-lint breeswish/remark-lint-pingcap-docs-anchor | ||
|
||
echo "info: checking links anchors under $ROOT directory..." | ||
|
||
remark --ignore-path .gitignore -u lint -u remark-lint-pingcap-docs-anchor . --frail --quiet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,13 +10,12 @@ | |
# - When a file was moved, all other references are required to be updated for now, even if alias are given | ||
# - This is recommended because of less redirects and better anchors support. | ||
# | ||
# See https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally if you meet permission problems when executing npm install. | ||
|
||
ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd) | ||
cd $ROOT | ||
|
||
if ! which markdown-link-check &>/dev/null; then | ||
sudo npm install -g [email protected] | ||
fi | ||
npm install -g [email protected] | ||
|
||
VERBOSE=${VERBOSE:-} | ||
CONFIG_TMP=$(mktemp) | ||
|
@@ -50,7 +49,7 @@ fi | |
while read -r tasks; do | ||
for task in $tasks; do | ||
( | ||
output=$(markdown-link-check --color --config "$CONFIG_TMP" "$task" -q) | ||
output=$(markdown-link-check --config "$CONFIG_TMP" "$task" -q) | ||
if [ $? -ne 0 ]; then | ||
printf "$output" >> $ERROR_REPORT | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.