-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate API docs from NUnit source code (#843)
* 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
- Loading branch information
1 parent
4019e45
commit 7d74c0a
Showing
9 changed files
with
135 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This script gets the the latest version of NUnit and extracts it. This is because docfx is capable of generating API docs, and this way the Codespace will be automatically enabled to do that. | ||
|
||
# This is hard-coded for now. | ||
NUNIT_VERSION_FOR_API_DOCS="4.0.0" | ||
|
||
first_workspace="$(cd /workspaces && ls | head -1)" | ||
|
||
wget "https://github.com/nunit/nunit/releases/download/v$NUNIT_VERSION_FOR_API_DOCS/NUnit.Framework-$NUNIT_VERSION_FOR_API_DOCS.zip" -O /apidocs.zip | ||
|
||
|
||
mkdir -p /workspaces/$first_workspace/code-output | ||
unzip -o /apidocs.zip -d /apidocs | ||
cp -r /apidocs/bin/net6.0/* /workspaces/$first_workspace/code-output | ||
rm -rf /apidocs.zip | ||
rm -rf /apidocs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ on: | |
branches: | ||
- master | ||
|
||
env: | ||
NUNIT_VERSION_FOR_API_DOCS: "4.0.0" | ||
|
||
jobs: | ||
linting: | ||
name: "Markdown linting" | ||
|
@@ -43,6 +46,17 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v4 | ||
name: Check out the code | ||
- name: Get latest NUnit Asset dir | ||
uses: dsaltares/fetch-gh-release-asset@master | ||
with: | ||
repo: 'nunit/nunit' | ||
version: 'tags/v${{ env.NUNIT_VERSION_FOR_API_DOCS }}' | ||
file: 'NUnit.Framework-${{ env.NUNIT_VERSION_FOR_API_DOCS }}.zip' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Unzip NUnit Asset zip file into its own directory | ||
run: unzip NUnit.Framework-${{ env.NUNIT_VERSION_FOR_API_DOCS }}.zip -d ./NUnit.Framework-${{ env.NUNIT_VERSION_FOR_API_DOCS }} | ||
- name: Copy NUnit Asset dir | ||
run: mkdir ./code-output && cp -r ./NUnit.Framework-${{ env.NUNIT_VERSION_FOR_API_DOCS }}/bin/net6.0/* ./code-output | ||
- uses: "nunit/[email protected]" | ||
name: Build with Docfx | ||
with: | ||
|
@@ -54,6 +68,39 @@ jobs: | |
with: | ||
name: siteArtifact | ||
path: _site.zip | ||
- name: Start deployment (PR only) | ||
if: ${{ github.ref != 'refs/heads/master'}} | ||
uses: bobheadxi/deployments@v1 | ||
id: deployment | ||
with: | ||
env: preview_${{github.event.number}} | ||
step: start | ||
- name: Deploy to Netlify (PR only) | ||
if: ${{ github.ref != 'refs/heads/master'}} | ||
uses: South-Paw/action-netlify-cli@v2 | ||
id: netlify | ||
with: | ||
# note that the --json flag has been passed so we can parse outputs | ||
args: deploy --json --dir './docs/_site' --message 'preview [${{ github.sha }}]' | ||
env: | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
- name: Update Preview link comment | ||
if: ${{ github.ref != 'refs/heads/master'}} | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
header: previewlink | ||
message: | | ||
Preview link: ${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).deploy_url }} | ||
- name: Finish deployment | ||
uses: bobheadxi/deployments@v1 | ||
if: ${{ github.ref != 'refs/heads/master'}} | ||
with: | ||
env: ${{ steps.deployment.outputs.env }} | ||
step: finish | ||
status: ${{ job.status }} | ||
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | ||
env_url: ${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).deploy_url }} | ||
snippets: | ||
name: "Build/Test Snippets" | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
code-output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
- name: Articles | ||
href: articles/ | ||
# - name: Api Documentation | ||
# href: api/ | ||
# homepage: api/ | ||
- name: Articles | ||
href: articles/ | ||
- name: API Reference | ||
href: api/ |