Skip to content

Commit 9536001

Browse files
committed
Add CI/CD and brought repository into compliance with modern standards
1 parent dc94995 commit 9536001

38 files changed

+678
-276
lines changed

.bonsai/NuGet.config

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
<add key="Gallery" value="Gallery" />
5-
<add key="Bonsai Packages" value="https://www.myget.org/F/bonsai/api/v3/index.json" />
6-
<add key="Community Packages" value="https://www.myget.org/F/bonsai-community/api/v3/index.json" />
74
</packageSources>
85
</configuration>

.config/dotnet-tools.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
"isRoot": true,
44
"tools": {
55
"docfx": {
6-
"version": "2.75.3",
6+
"version": "2.78.3",
77
"commands": [
88
"docfx"
9-
]
9+
],
10+
"rollForward": false
1011
}
1112
}
1213
}

.editorconfig

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
6+
#--------------------------------------------------------------------------------------------------
7+
# XML, JSON, and web files
8+
#--------------------------------------------------------------------------------------------------
9+
[*.{xml,csproj,vcxproj,vcxproj.filters,shproj,props,targets,config,nuspec,resx,vsixmanifest,wxs,vstemplate,slnx}]
10+
indent_size = 2
11+
12+
[*.json]
13+
indent_size = 2
14+
15+
[*.{html,css}]
16+
indent_size = 2
17+
18+
#--------------------------------------------------------------------------------------------------
19+
# C++
20+
#--------------------------------------------------------------------------------------------------
21+
[*.{c,cpp,h,hpp,ixx}]
22+
indent_size = 4
23+
charset = utf-8-bom
24+
trim_trailing_whitespace = true
25+
insert_final_newline = true
26+
27+
#--------------------------------------------------------------------------------------------------
28+
# C#
29+
#--------------------------------------------------------------------------------------------------
30+
[*.{cs,csx}]
31+
indent_size = 4
32+
charset = utf-8-bom
33+
trim_trailing_whitespace = true
34+
insert_final_newline = true
35+
36+
# Language keyword vs full type name
37+
# Predefined for members, etc does not create a message because the explicitly sized types are conveient in interop scenarios where the bit size matters.
38+
dotnet_style_predefined_type_for_locals_parameters_members = true:none
39+
dotnet_style_predefined_type_for_member_access = true:suggestion
40+
41+
# Instantiate argument exceptions correctly
42+
dotnet_diagnostic.CA2208.severity = warning
43+
44+
# Don't complain about not using modern collection syntax
45+
dotnet_style_prefer_collection_expression = never
46+
csharp_style_prefer_range_operator = false

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# Config
99
*.gitignore text
1010
*.gitattributes text
11+
*.gitmodules text eol=lf
1112
*.editorconfig text
1213
*.git-blame-ignore-revs text
1314
*.sln text
@@ -39,4 +40,4 @@ LICENSE text
3940
*.png binary
4041
*.ico binary
4142
*.gif binary
42-
*.svg text
43+
*.svg text

.github/workflows/Bonsai.Scripting.Python.yml

Lines changed: 344 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/docs.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.gitignore

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
.vs
1+
.bonsai/Bonsai.exe*
2+
.bonsai/Packages/
3+
.bonsai/Settings/
4+
.vs/
5+
/artifacts/
26
.venv
3-
bin
4-
obj
5-
Packages
6-
*.exe
7-
*.exe.*
87
*.user
98
*.suo

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "docs/bonsai"]
2-
path = docs/bonsai
3-
url = https://github.com/bonsai-rx/docfx-tools
1+
[submodule "docs/bonsai-docfx"]
2+
path = docs/bonsai-docfx
3+
url = https://github.com/bonsai-rx/docfx-tools.git

src/Bonsai.Scripting.Python.sln renamed to Bonsai.Scripting.Python.sln

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.3.32825.248
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bonsai.Scripting.Python", "Bonsai.Scripting.Python\Bonsai.Scripting.Python.csproj", "{DE54420F-E2A7-48E5-B96E-7D9CEA1B2CB0}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Scripting.Python", "src\Bonsai.Scripting.Python\Bonsai.Scripting.Python.csproj", "{DE54420F-E2A7-48E5-B96E-7D9CEA1B2CB0}"
77
EndProject
8-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{497840F3-F4DC-4E8A-A000-21E5929B945B}"
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{DEE5DD87-39C1-BF34-B639-A387DCCF972B}"
99
ProjectSection(SolutionItems) = preProject
10-
Directory.Build.props = Directory.Build.props
10+
build\Common.csproj.props = build\Common.csproj.props
11+
build\Common.csproj.targets = build\Common.csproj.targets
12+
build\Common.Tests.csproj.props = build\Common.Tests.csproj.props
13+
build\icon.png = build\icon.png
14+
build\Package.props = build\Package.props
15+
build\Project.csproj.props = build\Project.csproj.props
1116
EndProjectSection
1217
EndProject
1318
Global

Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Project>
2+
<Import Project="build/Common$(MSBuildProjectExtension).props" Condition="Exists('build/Common$(MSBuildProjectExtension).props')"/>
3+
</Project>

Directory.Build.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Project>
2+
<Import Project="build/Common$(MSBuildProjectExtension).targets" Condition="Exists('build/Common$(MSBuildProjectExtension).targets')" />
3+
</Project>

build/Common.Tests.csproj.props

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<IsPackable>false</IsPackable>
4+
<GenerateDocumentationFile>false</GenerateDocumentationFile>
5+
</PropertyGroup>
6+
</Project>

build/Common.csproj.props

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<!--
2+
Solution-specific configuration/targets should generally not be placed in this file.
3+
For solution-wide NuGet properties, update Package.props
4+
For everything else, update or create Project.csproj.props
5+
-->
6+
<Project>
7+
<!-- Default configuration and platform when not present -->
8+
<PropertyGroup>
9+
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
10+
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
11+
</PropertyGroup>
12+
13+
<!-- Common C# Properties -->
14+
<PropertyGroup>
15+
<LangVersion>12.0</LangVersion>
16+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
17+
<Features>strict</Features>
18+
<Nullable>enable</Nullable>
19+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
20+
21+
<!-- Build to central artifacts folder instead of scattering bin and obj throughout the solution tree -->
22+
<UseArtifactsOutput>true</UseArtifactsOutput>
23+
<ArtifactsPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../artifacts'))</ArtifactsPath>
24+
25+
<!--
26+
Odd things can happen when WSL and Windows share the same output directories (IE: when building from a single clone of the repo which is shared between both.)
27+
As such if we detect we're running under WSL we use different output directories.
28+
-->
29+
<ArtifactsPath Condition="'$(WSL_DISTRO_NAME)' != ''">$(ArtifactsPath)/wsl</ArtifactsPath>
30+
</PropertyGroup>
31+
32+
<!-- Universal NuGet Package Properties -->
33+
<PropertyGroup>
34+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
35+
<PackageType>Dependency;BonsaiLibrary</PackageType>
36+
37+
<PackageIcon>icon.png</PackageIcon>
38+
<PackageIconSourcePath>$(MSBuildThisFileDirectory)icon.png</PackageIconSourcePath>
39+
40+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
41+
<PackageLicenseSourcePath>$(MSBuildThisFileDirectory)../LICENSE</PackageLicenseSourcePath>
42+
43+
<PackageReadmeFile>README.md</PackageReadmeFile>
44+
<PackageReadmeSourcePath>$(MSBuildThisFileDirectory)../docs/README.md</PackageReadmeSourcePath>
45+
<PackageReadmeSourcePath Condition="Exists('$(MSBuildThisFileDirectory)README.nuget.md')">$(MSBuildThisFileDirectory)README.nuget.md</PackageReadmeSourcePath>
46+
<PackageReadmeSourcePath Condition="Exists('$(MSBuildProjectDirectory)\README.md')">$(MSBuildProjectDirectory)\README.md</PackageReadmeSourcePath>
47+
<PackageReadmeSourcePath Condition="Exists('$(MSBuildProjectDirectory)\README.nuget.md')">$(MSBuildProjectDirectory)\README.nuget.md</PackageReadmeSourcePath>
48+
49+
<!-- Emit modern symbol packages -->
50+
<IncludeSymbols>false</IncludeSymbols>
51+
<IncludeSymbols Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</IncludeSymbols>
52+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
53+
54+
<!-- Embed untracked sources in the PDB for Source Link when building from CI -->
55+
<EmbedUntrackedSources>false</EmbedUntrackedSources>
56+
<EmbedUntrackedSources Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</EmbedUntrackedSources>
57+
</PropertyGroup>
58+
59+
<PropertyGroup>
60+
<!--
61+
Promote especially problematic warnings to errors
62+
* NU1701 - Restore graph contains mismatched target frameworks
63+
* CS7035 - Malformed version string
64+
-->
65+
<WarningsAsErrors>$(WarningsAsErrors);NU1701;CS7035</WarningsAsErrors>
66+
67+
<!-- Explicitly opt in to modern resource embedding (required for building .NET Framework projects from .NET SDK) -->
68+
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
69+
70+
<!-- Enable windows targeting (required when building from non-Windows platforms) -->
71+
<EnableWindowsTargeting>true</EnableWindowsTargeting>
72+
73+
<!-- Provide Bonsai executable path for use with launchSettings.json -->
74+
<BonsaiExecutablePath>$(MSBuildThisFileDirectory)../.bonsai/Bonsai.exe</BonsaiExecutablePath>
75+
</PropertyGroup>
76+
77+
<Import Project="Project.csproj.props" Condition="Exists('Project.csproj.props')" />
78+
<Import Project="Package.props" />
79+
<Import Project="Common.Tests.csproj.props" Condition="$(MSBuildProjectName.EndsWith('.Tests'))" />
80+
</Project>

build/Common.csproj.targets

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!--
2+
Solution-specific configuration/targets should generally not be placed in this file, instead create or update Project.csproj.targets
3+
-->
4+
<Project>
5+
<ItemGroup>
6+
<None Include="$(PackageIconSourcePath)" Pack="true" PackagePath="$(PackageIcon)" Visible="false" />
7+
<None Include="$(PackageLicenseSourcePath)" Pack="true" PackagePath="" Visible="false" />
8+
<None Include="$(PackageReadmeSourcePath)" Pack="true" PackagePath="$(PackageReadmeFile)" Visible="false" />
9+
</ItemGroup>
10+
11+
<!-- Default tool configuration -->
12+
<PropertyGroup Condition="'$(PackAsTool)' == 'true'">
13+
<ToolCommandName Condition="'$(ToolCommandName)' == ''">$(TargetName.ToLowerInvariant())</ToolCommandName>
14+
<PackageType>DotnetTool</PackageType>
15+
16+
<!--
17+
Disable warnings relating to missing documentation
18+
(It's actually too late to easily disable documentation file generation outright, Microsoft.NET.Sdk.BeforeCommon.targets already reacted to it being enabled.)
19+
-->
20+
<NoWarn>1591,1573</NoWarn>
21+
</PropertyGroup>
22+
23+
<Import Project="Project.csproj.targets" Condition="Exists('Project.csproj.targets')" />
24+
25+
<!-- Package versioning - Intentionally after project-specific targets to discourage deviation -->
26+
<PropertyGroup>
27+
<!--
28+
When making local builds, developers can temporarily override DevVersion here or on the command line if they need multiple local versions of this project for whatever reason.
29+
If you feel compelled to change this version number for local testing you're almost certainly doing something wrong!
30+
-->
31+
<DevVersion Condition="'$(DevVersion)' == ''">0</DevVersion>
32+
<Version>42.42.42-dev$(DevVersion)</Version>
33+
34+
<Version Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(CiBuildVersion)</Version>
35+
</PropertyGroup>
36+
37+
<Target Name="VersionSanityChecks" BeforeTargets="Build">
38+
<Error Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(CiBuildVersion)' == ''" Text="CI version info not configured." />
39+
<Error Condition="'$(PackageVersion)' != '' and '$(PackageVersion)' != '$(Version)'" Text="Do not manually specify PackageVersion." />
40+
</Target>
41+
42+
<!-- Check for stale bin/obj directories left over from before we switched to the central artifacts folder -->
43+
<Target Name="CheckForStaleOutputDirectories" AfterTargets="Build" Condition="Exists('$(ProjectDir)bin') or Exists('$(ProjectDir)obj')">
44+
<Warning Text="Stale bin/obj directories exist for $(MSBuildProjectName), deleting them is strongly recommended." />
45+
</Target>
46+
</Project>

build/Package.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project>
2+
<PropertyGroup>
3+
<PackageTags>Bonsai Rx Scripting Python Python.NET</PackageTags>
4+
<PackageProjectUrl>https://bonsai-rx.org/python-scripting</PackageProjectUrl>
5+
6+
<Authors>Bonsai Foundation</Authors>
7+
<Copyright>Copyright © Bonsai Foundation CIC and Contributors</Copyright>
8+
</PropertyGroup>
9+
</Project>

build/Project.csproj.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<Nullable>annotations</Nullable>
4+
</PropertyGroup>
5+
</Project>

build/icon.png

4.13 KB
Loading

docs/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

docs/api/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/bonsai

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/bonsai-docfx

Submodule bonsai-docfx added at 5b584ca

docs/build.ps1

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
1-
.\bonsai\modules\Export-Image.ps1 "..\src\Bonsai.Scripting.Python\bin\Release\net472"
2-
dotnet docfx @args
1+
[CmdletBinding()] param (
2+
[string[]]$docfxArgs
3+
)
4+
Set-StrictMode -Version 3.0
5+
$ErrorActionPreference = 'Stop'
6+
$PSNativeCommandUseErrorActionPreference = $true
7+
8+
Push-Location $PSScriptRoot
9+
try {
10+
$libPaths = @()
11+
$libPaths += Get-ChildItem "..\artifacts\bin\*\release_net4*" -Directory | Select-Object -Expand FullName
12+
$libPaths += "..\artifacts\package\release"
13+
14+
./export-images.ps1 $libPaths
15+
dotnet docfx metadata
16+
dotnet docfx build $docfxArgs
17+
} finally {
18+
Pop-Location
19+
}

0 commit comments

Comments
 (0)