Skip to content

Commit f741f1e

Browse files
authored
chore: add automated testing for links on markdown documentation (#2537)
1 parent 028d70d commit f741f1e

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

.github/workflows/docs.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,14 @@ jobs:
1414
SHELL: /bin/bash
1515
- name: Exit 1 if not empty
1616
run: git diff --exit-code
17+
markdown-link-check:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- uses: gaurav-nelson/[email protected]
22+
with:
23+
use-quiet-mode: 'yes'
24+
use-verbose-mode: 'yes'
25+
config-file: '.markdownlinkcheck.json'
26+
folder-path: 'docs'
27+
file-extension: '.md'

.markdownlinkcheck.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"ignorePatterns": [
3+
{
4+
"pattern": "^https://github.com/[^/]+/[^/]+/(issues|labels|pull)"
5+
},
6+
{
7+
"pattern": "^http://169.254.42.42/[^/])"
8+
},
9+
{
10+
"pattern": "^https://api.scaleway.com/account/v1"
11+
}
12+
],
13+
"timeout": "20s",
14+
"retryOn429": true,
15+
"retryCount": 5,
16+
"fallbackRetryDelay": "30s",
17+
"aliveStatusCodes": [200, 206]
18+
}

docs/developer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ Be sure to check out the resource you create in each test and remember to delete
3131
When running a test, you might need information such as ID that you cannot know in advance (such as ID of resources).
3232
The `core.Test` uses different helpers to pass useful information around.
3333

34-
One of them is the [`core.testMetadata`](https://github.com/scaleway/scaleway-cli/blob/v2/internal/core/testing.go#L80).
34+
One of them is the [`core.testMetadata`](https://github.com/scaleway/scaleway-cli/blob/master/internal/core/testing.go#L80).
3535
It is designed to store information such as ID or object describing a resource during a test.
3636
This metadata can use the `render` method to provide helpful golang templating features to have commands arguments computed dynamically.
3737

3838
#### BeforeFunc and AfterFunc
3939

4040
Usually, you might need to set up and teardown resources when you are running a test for testing a specific command.
41-
For that you can use [`BeforeFunc`](https://github.com/scaleway/scaleway-cli/blob/v2/internal/core/testing.go#L84) and [`AfterFunc`](https://github.com/scaleway/scaleway-cli/blob/v2/internal/core/testing.go#L86).
41+
For that you can use [`BeforeFunc`](https://github.com/scaleway/scaleway-cli/blob/master/internal/core/testing.go#L100) and [`AfterFunc`](https://github.com/scaleway/scaleway-cli/blob/master/internal/core/testing.go#L102).
4242
Those types allow you to execute code before (`BeforeFunc`) or after (`AfterFunc`) the main command you want to test.
4343
Those functions can access the metadata to change dynamically their behavior.
4444

@@ -75,4 +75,4 @@ If you want to contribute new tests you should have the following:
7575
- Install go for your platform
7676
- Install your credentials, preferably in a configuration file (run `scw init`)
7777
- Keep in mind that if you record interaction, the resource you will instantiate will be delivered and billed.
78-
- Clean up the resource you don't use once the recording is over.
78+
- Clean up the resource you don't use once the recording is over.

0 commit comments

Comments
 (0)