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

ci: added a link-check ci #297

Closed
wants to merge 15 commits into from
Closed

Conversation

Gmin2
Copy link
Contributor

@Gmin2 Gmin2 commented Feb 8, 2024

Fixes #103

follow up to #291

@Relequestual
Copy link
Member

Relequestual commented Feb 9, 2024

Thanks for your contribution! =]

I think this is blocked by #295

If we merged this before actually fixing links, it would block PRs till the bad links are fixed, I think.

@Gmin2
Copy link
Contributor Author

Gmin2 commented Feb 9, 2024

If we merged this before actually fixing links, it would block PRs till the bad links are fixed, I think.

Lets wait for #295 to be solved

@DarhkVoyd
Copy link
Member

Hey, I am not sure if linkinator is the right tool for checking broken links for our use-case.

@Gmin2
Copy link
Contributor Author

Gmin2 commented Feb 9, 2024

Hey, I am not sure if linkinator is the right tool for checking broken links for our use-case.

reason will be appreciated @DarhkVoyd

@Gmin2
Copy link
Contributor Author

Gmin2 commented Feb 11, 2024

Hey @Relequestual can you review it made some changes here

pages/blog/posts/bowtie-intro.md Outdated Show resolved Hide resolved
.lycheeignore Show resolved Hide resolved
.github/workflows/link-check.yml Show resolved Hide resolved
@Relequestual Relequestual self-requested a review February 12, 2024 09:15
Copy link
Member

@Relequestual Relequestual left a comment

Choose a reason for hiding this comment

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

Moving in the right direction. Made a few comments for change. Thanks for your continued effort on this work! =D

@Gmin2
Copy link
Contributor Author

Gmin2 commented Feb 23, 2024

@Relequestual made some changes a review will be appreciated and left some comment in the code

Copy link
Collaborator

@benjagm benjagm left a comment

Choose a reason for hiding this comment

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

We very close. Nice job!

Left some comment.

.lycheeignore Show resolved Hide resolved
pages/blog/posts/bowtie-intro.md Outdated Show resolved Hide resolved
.github/workflows/link-check.yml Outdated Show resolved Hide resolved
.github/workflows/link-check.yml Show resolved Hide resolved
.github/workflows/link-check.yml Show resolved Hide resolved
Copy link
Collaborator

@benjagm benjagm left a comment

Choose a reason for hiding this comment

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

I havent tested it but looks good to me.

pages/blog/posts/bowtie-intro.md Outdated Show resolved Hide resolved
@aialok
Copy link
Collaborator

aialok commented Mar 4, 2024

Thank you for your changes, @utnim2. To ensure that the Build Job doesn't fail, we need to include an additional line to fetch submodules during the repository checkout process. Adding the following line will resolve the issue:

- name: Checkout repository
  uses: actions/checkout@v4
  with:
    submodules: recursive

Checkout this for more details : #297 (comment)

- name: Build Next.js App
run: yarn build

- name: Serve App Locally
Copy link
Collaborator

@aialok aialok Mar 4, 2024

Choose a reason for hiding this comment

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

I think you need to remove this steps and add this to linkchecker job as we need our app to run locally so that linkchecker can do it job.

Suggested change
- name: Serve App Locally
Remove this step

Here no need to run app locally.

Copy link
Contributor Author

@Gmin2 Gmin2 Mar 4, 2024

Choose a reason for hiding this comment

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

Thanks for your review @aialok

no we need to first build and deploy it here and pass the deployed url in the linkchecker action (i have put localhost:3000 as of now)

The deploy step is missing here as the deployment is not yet clear

@aialok

Copy link
Member

@DarhkVoyd DarhkVoyd Mar 4, 2024

Choose a reason for hiding this comment

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

Yes, I too agree with you regarding to need to build and deploy locally.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for your review @aialok

no we need to first build and deploy it here and pass the deployed url in the linkchecker action (i have put localhost:3000 as of now)

The deploy step is missing here as the deployment is not yet clear

@aialok

Got it man. But I still have one doubt what do you mean by deploy locally. Deploy locally means running on localhost?

Thank you @utnim2. You have done pretty good job : )

uses: actions/checkout@v4
with:
submodules: recursive

Copy link
Collaborator

@aialok aialok Mar 4, 2024

Choose a reason for hiding this comment

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

Add steps to run our app locally, as we need it to run locally since most of our links are based on localhost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see comment here

Copy link
Collaborator

@aialok aialok left a comment

Choose a reason for hiding this comment

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

@utnim2 , See Comment : )

@aialok
Copy link
Collaborator

aialok commented Mar 4, 2024

With reference to this comment : #297 (comment)

I think we do already deploy our app on cloudflare.
We can directly use https://json-schema.org/ instead of this http://localhost:3000 as suggested in comment: #297 (comment)

@utnim2 @DarhkVoyd

@DarhkVoyd
Copy link
Member

With reference to this comment : #297 (comment)

I think we do already deploy our app on cloudflare. We can directly use https://json-schema.org/ instead of this http://localhost:3000 as suggested in comment: #297 (comment)

@utnim2 @DarhkVoyd

Please refer to #297 (comment)

@aialok
Copy link
Collaborator

aialok commented Mar 4, 2024

With reference to this comment : #297 (comment)
I think we do already deploy our app on cloudflare. We can directly use https://json-schema.org/ instead of this http://localhost:3000 as suggested in comment: #297 (comment)
@utnim2 @DarhkVoyd

Please refer to #297 (comment)

My Bad...Got it : )

@benjagm benjagm requested review from DarhkVoyd and aialok March 5, 2024 16:18
Copy link
Member

@DarhkVoyd DarhkVoyd left a comment

Choose a reason for hiding this comment

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

Hello @benjagm @utnim2 @aialok

This PR was quite difficult and posed some challenges during review. So, please bear with me if I make some mistakes and I appreciate your patience as I worked through it. Below are my findings, change requests, and suggestions:

  1. We should consider either merging the two jobs or rebuilding and serving the website again in the second job to address post-action cleanup in the workflow.
  2. Despite the expected downtime of our served website due to post-cleanup actions, the initial job fails to serve the website. The current workflow experiences a silent failure in the first job due to a command not found error when serving the website.
    Upon investigation, it appears that the serve package, utilized in our package.json for local website deployment, is missing from our dependencies. This absence is the root cause of the deployment failure. To resolve this issue, we must ensure the inclusion of the serve package in our dependencies.
  3. Given that we use localhost as the base for our action, we need to define which files should be considered part of the action. Because, I am not sure if all markdown file references are served on our website this ensures we avoid unnecessary errors.
  4. In my testing of the workflow, I found several broken links. To prevent workflow failure, I suggest creating a separate issue to address these broken links before merging this pull request. The broken links may be related to unnecessary files from submodules or other issues discussed in point 4. We might also use .lycheeignore to ignore certain URIs or URLs.

Thank you for your patience. For a more detailed overview of my changes, please visit this link.

- name: Wait for App to Start
run: sleep 20

linkChecker:
Copy link
Member

@DarhkVoyd DarhkVoyd Mar 6, 2024

Choose a reason for hiding this comment

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

Changing jobs runs post action cleanup in workflow which closes all of our node processes from previous step which includes the one serving the site on local host. So, we should either build and serve again or simply merge them into a single job.

@Gmin2
Copy link
Contributor Author

Gmin2 commented Mar 6, 2024

@DarhkVoyd thanks for you review
Can you refer this comment about the deploy part

@Gmin2
Copy link
Contributor Author

Gmin2 commented Mar 6, 2024

Can you add your opinion @Relequestual

@benjagm
Copy link
Collaborator

benjagm commented Mar 6, 2024

Can you add your opinion @Relequestual

Can we just validate the external links for now and leave the internal ones for a second iteration?
Reference here

@benjagm
Copy link
Collaborator

benjagm commented Mar 6, 2024

An alternative approach can be pause this effort to validate broken links in deployment time, to use a different approach to have a crawler finding broken links every X days. For example:

https://github.com/marketplace/actions/broken-links-crawler

Specifically I like this approach: https://andrewwegner.com/find-broken-links-with-github-actions.html

@DarhkVoyd
Copy link
Member

@DarhkVoyd thanks for you review Can you refer this comment about the deploy part

utnim2,
I believe you have misinterpreted my suggestion.

@aialok
Copy link
Collaborator

aialok commented Mar 6, 2024

Hello @benjagm @utnim2 @aialok

This PR was quite difficult and posed some challenges during review. So, please bear with me if I make some mistakes and I appreciate your patience as I worked through it. Below are my findings, change requests, and suggestions:

  1. We should consider either merging the two jobs or rebuilding and serving the website again in the second job to address post-action cleanup in the workflow.
  2. Despite the expected downtime of our served website due to post-cleanup actions, the initial job fails to serve the website. The current workflow experiences a silent failure in the first job due to a command not found error when serving the website.
    Upon investigation, it appears that the serve package, utilized in our package.json for local website deployment, is missing from our dependencies. This absence is the root cause of the deployment failure. To resolve this issue, we must ensure the inclusion of the serve package in our dependencies.
  3. Given that we use localhost as the base for our action, we need to define which files should be considered part of the action. Because, I am not sure if all markdown file references are served on our website this ensures we avoid unnecessary errors.
  4. In my testing of the workflow, I found several broken links. To prevent workflow failure, I suggest creating a separate issue to address these broken links before merging this pull request. The broken links may be related to unnecessary files from submodules or other issues discussed in point 4. We might also use .lycheeignore to ignore certain URIs or URLs.

Thank you for your patience. For a more detailed overview of my changes, please visit this link.

Great review! Thanks, @DarhkVoyd.

I've gone through your workflow, and everything looks good to me. However, I noticed that we are checking links of .md files in node_modules, which need to be ignored as they are causing thousands of links to be checked unnecessarily.

Screenshot from 2024-03-06 14-43-28

Other than this, everything looks good to me.

@benjagm, your solution is also a good way to handle things.

Happy coding!

@DarhkVoyd
Copy link
Member

DarhkVoyd commented Mar 6, 2024

Great review! Thanks, @DarhkVoyd.
I've gone through your workflow, and everything looks good to me. However, I noticed that we are checking links of .md files in node_modules, which need to be ignored as they are causing thousands of links to be checked unnecessarily.

aialok,
Thank you so much for the review. I too was confused about several unnecessary files coming up in the workflow but could not understand the origination as expressed in my review.

Can we just validate the external links for now and leave the internal ones for a second iteration?

benjagm,
I agree with your solution and I believe that it is the only correct implementation for this workflow. Since, we want to maintain our relative paths in the markdown for relative links we probably will have to break down our types of links not only into external and internal but into relative paths too.

An alternative approach can be pause this effort to validate broken links in deployment time, to use a different approach to have a crawler finding broken links every X days.

This is another great solution, however we might still end up with our pursuit of errors related to external and internal links.

@Gmin2
Copy link
Contributor Author

Gmin2 commented Mar 6, 2024

Can we just validate the external links for now and leave the internal ones for a second iteration? Reference here

I too agree with this

@Relequestual
Copy link
Member

Can we just validate the external links for now and leave the internal ones for a second iteration? Reference here

I too agree with this

I'm not concerned much about external links, as they can be broken any time. I'm much more concerned about internal links. We should avoid introducing changes which cause internal links to break. That should be our primary objective here (at least to me).

Copy link
Member

@Relequestual Relequestual left a comment

Choose a reason for hiding this comment

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

Let's avoid checking the node_modules folder =] .

Is it possible to only check internal links?
I don't mind also checking external links, but I don't think it's as needed or the intent of the Issue.

@Relequestual Relequestual added Status: In Progress This issue is being worked on, and has someone assigned. and removed Status: Completed Nothing further to be done with this issue. labels Apr 2, 2024
@Gmin2
Copy link
Contributor Author

Gmin2 commented Apr 2, 2024

Let's avoid checking the node_modules folder =] .

Is it possible to only check internal links? I don't mind also checking external links, but I don't think it's as needed or the intent of the Issue.

So i need to modify the action so that it checks only for external links right?

cc @benjagm @Relequestual

@benjagm
Copy link
Collaborator

benjagm commented Apr 11, 2024

So i need to modify the action so that it checks only for external links right?

What Ben was saying is check only internal but the problem with internal links but as we have been discussing this approach seems to not work for the specific type of architecture and stack of this site.

@benjagm
Copy link
Collaborator

benjagm commented Apr 15, 2024

Closing this as there was not activity for the last weeks.

@benjagm benjagm closed this Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: In Progress This issue is being worked on, and has someone assigned.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the CI/CD pipeline to avoid broken links
5 participants