Skip to content

Commit

Permalink
Check for possible broken documentation by failing on DocFX warning (#…
Browse files Browse the repository at this point in the history
…5542)

* Add --warningsAsErrors flag to DocFX

* Add check in AzDo pr validation yaml

* Use windows image for docfx test

* Fix build script name

* disable incremental builds for DocFx

Co-authored-by: Aaron Stannard <[email protected]>
  • Loading branch information
Arkatufus and Aaronontheweb authored Feb 18, 2022
1 parent 4573bcc commit 3667a62
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
10 changes: 10 additions & 0 deletions build-system/pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ jobs:
outputDirectory: "TestResults"
artifactName: "net_core_tests_linux-$(Build.BuildId)"

- template: azure-pipeline.template.yaml
parameters:
name: "docfx_test"
displayName: "DocFX warning check"
vmImage: "windows-2019"
scriptFileName: build.cmd
scriptArgs: docfx
outputDirectory: "TestResults"
artifactName: "docfx_test-$(Build.BuildId)"

- template: azure-pipeline.template.yaml
parameters:
name: "net_5_tests_windows"
Expand Down
19 changes: 13 additions & 6 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -632,12 +632,19 @@ Target "DocFx" (fun _ ->
Version = "0.1.0-alpha-1611021200"
OutputDirectory = currentDirectory @@ "tools" }) "msdn.4.5.2"

let docsPath = "./docs"
DocFx (fun p ->
{ p with
Timeout = TimeSpan.FromMinutes 30.0;
WorkingDirectory = docsPath;
DocFxJson = docsPath @@ "docfx.json" })
let docsPath = FullName "./docs"
let docFxPath = FullName(findToolInSubPath "docfx.exe" "tools/docfx.console/tools")

let args = StringBuilder()
|> append (docsPath @@ "docfx.json" )
|> append ("--warningsAsErrors")
|> toText

let result = ExecProcess(fun info ->
info.FileName <- docFxPath
info.WorkingDirectory <- (Path.GetDirectoryName (FullName docFxPath))
info.Arguments <- args) (System.TimeSpan.FromMinutes 45.0) (* Reasonably long-running task. *)
if result <> 0 then failwithf "DocFX failed. %s %s" docFxPath args
)

FinalTarget "KillCreatedProcesses" (fun _ ->
Expand Down

0 comments on commit 3667a62

Please sign in to comment.