Skip to content

Commit 8fe2074

Browse files
authored
Added build documentation support. (#16)
Co-authored-by: smaillet <25911635+smaillet@users.noreply.github.com>
1 parent 9577f46 commit 8fe2074

28 files changed

+915
-128
lines changed

.github/workflows/release-build.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ jobs:
2727
- name: Build Source
2828
run: .\Build-All.ps1
2929

30+
- name: Run Tests
31+
run: ./Invoke-Tests.ps1
32+
33+
- name: Publish Test Results
34+
uses: EnricoMi/publish-unit-test-result-action/windows@v2
35+
with:
36+
files: BuildOutput/Test-Results/*.trx
37+
3038
- name: Publish Artifacts
3139
uses: actions/upload-artifact@v4
3240
with:
@@ -36,11 +44,23 @@ jobs:
3644
- name: Show asset names
3745
run: dir BuildOutput/Nuget
3846

47+
- name: Commit Docs
48+
env:
49+
docspush_email: 32618965+cibuild-telliam@users.noreply.github.com
50+
docspush_username: cibuild-telliam
51+
run: .\Push-Docs.ps1 -SkipPush
52+
53+
- name: Push Docs
54+
uses: ad-m/github-push-action@master
55+
with:
56+
github_token: ${{ secrets.GITHUB_TOKEN }}
57+
directory: .\BuildOutput\docs
58+
branch: gh-pages
59+
3960
- name: Publish packages to NuGet.org
4061
run: dir .\BuildOutput\NuGet\*.nupkg | .\Push-Nuget.ps1 -apiKey ${{ secrets.NUGETPUSH_ACCESS_TOKEN }}
4162

4263
- name: Create Release
43-
id: create_release
4464
uses: softprops/action-gh-release@v2
4565
with:
4666
tag_name: ${{ github.ref }}

Build-Docs.ps1

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
using module "PSModules/CommonBuild/CommonBuild.psd1"
2+
using module "PSModules/RepoBuild/RepoBuild.psd1"
3+
4+
<#
5+
.SYNOPSIS
6+
Builds the docs for this repository
7+
8+
.PARAMETER Configuration
9+
This sets the build configuration to use, default is "Release" though for inner loop development this may be set to "Debug"
10+
11+
.PARAMETER FullInit
12+
Performs a full initialization. A full initialization includes forcing a re-capture of the time stamp for local builds
13+
as well as writes details of the initialization to the information and verbose streams.
14+
15+
.PARAMETER NoClone
16+
Skip cloning of the docs repository. Useful for inner loop development where you only do the clone once when iterating on
17+
doc updates.
18+
19+
.PARAMETER ShowDocs
20+
Show the docs via `docfx serve --open-browser ...`. This option is useful for inner loop development of the docs as it allows
21+
opening a browser on the newly created docs for testing/checking the contents are produced correctly.
22+
#>
23+
Param(
24+
[string]$Configuration="Release",
25+
[switch]$FullInit,
26+
[switch]$NoClone,
27+
[switch]$ShowDocs
28+
)
29+
30+
$docFXToolVersion = '2.78.3'
31+
32+
$InformationPreference = 'Continue'
33+
$ErrorInformationPreference = 'Stop'
34+
35+
Push-Location $PSScriptRoot
36+
$oldPath = $env:Path
37+
try
38+
{
39+
$buildInfo = Initialize-BuildEnvironment -FullInit:$FullInit
40+
41+
# make sure the supported tool is installed.
42+
Invoke-External dotnet tool install --global docfx --version $docFXToolVersion | Out-Null
43+
44+
$docsOutputPath = $buildInfo['DocsOutputPath']
45+
Write-Information "Docs OutputPath: $docsOutputPath"
46+
47+
# Clone docs output location so it is available as a destination for the Generated docs content
48+
# and the versioned docs links can function correctly for locally generated docs
49+
if(!$NoClone -and !(Test-Path (Join-Path $docsOutputPath '.git') -PathType Container))
50+
{
51+
# clean out existing docs content so that clone can work
52+
if(Test-Path -PathType Container $docsOutputPath)
53+
{
54+
Write-Information "Cleaning $docsOutputPath"
55+
Remove-Item -Path $docsOutputPath -Recurse -Force -ProgressAction SilentlyContinue
56+
}
57+
58+
Write-Information "Cloning Docs repository"
59+
Invoke-External git clone $buildInfo['OfficialGitRemoteUrl'] -b gh-pages $docsOutputPath -q
60+
}
61+
62+
# Delete everything in the docs output except the git folder so the result of applying changes
63+
# is ONLY what is generated by this script.
64+
Write-Information "Cleaning $docsOutputPath"
65+
Get-ChildItem -Path $docsOutputPath -Exclude '.git' | remove-item -Recurse -Force -ProgressAction SilentlyContinue
66+
67+
# Create a file to disable the default GitHub Pages use of JEKYLL as this uses docfx to generate the final
68+
# HTML. [It is at least theoretically plausible that JEKYLL could handle some/all of the metadata files produced
69+
# by DOCFX but it is not clear how much of the "build" stage would be lost if ONLY the metadata phase was used.
70+
# Thus, for now, this uses the docfx build phase.]
71+
"$([DateTime]::UtcNow.ToString('o'))" | Out-File -Path (Join-Path $docsOutputPath '.nojekyll')
72+
73+
$generatedVersionInfo = [xml](Get-Content (Join-Path $buildInfo['RepoRootPath'] 'GeneratedVersion.props'))
74+
$fullBuildNumber = $generatedVersionInfo.Project.PropertyGroup.InformationalVersion
75+
76+
push-location './docfx'
77+
try
78+
{
79+
Write-Information "Building docs [FullBuildNumber=$fullBuildNumber]"
80+
Invoke-External docfx '-m' _buildVersion=$fullBuildNumber '-o' $docsOutputPath
81+
}
82+
finally
83+
{
84+
Pop-Location
85+
}
86+
87+
if($ShowDocs)
88+
{
89+
.\Show-Docs.ps1 $buildInfo
90+
}
91+
}
92+
catch
93+
{
94+
# Everything from the official docs to the various articles in the blog-sphere says this isn't needed
95+
# and in fact it is redundant - They're all WRONG! By re-throwing the exception the original location
96+
# information is retained and the error reported will include the correct source file and line number
97+
# data for the error. Without this, only the error message is retained and the location information is
98+
# Line 1, Column 1, of the outer most script file, which is, of course, completely useless.
99+
throw
100+
}
101+
finally
102+
{
103+
Pop-Location
104+
$env:Path = $oldPath
105+
}

Directory.Build.props

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<!--
3-
For local builds of this project in IDE ONLY
3+
For local builds of this solution in IDE ONLY
44
FORCE the Build Versioning Info as there is no lib to rely on; (This repo builds it!) and the automated build
55
scripts aren't used to build from within an IDE. Automated builds/Command line builds use the PowerShell
66
scripts to setup the variables for use in the build. This, handles the case of builds directly from the IDE
@@ -11,6 +11,7 @@
1111
-->
1212
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)'=='true'">
1313
<!-- File Version for v5.0.0-alpha (See: https://csemver.org/playground/site/#/) [1.27597.27630.61954]-->
14+
<!-- CiBuildIndex => UInt16.MaxValue -->
1415
<!-- +1 to revision to account for CI build -->
1516
<FileVersion>1.27597.27630.61955</FileVersion>
1617
<PackageVersion>5.0.0-a.ci-4294967295.IDE</PackageVersion>
@@ -19,7 +20,11 @@
1920
<InformationalVersion>$(ProductVersion)</InformationalVersion>
2021
</PropertyGroup>
2122

22-
<Import Condition="'$(BuildingInsideVisualStudio)'!='true'" Project="GeneratedVersion.props" />
23+
<!--
24+
For command line builds (including official PR/CI/Release automated builds) use the props file
25+
generated by the scripts.
26+
-->
27+
<Import Condition="'$(BuildingInsideVisualStudio)'!='true' AND '$(MSBuildProjectExtension)'!='.pssproj'" Project="GeneratedVersion.props" />
2328

2429
<!--
2530
Description:

Directory.Build.targets

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,26 @@
44
</Target>
55

66
<Target Name="ShowBuildParameters">
7+
<Message Importance="normal" Text="Build paths:" />
78
<Message Importance="normal" Text=" BuildRootDir: $(BuildRootDir)" />
89
<Message Importance="normal" Text=" BaseBuildOutputPath: $(BaseBuildOutputPath)" />
910
<Message Importance="normal" Text=" BaseBuildOutputBinPath: $(BaseBuildOutputBinPath)" />
1011
<Message Importance="normal" Text="BaseIntermediateOutputPath: $(BaseIntermediateOutputPath)" />
1112
<Message Importance="normal" Text=" IntDir: $(IntDir)" />
1213
<Message Importance="normal" Text=" BaseOutputPath: $(BaseOutputPath)" />
14+
<Message Importance="normal" Text="Versioning:" />
1315
<Message Importance="normal" Text=" FullBuildNumber: $(FullBuildNumber)"/>
1416
<Message Importance="normal" Text=" PackageVersion: $(PackageVersion)"/>
1517
<Message Importance="normal" Text=" FileVersion: $(FileVersion)"/>
18+
<Message Importance="normal" Text=" AssemblyVersion: $(AssemblyVersion)"/>
19+
<Message Importance="normal" Text=" InformationalVersion: $(InformationalVersion)"/>
1620
<Message Importance="normal" Text=" Platform: $(Platform)"/>
1721
<Message Importance="normal" Text=" Configuration: $(Configuration)"/>
1822
</Target>
1923

2024
<Target Name="VerifyProjectSettings" Condition="'$(MSBuildProjectExtension)'=='.csproj'">
2125
<!--
22-
Detect if something has this horrible non-feature enabled. It is a blight on the build/language that should never have been added
26+
Detect if something has this horrible non-feature enabled. It is a blight on the build that should never have been added,
2327
let alone used as the default for projects with no way to block/disable it all up...
2428
2529
NOTE:
@@ -36,6 +40,6 @@
3640
-->
3741
<Error Condition="'$(ImplicitUsings)'!='disable'" Text="$(MSBuildProjectFile) - Projects in this repository MUST NOT have ImplicitUsings enabled!"/>
3842

39-
<Warning Condition="'$(BuildingInsideVisualStudio)' == 'true'" Text="!!! This is an IDE build-Version numbering is 'FAKED' !!!"/>
43+
<Warning Condition="'$(BuildingInsideVisualStudio)' == 'true'" Text="!!! This is an IDE build. Version numbering is 'FAKED' !!!"/>
4044
</Target>
4145
</Project>

Directory.Packages.props

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
-->
66
<ItemGroup>
77
<!--
8-
While some aspects of this analyzer are helpful, it hasn't been without issues. Worse, the last non-preview release
9-
was Apr of 2019, That's a LONG time ago. Even the most recent preview (beta) was back in Dec. of 2023. So not much
10-
sign of life/activity nor hope of updates to bug fixes. It's sad to see this go as relying on a developer/reviewers
11-
to follow the rules is a recipe for failures. Automation is how that works. (With occasional overrides that should
12-
get the attention of a reviewer).
13-
-->
8+
NOTE: This analyzer is sadly, perpetually in "pre-release mode". There have been many issues/discussion on the point
9+
and it has all fallen on deaf ears. So policies regarding "NO-Prerelease" components need to be overruled on this one
10+
-->
1411
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" Condition="'$(UseStyleCop)' != 'false'" />
1512
</ItemGroup>
1613
<!--
@@ -27,4 +24,4 @@
2724
<PackageVersion Include="MSTest.TestFramework" Version="3.9.1" />
2825
<PackageVersion Include="Polyfill" Version="7.31.0" />
2926
</ItemGroup>
30-
</Project>
27+
</Project>

IgnoredWords.dic

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
ABI
2+
Accessor
3+
Addr
4+
alloca
5+
anonymize
6+
antlr
7+
api
8+
app
9+
apps
10+
argkind
11+
ascii
12+
atomicrmw
13+
attrib
14+
Attribs
15+
AttributeSet
16+
Attrs
17+
baz
18+
binaryop
19+
binlogs
20+
binop
21+
bitcode
22+
Blinky
23+
blittable
24+
blockdiag
25+
blog
26+
bool
27+
buildbinoutput
28+
buildtransitive
29+
builtinop
30+
byref
31+
byval
32+
castable
33+
cibuild
34+
Cmp
35+
Comdat
36+
Comdats
37+
compat
38+
Concat
39+
Config
40+
const
41+
contentfiles
42+
Contributors
43+
crlf
44+
csharp
45+
csproj
46+
de
47+
defacto
48+
dllimport
49+
docfx
50+
docfxconsole
51+
dotnet
52+
endianess
53+
enum
54+
Enums
55+
env
56+
exe
57+
facepalm
58+
finalizers
59+
foo
60+
fullsrc
61+
func
62+
getelementptr
63+
gh
64+
github
65+
Globalization
66+
Hashtable
67+
Identifier
68+
Impl
69+
inline
70+
inlined
71+
Interop
72+
jit
73+
Lexer
74+
LValue
75+
malloc
76+
marshallers
77+
marshalling
78+
memcopy
79+
metadata
80+
Mips
81+
msbuild
82+
msg
83+
nav
84+
nint
85+
noinline
86+
nounwind
87+
nuint
88+
nullability
89+
Nullable
90+
optimizenone
91+
pages
92+
paren
93+
perf
94+
pointee
95+
Pre
96+
proj
97+
readonly
98+
refactor
99+
refcount
100+
repl
101+
repo
102+
RMW
103+
runtimes
104+
RValue
105+
sizeof
106+
src
107+
Stateful
108+
struct
109+
structs
110+
Subrange
111+
Sym
112+
telliam
113+
tl
114+
trx
115+
typdef
116+
Typedef
117+
typeof
118+
uid
119+
uint
120+
unaryop
121+
Undefine
122+
undiscoverable
123+
Unhandled
124+
uniqued
125+
uniqueing
126+
unmarshal
127+
userdefinedop
128+
Users
129+
usings
130+
utils
131+
variadic
132+
vcxproj
133+
versioned
134+
versioning
135+
Xchg
136+
Xor
137+
xref
138+
xxx
139+
yaml
140+
yyyy

0 commit comments

Comments
 (0)