Skip to content

NUnit 3.x to 4.x semi-automatic migration support (#967) #1503

NUnit 3.x to 4.x semi-automatic migration support (#967)

NUnit 3.x to 4.x semi-automatic migration support (#967) #1503

Workflow file for this run

name: NUnit Documentation Build Process
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
NUNIT_VERSION_FOR_API_DOCS: "4.1.0"
jobs:
linting:
name: "Markdown linting"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Check out the code
- uses: actions/setup-node@v4
name: Setup node
with:
node-version: "18"
- run: npm install -g markdownlint-cli2
name: Install markdownlint-cli2
- run: markdownlint-cli2 --config ".github/linters/.markdownlint.yml" "docs/**/*.md"
name: run Markdownlint
spellcheck:
name: "Spell check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Check out the code
- uses: actions/setup-node@v4
name: Setup node
with:
node-version: "18"
- run: npm install -g cspell
name: Install cSpell
- run: cspell --config ./cSpell.json "docs/**/*.md" --no-progress
name: run cSpell
build:
name: "Build the site with docfx"
runs-on: ubuntu-latest
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/${{ 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:
args: docs/docfx.json --warningsAsErrors true
- name: zip site contents
run: zip -r _site.zip docs/_site/
- name: Archive site artifacts
uses: actions/upload-artifact@v4
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
token: ${{ secrets.SEAN_PAT_TO_MANAGE_ENVIRONMENTS }}
- 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 }}
token: ${{ secrets.SEAN_PAT_TO_MANAGE_ENVIRONMENTS }}
snippets:
name: "Build/Test Snippets"
runs-on: ubuntu-latest
env:
SOLUTION_LOCATION: "./docs/snippets/Snippets.sln"
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.x
- name: Restore dependencies
run: dotnet restore $SOLUTION_LOCATION
- name: Build
run: dotnet build --no-restore $SOLUTION_LOCATION
- name: Test
run: dotnet test --no-build --verbosity normal $SOLUTION_LOCATION
publish:
name: Publish (master branch only)
needs: [linting, spellcheck, build]
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master'}}
steps:
- name: Download site artifacts
uses: actions/download-artifact@v4
with:
name: siteArtifact
- name: unzip site contents
run: unzip _site.zip
- name: Push to gh-pages branch (master only)
if: ${{ github.ref == 'refs/heads/master'}}
uses: peaceiris/actions-gh-pages@v4
with:
commit_message: ${{ github.event.head_commit.message }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_site
publish_branch: gh-pages