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

Generate API docs from NUnit source code #843

Merged
merged 41 commits into from
Dec 4, 2023
Merged

Conversation

SeanKilleen
Copy link
Member

@SeanKilleen SeanKilleen commented Nov 27, 2023

NUnit 4.0 has me feeling bold. :) Figured I'd take a first shot at pulling in API docs from NUnit's xmldoc comments, as docfx can do.

The docs, as we know, are not in the same repo as the code, so our build process and any manual experimentation will have to copy some files into a folder in the docs project.

Work

  • Run the process manually
  • Ignore directories so they don't wind up accidentally committed
  • README reference for local steps
  • Build process to generate API
  • Make it look nice with the existing contents
  • Link to some kind of API landing page (reference some other repos that use docfx to see how they do it)
    • Unnecessary -- API reference jumps right into the APIs, and that's fine for now.
  • Some kind of preview functionality...like NETLIFY PREVIEWS! 🎉
  • Some kind of nice tooling for the dev container to pull stuff in easily when working on it locally.
  • Have it always pull from the latest NUnit release, semver-wise.
    • I'm going to punt on this one -- doesn't need to happen right away.
  • Filter out the internal namespaces (get input from Core team)
    • Addressing as follow-ups
  • Surface a preview link in a PR comment
  • Necessary metadoc (readme, contributing) updates

@SeanKilleen
Copy link
Member Author

CC @OsirisTerje -- FYI, I'm getting started on this. :)

@SeanKilleen
Copy link
Member Author

OK, at this point I can get it building locally and via GitHub actions with the v4.0.0 release. 🎉

Next up: Make it look nice and incorporate it as I've seen other sites do. Going to take a look around and come back to this.

@SeanKilleen
Copy link
Member Author

I'm going to sleep on this and return to it.

Some issue with not being able to find the index.md file that seems to be right there when I look at it.

Also, might need to check out some of the exclusion rules to ensure that file isn't being overwritten because of the metadata generation.

This comment was marked as outdated.

@OsirisTerje
Copy link
Member

You were not looking at the right place. 😆 At the top of the preview site is a new "API Reference" link -- that's what you'll want to click.

LOL !!! My eyes was hiding that!

Never looked up there. See that the menu also is there in the current docs page, but I have never noticed it !

Perhaps we can do more out of that one ? Ref #848

@stevenaw
Copy link
Member

stevenaw commented Dec 2, 2023

Thanks for putting this together @SeanKilleen

I haven't time to review it comprehensively unfortunately, but I like what I've seen so far. The "View Source" link is particularly handy.

A workflow question:

I understand the markdown docs are published as PRs are merged into this repo. Would framework-derived info like this be regenerating them as part of each release? How would versioning work over time as the API evolves across releases?

@SeanKilleen
Copy link
Member Author

@stevenaw

I understand the markdown docs are published as PRs are merged into this repo. Would framework-derived info like this be regenerating them as part of each release? How would versioning work over time as the API evolves across releases?

Great question! As of now, the way it works is the docs build points to a hard-coded release number of NUnit that I'd need to update each time. Our CI process pulls the asset from the release , unzips it, and moves it to a place where docfx knows to look for it. Before this PR is merged I'll try to add a one-liner command in the dev container so people working with it there can easily pull in this part transparently.

Shortly after this is merged, I intend to follow up on it and set it to always pull the latest package from a semver perspective, which will keep it all up to date going forward.

Copy link

github-actions bot commented Dec 2, 2023

@SeanKilleen
Copy link
Member Author

Alright, since the consensus is that people don't hate it, my next steps are:

  • Get input on which stuff to exclude (feel free to drop lists of stuff here!) I'll try to ensure anything marked internal is auto-excluded.
  • Get the local container tooling working so that the build helper command pulls the metadata as we expect and builds the whole experience. Probably with an additional one-liner command like metadata
  • Ensure the README reflects this stuff
  • Get it merged

@SeanKilleen
Copy link
Member Author

  • The API docs are now automatically loaded into the right spot in the devcontainer
  • The dev container now has an alias, apidocs, that will add or overwrite them again as needed, just in case it's needed.
  • build and serve commands now also build the API docs.

@SeanKilleen
Copy link
Member Author

SeanKilleen commented Dec 4, 2023

@nunit/core-team in the interest of moving forward, I'm going to merge this.

For next steps:

  • See a namespace that shouldn't be in the docs? Let me know.
  • We (I'm happy to do it) can add an InternalAPIAttribute to the NUnit codebase if you'd like. We can then exclude anything that has the attribute from the generated API docs. Also has the bonus of making our intentions clear. If we already have one of these, let me know and I'll make use of it.

@SeanKilleen SeanKilleen changed the title WIP: Generate API docs from NUnit source code Generate API docs from NUnit source code Dec 4, 2023
@SeanKilleen SeanKilleen merged commit 7d74c0a into master Dec 4, 2023
7 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 4, 2023
* Ignore the API directory

Since we're generating it by build

* Add docfx generation commands

* Ignore code-output folder

Since that's where the release will be added

* Readme instructions for local use

* wrap

* Action to get NUnit asset

* unzip and copy

* verbose unzip

* unzip into subdir

* adjust syntax

* adjust syntax

* adjust syntax

* more

* more

* I must be a little sleepy.

* only ignore YML and manifest files

* Add API index

* Add API reference to docs index

* Adjust TOC file

* Remove index (not needed)

* Let's try out previews of the docs, because why not

* limit step to PR only

* remove context flag

only available when actually building

* Only clean up on PRs

* Update to use deploy_url

.url is for prod

* Attempt to add a preview link comment

* quick test of devcontainer script

* Let's see.

* Install unzip

* remove the zip file

* fix directory

* move instead of copy

* Set flag to overwrite

* back to copy

* more

* There we go.

* aliaa

* comments

* alias

* Contributing updates on one-liner commands 7d74c0a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants