Skip to content
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

Fixed #2364 by adding a Github workflow for checking dead links #2406

Merged
merged 9 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/go-test-setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
runs:
using: "composite"
steps:
- name: increase the UDP receive buffer size # see https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size
- name: increase the UDP receive buffer size # see https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes
SahibYar marked this conversation as resolved.
Show resolved Hide resolved
shell: bash
run: sysctl -w net.core.rmem_max=2500000
if: ${{ matrix.os == 'ubuntu' }}
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Markdown Link Checking
on:
pull_request:
push:
branches:
- "master"
schedule:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we want this on a schedule? Seems fine to do it on PRs. That will be more often than at 9am on the second day of the month.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this based on a comment from @marten-seemann on ticket.
#2364 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a need to revert this change ?
5ea669d

# runs once in a couple of days at 9am
SahibYar marked this conversation as resolved.
Show resolved Hide resolved
- cron: '0 9 */2 * *'

jobs:
check-links:
if: '!cancelled()' # https://stackoverflow.com/a/58859404/2949645
SahibYar marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes' # show only broken links
use-verbose-mode: 'yes'
config-file: .github/workflows/markdown-links-config.json # for removing any false positives
25 changes: 25 additions & 0 deletions .github/workflows/markdown-links-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"ignorePatterns": [
{
"pattern": "^http://localhost"
},
{
"pattern": "^https://twitter.com/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

@SahibYar SahibYar Jul 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we don't add this, our workflow will always fail because

curl --verbose --location 'https://twitter.com/awalterschulze/status/1584553056100057088'

My Github action was showing error like this

FILE: ./CHANGELOG.md
[✖] https://github.com/libp2p/go-libp2p/blob/master/p2p/net/swarm/grafana-dashboards/swarm.json → Status: 404
[✖] https://github.com/libp2p/go-libp2p/blob/master/p2p/host/eventbus/grafana-dashboards/eventbus.json → Status: 404
[✖] https://twitter.com/awalterschulze/status/1584553056100057088 → Status: 0 Error: Exceeded maxRedirects. Probably stuck in a redirect loop https://twitter.com/awalterschulze/status/1584553056100057088
    at Redirect.onResponse (/usr/local/lib/node_modules/markdown-link-check/node_modules/request/lib/redirect.js:98:27)
    at Request.onRequestResponse (/usr/local/lib/node_modules/markdown-link-check/node_modules/request/request.js:986:22)
    at ClientRequest.emit (node:events:513:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:701:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    at TLSSocket.socketOnData (node:_http_client:542:22)
    at TLSSocket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)

132 links checked.

ERROR: 3 dead links found!
[✖] https://github.com/libp2p/go-libp2p/blob/master/p2p/net/swarm/grafana-dashboards/swarm.json → Status: 404
[✖] https://github.com/libp2p/go-libp2p/blob/master/p2p/host/eventbus/grafana-dashboards/eventbus.json → Status: 404
[✖] https://twitter.com/awalterschulze/status/[158](https://github.com/SahibYar/go-libp2p/actions/runs/5433440994/jobs/9881111425#step:4:159)4553056100057088 → Status: 0

Details: gaurav-nelson/github-action-markdown-link-check#182 (comment)

Copy link
Collaborator

@MarcoPolo MarcoPolo Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Twitter links are auth-walled so there's no way to check if the link works

},
{
"pattern": "^gaurav-nelson/"
SahibYar marked this conversation as resolved.
Show resolved Hide resolved
}
],
"aliveStatusCodes": [403, 429, 200],
SahibYar marked this conversation as resolved.
Show resolved Hide resolved
"httpHeaders": [
{
"urls": [
"https://docs.github.com/",
"https://opensource.org/"
],
"headers": {
"Accept-Encoding": "zstd, br, gzip, deflate"
SahibYar marked this conversation as resolved.
Show resolved Hide resolved
}
}
]
}
2 changes: 1 addition & 1 deletion test-plans/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ of these nodes with the other version's interop test.
# Running all interop tests locally with Compose

To run this test against all released libp2p versions you'll need to have the
(libp2p/test-plans)[https://github.com/libp2p/test-plans] checked out. Then do
[libp2p/test-plans](https://github.com/libp2p/test-plans) checked out. Then do
the following (from the root directory of this repository):

1. Build the image: `docker build -t go-libp2p-head -f test-plans/PingDockerfile .`.
Expand Down