Skip to content

Commit 0483882

Browse files
authored
[skip changelog] Add task and workflow to check for dead links in docs (#878)
* [skip changelog] Add task and workflow to check for dead links in docs * [skip changelog] Fix link checking task and workflow * [skip changelog] Fix some documentation links
1 parent eef3705 commit 0483882

11 files changed

+101
-19
lines changed
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Verifies documentation links
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
schedule:
9+
- cron: "0 3 * * 1" # Every Monday at 03:00
10+
11+
jobs:
12+
verify-links:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 1
18+
19+
- name: Install Taskfile
20+
uses: Arduino/actions/setup-taskfile@master
21+
with:
22+
repo-token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Install Go
25+
uses: actions/setup-go@v2
26+
with:
27+
go-version: "1.14"
28+
29+
- name: Installs Go dependencies
30+
shell: bash
31+
run: go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
32+
33+
- name: Install protoc compiler
34+
uses: arduino/setup-protoc@v1.1.0
35+
with:
36+
repo-token: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Setup Python
39+
uses: actions/setup-python@v1
40+
with:
41+
python-version: "3.6"
42+
architecture: "x64"
43+
44+
- name: Cache dependencies
45+
uses: actions/cache@v1
46+
with:
47+
path: ~/.cache/pip
48+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
49+
restore-keys: |
50+
${{ runner.os }}-pip-
51+
52+
- name: Install Python dependencies
53+
run: |
54+
python3 -m pip install --upgrade pip
55+
python3 -m pip install -r ./requirements_docs.txt
56+
57+
- name: Build docs
58+
run: task docs:build
59+
60+
- name: Verify links
61+
run: task docs:check-links

Taskfile.yml

+12
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ tasks:
5454
cmds:
5555
- npx {{ .PRETTIER }} --check "**/*.md"
5656

57+
docs:check-links:
58+
desc: Verifies there are no dead links in documentation
59+
cmds:
60+
- |
61+
npx -p markdown-link-check -c '
62+
STATUS=0
63+
for file in $(find -name "*.md"); do
64+
markdown-link-check -c markdown-link-check-config.json -q "$file"
65+
STATUS=$(( $STATUS + $? ))
66+
done
67+
exit $STATUS'
68+
5769
docs:format:
5870
desc: Automatically formats documentation
5971
cmds:

docs/CONTRIBUTING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ If you don't see any error, hit http://127.0.0.1:8000 with your browser to navig
218218
### Docs publishing
219219

220220
The present git repository has a special branch called `gh-pages` that contains the generated HTML code for the docs
221-
website; every time a change is pushed to this special branch, GitHub automatically triggers a [deployment][8] to pull
222-
the change and publish a new version of the website. Do not open Pull Requests to push changes to the `gh-pages` branch,
221+
website; every time a change is pushed to this special branch, GitHub automatically triggers a deployment to pull the
222+
change and publish a new version of the website. Do not open Pull Requests to push changes to the `gh-pages` branch,
223223
that will be done exclusively from the CI.
224224

225225
### Docs versioning
@@ -342,7 +342,6 @@ If your PR doesn't need to be included in the changelog, please start the PR tit
342342
[5]: https://github.com/ofek/hatch
343343
[6]: https://github.com/protocolbuffers/protobuf/releases
344344
[7]: https://pages.github.com/
345-
[8]: https://github.com/arduino/arduino-cli/deployments?environment=github-pages#activity-log
346345
[9]: https://www.mkdocs.org/
347346
[10]: https://github.com/jimporter/mike
348347
[11]: https://github.com/arduino/arduino-cli/blob/master/.github/workflows/docs.yaml

docs/configuration.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ additional_urls = [ "https://downloads.arduino.cc/packages/package_staging_index
126126

127127
[grpc]: https://grpc.io
128128
[sketchbook directory]: sketch-specification.md#sketchbook
129-
[arduino-cli config dump]: ../commands/arduino-cli_config_dump
130-
[arduino cli command reference]: ../commands/arduino-cli
131-
[arduino-cli global flags]: ../commands/arduino-cli_config/#options-inherited-from-parent-commands
129+
[arduino-cli config dump]: commands/arduino-cli_config_dump.md
130+
[arduino cli command reference]: commands/arduino-cli.md
131+
[arduino-cli global flags]: commands/arduino-cli_config.md#options-inherited-from-parent-commands
132132
[export command]: https://ss64.com/bash/export.html
133133
[set command]: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1
134-
[arduino-cli config init]: ../commands/arduino-cli_config_init
134+
[arduino-cli config init]: commands/arduino-cli_config_init.md
135135
[json]: https://www.json.org
136136
[toml]: https://github.com/toml-lang/toml
137137
[yaml]: https://en.wikipedia.org/wiki/YAML

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ services and messages are detailed in the [gRPC reference] pages.
1717
[installation]: installation.md
1818
[getting started guide]: getting-started.md
1919
[client_example]: https://github.com/arduino/arduino-cli/blob/master/client_example
20-
[grpc reference]: rpc/commands
20+
[grpc reference]: rpc/commands.md

docs/integration-options.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ tracker] if you’ve got a use case that doesn’t fit one of the three pillars.
9595
[configuration documentation]: configuration.md
9696
[json]: https://www.json.org
9797
[installation script]: installation.md#use-the-install-script
98-
[command reference]: ../commands/arduino-cli
98+
[command reference]: commands/arduino-cli.md
9999
[grpc]: https://grpc.io/
100100
[rpc]: https://en.wikipedia.org/wiki/Remote_procedure_call
101-
[daemon mode]: ../commands/arduino-cli_daemon
101+
[daemon mode]: commands/arduino-cli_daemon.md
102102
[grpc interface reference]: ../rpc/commands
103103
[grpc supported languages]: https://grpc.io/docs/languages/
104104
[arduino cli repository]: https://github.com/arduino/arduino-cli

docs/library-specification.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This new library format is intended to be used in tandem with **Library Manager*
99
The Library Manager allows users to automatically download and install libraries needed in their projects, with an easy
1010
to use graphic interface in the [Arduino IDE](https://www.arduino.cc/en/guide/libraries#toc3)/Pro IDE and
1111
[Arduino Web Editor](https://create.arduino.cc/projecthub/Arduino_Genuino/getting-started-with-arduino-web-editor-on-various-platforms-4b3e4a#toc-libraries-and-the-arduino-web-editor-11)
12-
as well as [`arduino-cli lib`](../commands/arduino-cli_lib).
12+
as well as [`arduino-cli lib`](commands/arduino-cli_lib.md).
1313

1414
More information about how Library Manager works is available
1515
[here](https://github.com/arduino/Arduino/wiki/Library-Manager-FAQ).
@@ -22,7 +22,7 @@ code to specific architectures.
2222
## See also
2323

2424
- [Arduino library style guide](http://arduino.cc/en/Reference/APIStyleGuide)
25-
- [Library dependency resolution process documentation](../sketch-build-process/#dependency-resolution)
25+
- [Library dependency resolution process documentation](sketch-build-process.md#dependency-resolution)
2626

2727
## 1.5 library format (rev. 2.2)
2828

@@ -70,7 +70,7 @@ otherwise below, **all fields are required**. The available fields are:
7070
- **depends** - **(available from Arduino IDE 1.8.10/Arduino CLI 0.7.0)** (optional) a comma-separated list of
7171
dependencies (libraries that are needed to build the current library). The Arduino IDE's Library Manager will offer to
7272
install the dependencies during installation of the library.
73-
[`arduino-cli lib install`](../commands/arduino-cli_lib_install) will automatically install the dependencies. Since
73+
[`arduino-cli lib install`](commands/arduino-cli_lib_install.md) will automatically install the dependencies. Since
7474
spaces are allowed in the `name` of a library, but not commas, you can refer to libraries containing spaces in the
7575
name without ambiguity for example:<br> `depends=Very long library name, Another library with long-name`
7676
- **dot_a_linkage** - **(available from Arduino IDE 1.6.0 / arduino-builder 1.0.0-beta13)** (optional) when set to

docs/platform-specification.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ The following meta-data must be defined:
116116
version=1.5.3
117117

118118
The **name** will be shown as the Arduino IDE's Board menu section title or the Name field of
119-
[`arduino-cli core list`](../commands/arduino-cli_core_list)'s output for the platform.<br> The **version** is currently
119+
[`arduino-cli core list`](commands/arduino-cli_core_list.md)'s output for the platform.<br> The **version** is currently
120120
unused, it is reserved for future use (probably together with the Boards Manager to handle dependencies on cores).
121121

122122
### Build process
@@ -592,7 +592,7 @@ If the user didn't enable verbose mode, then **{upload.params.quiet}** is used i
592592
### Sketch upload configuration
593593

594594
The Upload action is triggered when the user clicks on the "Upload" button on the IDE toolbar or uses
595-
[`arduino-cli upload`](../commands/arduino-cli_upload). Arduino uses the term "upload" for the process of transferring a
595+
[`arduino-cli upload`](commands/arduino-cli_upload.md). Arduino uses the term "upload" for the process of transferring a
596596
program to the Arduino board. The **upload.tool** property determines the tool to be used for upload. A specific
597597
**upload.tool** property should be defined for every board in boards.txt:
598598

@@ -685,7 +685,7 @@ support uploading via programmer.
685685
### Serial port
686686

687687
The full path (e.g., `/dev/ttyACM0`) of the port selected via the IDE or
688-
[`arduino-cli upload`](../commands/arduino-cli_upload)'s `--port` option is available as a configuration property
688+
[`arduino-cli upload`](commands/arduino-cli_upload.md)'s `--port` option is available as a configuration property
689689
**{serial.port}**.
690690

691691
The file component of the port's path (e.g., `ttyACM0`) is available as the configuration property

docs/sketch-build-process.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The "folder name priority" is determined as follows (in order of highest to lowe
103103
The "location priority" is determined as follows (in order of highest to lowest priority):
104104

105105
1. The library is in a custom libraries path specified via the
106-
[`--libraries` option](../commands/arduino-cli_compile/#options) of `arduino-cli compile` (in decreasing order of
106+
[`--libraries` option](commands/arduino-cli_compile.md#options) of `arduino-cli compile` (in decreasing order of
107107
priority when multiple custom paths are defined)
108108
1. The library is in the `libraries` subfolder of the IDE's sketchbook or Arduino CLI's user directory
109109
1. The library is bundled with the board platform/core

docs/sketch-specification.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ Arduino CLI and Arduino Web Editor use a file named sketch.json, located in the
6666
metadata.
6767

6868
The `cpu` key contains the board configuration information. This can be set via
69-
[`arduino-cli board attach`](../commands/arduino-cli_board_attach/) or by selecting a board in the Arduino Web Editor
69+
[`arduino-cli board attach`](commands/arduino-cli_board_attach.md) or by selecting a board in the Arduino Web Editor
7070
while the sketch is open. With this configuration set, it is not necessary to specify the `--fqbn` or `--port` flags to
71-
the [`arduino-cli compile`](../commands/arduino-cli_compile/) or [`arduino-cli upload`](../commands/arduino-cli_upload/)
71+
the [`arduino-cli compile`](commands/arduino-cli_compile.md) or [`arduino-cli upload`](commands/arduino-cli_upload.md)
7272
commands when compiling or uploading the sketch.
7373

7474
The `included_libs` key defines the library versions the Arduino Web Editor uses when the sketch is compiled. This is

markdown-link-check-config.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"ignorePatterns": [
3+
{
4+
"pattern": "https?://localhost:\\d*/"
5+
},
6+
{
7+
"pattern": "https?://(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?):\\d*"
8+
}
9+
]
10+
}

0 commit comments

Comments
 (0)