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(i): Add check to keep table of contents up-to-date #2693

Merged

Conversation

shahzadlone
Copy link
Member

@shahzadlone shahzadlone commented Jun 7, 2024

Relevant issue(s)

Resolves #2692

Description

  • Combine previous documentation workflows in one file
  • Add toc script tool
  • Add the toc make rule
  • Add toc job

How has this been tested?

Specify the platform(s) on which this was tested:

  • WSL2

@shahzadlone shahzadlone added documentation Improvements or additions to documentation ci/build This is issue is about the build or CI system, and the administration of it. labels Jun 7, 2024
@shahzadlone shahzadlone added this to the DefraDB v0.12 milestone Jun 7, 2024
@shahzadlone shahzadlone self-assigned this Jun 7, 2024
@shahzadlone shahzadlone changed the title ci(i): Add check to ensure readme table of content is in sync ci(i): Add check to keep table of content up-to-date Jun 7, 2024
@shahzadlone shahzadlone requested a review from a team June 7, 2024 13:19
@shahzadlone shahzadlone force-pushed the lone/ci/readme-md-toc branch from ce546e3 to c8c7da6 Compare June 7, 2024 13:24
@shahzadlone
Copy link
Member Author

@fredcarle no more code 12 + enter hahaha

@AndrewSisley
Copy link
Contributor

Combine previous documentation workflows in one file

question: What made you chose to do this?

Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.98%. Comparing base (0c134e5) to head (a4cd76a).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2693      +/-   ##
===========================================
+ Coverage    77.91%   77.98%   +0.08%     
===========================================
  Files          308      308              
  Lines        23134    23134              
===========================================
+ Hits         18023    18041      +18     
+ Misses        3723     3711      -12     
+ Partials      1388     1382       -6     
Flag Coverage Δ
all-tests 77.98% <ø> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 6 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c134e5...a4cd76a. Read the comment docs.

@@ -0,0 +1,421 @@
#!/usr/bin/env bash

Copy link
Contributor

Choose a reason for hiding this comment

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

thought: 😅 Please never ask me to maintain this file. Are we really sure this is worth it?

Copy link
Member Author

Choose a reason for hiding this comment

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

You/we don't have to. I been using this for a few years now and has 3.2k stars. Is a keep it and forget it kind of thing IMO.

Worst case scenario, if something does break, we copy the new version with the fix and replace this script.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is copy-pasted as-is? No changes from the source? Why have we copy pasted it?

Copy link
Member Author

@shahzadlone shahzadlone Jun 7, 2024

Choose a reason for hiding this comment

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

It is copy-pasted as-is? No changes from the source?

yes. yes no changes.

Why have we copy pasted it?

Is a simple bash script. Is going to be painful to have devs manually download and making sure they have same version etc (specially if there are formatting changes between versions).

Copy link
Contributor

@AndrewSisley AndrewSisley Jun 7, 2024

Choose a reason for hiding this comment

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

The readme pasted in suggests that we wouldn't need devs to manually download it (unless maybe it requires sudo?)

It also looks like the script doesn't work on windows:

If you want it on Windows, you better to use a golang based implementation

todo: Why don't we just use the go version instead of the mac/linux-only bash script, then we wont need to copy-paste code about?

go install "github.com/ekalinin/github-markdown-toc.go/cmd/gh-md-toc@latest" etc...

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't used the go version of the tool personally before, I wonder if formatting and everything else is the same.

Copy link
Member Author

@shahzadlone shahzadlone Jun 7, 2024

Choose a reason for hiding this comment

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

I tried switching to the go project, but sadly the go project is missing the insert option, and only generates the table of contents (i.e. doesn't update it automatically). So will prefer the current approach.

ekalinin/github-markdown-toc.go#26

Copy link
Member Author

Choose a reason for hiding this comment

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

@sourcenetwork/database-team Please chime in if you have any other suggestions regarding the copy-paste and lack of window dev tool support (or another tool). Happy to follow the consensus.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we never have to maintain this, I don't really care that we just copy-pasted it. I also don't think it's a big deal that it doesn't work on windows. Devs on windows can just manually edit if they have to. If someone what's to contribute to the go version to include insert, we can switch to the go version when it's supported.

Copy link
Member Author

Choose a reason for hiding this comment

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

If we never have to maintain this, I don't really care that we just copy-pasted it. I also don't think it's a big deal that it doesn't work on windows. Devs on windows can just manually edit if they have to. If someone what's to contribute to the go version to include insert, we can switch to the go version when it's supported.

I am okay with this! I have subscribed to the issue, if it gets implemented happy to migrate to using go version of the tool.

@shahzadlone
Copy link
Member Author

Combine previous documentation workflows in one file

question: What made you chose to do this?

No hard pref or reason just some minor ones, seems nicer to have all documentation jobs in one workflow file (they still behave in parallel manner and can be controlled granularly to make required or not as that is based on the job name.)

One nitpicky thing I like is that the github check mark will show: Check Documentation Workflow / Check http documentation rather than Check Http Documentation Workflow / Check http documentation

Everything remains the same, except we loose the ability to configure the trigger (push and pull) in a granular manner per workfllow vs same for all jobs now, but we will always have same for all these jobs anyways so doesn't matter.

If there is a hard pref to keep them in separate workflow files lmk, as mentioned I am in different.

@AndrewSisley
Copy link
Contributor

if there is a hard pref to keep them in separate workflow files lmk, as mentioned I am in different.

No real preference from me at all atm :) I was just curious :) Thanks for the explanation

@shahzadlone shahzadlone changed the title ci(i): Add check to keep table of content up-to-date ci(i): Add check to keep table of contents up-to-date Jun 7, 2024
Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

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

LGTM. Please fix the table of content header syntax before merging.

README.md Outdated Show resolved Hide resolved
@@ -0,0 +1,421 @@
#!/usr/bin/env bash

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we never have to maintain this, I don't really care that we just copy-pasted it. I also don't think it's a big deal that it doesn't work on windows. Devs on windows can just manually edit if they have to. If someone what's to contribute to the go version to include insert, we can switch to the go version when it's supported.

@shahzadlone shahzadlone force-pushed the lone/ci/readme-md-toc branch from c8c7da6 to 43c08ef Compare June 7, 2024 19:28
@shahzadlone shahzadlone force-pushed the lone/ci/readme-md-toc branch from 43c08ef to a4cd76a Compare June 7, 2024 19:30
@shahzadlone shahzadlone merged commit 343b90a into sourcenetwork:develop Jun 7, 2024
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build This is issue is about the build or CI system, and the administration of it. documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keep Readme table of content up to date
3 participants