Skip to content

Common CI/CD and repository layout #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .bonsai/NuGet.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Gallery" value="Gallery" />
<add key="Bonsai Packages" value="https://www.myget.org/F/bonsai/api/v3/index.json" />
<add key="Community Packages" value="https://www.myget.org/F/bonsai-community/api/v3/index.json" />
</packageSources>
</configuration>
5 changes: 3 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"isRoot": true,
"tools": {
"docfx": {
"version": "2.75.3",
"version": "2.78.3",
"commands": [
"docfx"
]
],
"rollForward": false
}
}
}
46 changes: 46 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
root = true

[*]
indent_style = space

#--------------------------------------------------------------------------------------------------
# XML, JSON, and web files
#--------------------------------------------------------------------------------------------------
[*.{xml,csproj,vcxproj,vcxproj.filters,shproj,props,targets,config,nuspec,resx,vsixmanifest,wxs,vstemplate,slnx}]
indent_size = 2

[*.json]
indent_size = 2

[*.{html,css}]
indent_size = 2

#--------------------------------------------------------------------------------------------------
# C++
#--------------------------------------------------------------------------------------------------
[*.{c,cpp,h,hpp,ixx}]
indent_size = 4
charset = utf-8-bom
trim_trailing_whitespace = true
insert_final_newline = true

#--------------------------------------------------------------------------------------------------
# C#
#--------------------------------------------------------------------------------------------------
[*.{cs,csx}]
indent_size = 4
charset = utf-8-bom
trim_trailing_whitespace = true
insert_final_newline = true

# Language keyword vs full type name
# Predefined for members, etc does not create a message because the explicitly sized types are conveient in interop scenarios where the bit size matters.
dotnet_style_predefined_type_for_locals_parameters_members = true:none
dotnet_style_predefined_type_for_member_access = true:suggestion

# Instantiate argument exceptions correctly
dotnet_diagnostic.CA2208.severity = warning

# Don't complain about not using modern collection syntax
dotnet_style_prefer_collection_expression = never
csharp_style_prefer_range_operator = false
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Config
*.gitignore text
*.gitattributes text
*.gitmodules text eol=lf
*.editorconfig text
*.git-blame-ignore-revs text
*.sln text
Expand Down Expand Up @@ -39,4 +40,4 @@ LICENSE text
*.png binary
*.ico binary
*.gif binary
*.svg text
*.svg text
344 changes: 344 additions & 0 deletions .github/workflows/Bonsai.Scripting.Python.yml

Large diffs are not rendered by default.

51 changes: 0 additions & 51 deletions .github/workflows/docs.yml

This file was deleted.

11 changes: 5 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.vs
.bonsai/Bonsai.exe*
.bonsai/Packages/
.bonsai/Settings/
.vs/
/artifacts/
.venv
bin
obj
Packages
*.exe
*.exe.*
*.user
*.suo
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "docs/bonsai"]
path = docs/bonsai
url = https://github.com/bonsai-rx/docfx-tools
[submodule "docs/bonsai-docfx"]
path = docs/bonsai-docfx
url = https://github.com/bonsai-rx/docfx-tools.git
11 changes: 8 additions & 3 deletions src/Bonsai.Scripting.Python.sln → Bonsai.Scripting.Python.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bonsai.Scripting.Python", "Bonsai.Scripting.Python\Bonsai.Scripting.Python.csproj", "{DE54420F-E2A7-48E5-B96E-7D9CEA1B2CB0}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Scripting.Python", "src\Bonsai.Scripting.Python\Bonsai.Scripting.Python.csproj", "{DE54420F-E2A7-48E5-B96E-7D9CEA1B2CB0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{497840F3-F4DC-4E8A-A000-21E5929B945B}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{DEE5DD87-39C1-BF34-B639-A387DCCF972B}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
build\Common.csproj.props = build\Common.csproj.props
build\Common.csproj.targets = build\Common.csproj.targets
build\Common.Tests.csproj.props = build\Common.Tests.csproj.props
build\icon.png = build\icon.png
build\Package.props = build\Package.props
build\Project.csproj.props = build\Project.csproj.props
EndProjectSection
EndProject
Global
Expand Down
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="build/Common$(MSBuildProjectExtension).props" Condition="Exists('build/Common$(MSBuildProjectExtension).props')"/>
</Project>
3 changes: 3 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="build/Common$(MSBuildProjectExtension).targets" Condition="Exists('build/Common$(MSBuildProjectExtension).targets')" />
</Project>
18 changes: 8 additions & 10 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
MIT License
Copyright (c) Bonsai Foundation CIC and Contributors

Copyright (c) 2023 Bonsai Foundation CIC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Expand All @@ -18,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
6 changes: 6 additions & 0 deletions build/Common.Tests.csproj.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
</Project>
80 changes: 80 additions & 0 deletions build/Common.csproj.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!--
Solution-specific configuration/targets should generally not be placed in this file.
For solution-wide NuGet properties, update Package.props
For everything else, update or create Project.csproj.props
-->
<Project>
<!-- Default configuration and platform when not present -->
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
</PropertyGroup>

<!-- Common C# Properties -->
<PropertyGroup>
<LangVersion>12.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Features>strict</Features>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<!-- Build to central artifacts folder instead of scattering bin and obj throughout the solution tree -->
<UseArtifactsOutput>true</UseArtifactsOutput>
<ArtifactsPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../artifacts'))</ArtifactsPath>

<!--
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.)
As such if we detect we're running under WSL we use different output directories.
-->
<ArtifactsPath Condition="'$(WSL_DISTRO_NAME)' != ''">$(ArtifactsPath)/wsl</ArtifactsPath>
</PropertyGroup>

<!-- Universal NuGet Package Properties -->
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageType>Dependency;BonsaiLibrary</PackageType>

<PackageIcon>icon.png</PackageIcon>
<PackageIconSourcePath>$(MSBuildThisFileDirectory)icon.png</PackageIconSourcePath>

<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageLicenseSourcePath>$(MSBuildThisFileDirectory)../LICENSE</PackageLicenseSourcePath>

<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReadmeSourcePath>$(MSBuildThisFileDirectory)../docs/README.md</PackageReadmeSourcePath>
<PackageReadmeSourcePath Condition="Exists('$(MSBuildThisFileDirectory)README.nuget.md')">$(MSBuildThisFileDirectory)README.nuget.md</PackageReadmeSourcePath>
<PackageReadmeSourcePath Condition="Exists('$(MSBuildProjectDirectory)\README.md')">$(MSBuildProjectDirectory)\README.md</PackageReadmeSourcePath>
<PackageReadmeSourcePath Condition="Exists('$(MSBuildProjectDirectory)\README.nuget.md')">$(MSBuildProjectDirectory)\README.nuget.md</PackageReadmeSourcePath>

<!-- Emit modern symbol packages -->
<IncludeSymbols>false</IncludeSymbols>
<IncludeSymbols Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<!-- Embed untracked sources in the PDB for Source Link when building from CI -->
<EmbedUntrackedSources>false</EmbedUntrackedSources>
<EmbedUntrackedSources Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</EmbedUntrackedSources>
</PropertyGroup>

<PropertyGroup>
<!--
Promote especially problematic warnings to errors
* NU1701 - Restore graph contains mismatched target frameworks
* CS7035 - Malformed version string
-->
<WarningsAsErrors>$(WarningsAsErrors);NU1701;CS7035</WarningsAsErrors>

<!-- Explicitly opt in to modern resource embedding (required for building .NET Framework projects from .NET SDK) -->
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>

<!-- Enable windows targeting (required when building from non-Windows platforms) -->
<EnableWindowsTargeting>true</EnableWindowsTargeting>

<!-- Provide Bonsai executable path for use with launchSettings.json -->
<BonsaiExecutablePath>$(MSBuildThisFileDirectory)../.bonsai/Bonsai.exe</BonsaiExecutablePath>
</PropertyGroup>

<Import Project="Project.csproj.props" Condition="Exists('Project.csproj.props')" />
<Import Project="Package.props" />
<Import Project="Common.Tests.csproj.props" Condition="$(MSBuildProjectName.EndsWith('.Tests'))" />
</Project>
46 changes: 46 additions & 0 deletions build/Common.csproj.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!--
Solution-specific configuration/targets should generally not be placed in this file, instead create or update Project.csproj.targets
-->
<Project>
<ItemGroup>
<None Include="$(PackageIconSourcePath)" Pack="true" PackagePath="$(PackageIcon)" Visible="false" />
<None Include="$(PackageLicenseSourcePath)" Pack="true" PackagePath="" Visible="false" />
<None Include="$(PackageReadmeSourcePath)" Pack="true" PackagePath="$(PackageReadmeFile)" Visible="false" />
</ItemGroup>

<!-- Default tool configuration -->
<PropertyGroup Condition="'$(PackAsTool)' == 'true'">
<ToolCommandName Condition="'$(ToolCommandName)' == ''">$(TargetName.ToLowerInvariant())</ToolCommandName>
<PackageType>DotnetTool</PackageType>

<!--
Disable warnings relating to missing documentation
(It's actually too late to easily disable documentation file generation outright, Microsoft.NET.Sdk.BeforeCommon.targets already reacted to it being enabled.)
-->
<NoWarn>1591,1573</NoWarn>
</PropertyGroup>

<Import Project="Project.csproj.targets" Condition="Exists('Project.csproj.targets')" />

<!-- Package versioning - Intentionally after project-specific targets to discourage deviation -->
<PropertyGroup>
<!--
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.
If you feel compelled to change this version number for local testing you're almost certainly doing something wrong!
-->
<DevVersion Condition="'$(DevVersion)' == ''">0</DevVersion>
<Version>42.42.42-dev$(DevVersion)</Version>

<Version Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(CiBuildVersion)</Version>
</PropertyGroup>

<Target Name="VersionSanityChecks" BeforeTargets="Build">
<Error Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(CiBuildVersion)' == ''" Text="CI version info not configured." />
<Error Condition="'$(PackageVersion)' != '' and '$(PackageVersion)' != '$(Version)'" Text="Do not manually specify PackageVersion." />
</Target>

<!-- Check for stale bin/obj directories left over from before we switched to the central artifacts folder -->
<Target Name="CheckForStaleOutputDirectories" AfterTargets="Build" Condition="Exists('$(ProjectDir)bin') or Exists('$(ProjectDir)obj')">
<Warning Text="Stale bin/obj directories exist for $(MSBuildProjectName), deleting them is strongly recommended." />
</Target>
</Project>
9 changes: 9 additions & 0 deletions build/Package.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<PackageTags>Bonsai Rx Scripting Python Python.NET</PackageTags>
<PackageProjectUrl>https://bonsai-rx.org/python-scripting</PackageProjectUrl>

<Authors>Bonsai Foundation</Authors>
<Copyright>Copyright © Bonsai Foundation CIC and Contributors</Copyright>
</PropertyGroup>
</Project>
5 changes: 5 additions & 0 deletions build/Project.csproj.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<Nullable>annotations</Nullable>
</PropertyGroup>
</Project>
Binary file added build/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/.gitignore

This file was deleted.

File renamed without changes.
5 changes: 0 additions & 5 deletions docs/api/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion docs/bonsai
Submodule bonsai deleted from 81ef52
1 change: 1 addition & 0 deletions docs/bonsai-docfx
Submodule bonsai-docfx added at 5b584c
Loading