Skip to content
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

Use artifacts output layout and modern CI workflow #91

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
87 changes: 87 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# This workflow will build and test the package project
name: Bonsai.Harp

on:
push:
pull_request:

env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
ContinuousIntegrationBuild: true
CiRunNumber: ${{ github.run_number }}
CiRunPushSuffix: ${{ github.ref_name }}-ci${{ github.run_number }}
CiRunPullSuffix: pull-${{ github.event.number }}-ci${{ github.run_number }}

jobs:
build:
strategy:
fail-fast: false
matrix:
configuration: [debug, release]
os: [ubuntu-22.04, windows-latest]
include:
- os: windows-latest
configuration: release
collect-packages: true
name: ${{matrix.os}} ${{matrix.configuration}}
runs-on: ${{matrix.os}}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore --configuration ${{ matrix.configuration }}

- name: Test
run: dotnet test --no-build --verbosity normal --configuration ${{ matrix.configuration }}

- name: Pack
id: pack
if: matrix.collect-packages
env:
CiBuildVersionSuffix: ${{ github.event_name == 'push' && env.CiRunPushSuffix || env.CiRunPullSuffix }}
run: dotnet pack --no-build --configuration ${{ matrix.configuration }}

- name: Collect packages
uses: actions/upload-artifact@v4
if: matrix.collect-packages && steps.pack.outcome == 'success' && always()
with:
name: Packages
if-no-files-found: error
path: artifacts/package/${{ matrix.configuration }}/**

publish-github:
runs-on: ubuntu-latest
permissions:
packages: write
needs: [build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

- name: Download packages
uses: actions/download-artifact@v4
with:
name: Packages
path: Packages

- name: Push to GitHub Packages
run: dotnet nuget push "Packages/*.nupkg" --skip-duplicate --no-symbols --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}}
env:
# This is a workaround for https://github.com/NuGet/Home/issues/9775
DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.vs
.suo
.nuget
*.user
bin
obj
/artifacts/
*.user
20 changes: 16 additions & 4 deletions Bonsai.Harp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Harp", "Bonsai.Harp\Bonsai.Harp.csproj", "{4794A074-C5B6-4A4A-BA69-B35087E429F3}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Harp", "src\Bonsai.Harp\Bonsai.Harp.csproj", "{4794A074-C5B6-4A4A-BA69-B35087E429F3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Harp.Tests", "Bonsai.Harp.Tests\Bonsai.Harp.Tests.csproj", "{7E2BF5CA-F84D-4EBD-9F52-AD4EC21562E6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Harp.Tests", "src\Bonsai.Harp.Tests\Bonsai.Harp.Tests.csproj", "{7E2BF5CA-F84D-4EBD-9F52-AD4EC21562E6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Harp.Design", "Bonsai.Harp.Design\Bonsai.Harp.Design.csproj", "{D2964BE5-B758-4AC8-B5D7-29602354FBE6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Harp.Design", "src\Bonsai.Harp.Design\Bonsai.Harp.Design.csproj", "{D2964BE5-B758-4AC8-B5D7-29602354FBE6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Harp.Visualizers", "Bonsai.Harp.Visualizers\Bonsai.Harp.Visualizers.csproj", "{2AE41D5A-630E-4321-ACD3-CE63A3F04FAD}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Harp.Visualizers", "src\Bonsai.Harp.Visualizers\Bonsai.Harp.Visualizers.csproj", "{2AE41D5A-630E-4321-ACD3-CE63A3F04FAD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C147D606-D6F6-4C4D-9977-8A9B1D972C01}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{001DDB7B-D2B7-4665-AF76-E264D1F5474E}"
ProjectSection(SolutionItems) = preProject
build\Bonsai.props = build\Bonsai.props
build\Common.props = build\Common.props
build\Package.props = build\Package.props
build\Version.props = build\Version.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -43,6 +52,9 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{001DDB7B-D2B7-4665-AF76-E264D1F5474E} = {C147D606-D6F6-4C4D-9977-8A9B1D972C01}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5515CCF7-F359-4839-A1CC-FFFEEC06FB95}
EndGlobalSection
Expand Down
18 changes: 1 addition & 17 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Authors>Bonsai Foundation</Authors>
<Copyright>Copyright © Bonsai Foundation CIC and Contributors 2017-2023</Copyright>
<PackageProjectUrl>https://harp-tech.org</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/bonsai-rx/harp/blob/main/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://bonsai-rx.org/assets/images/bonsai.png</PackageIconUrl>
<PackageOutputPath>..\bin\$(Configuration)</PackageOutputPath>
<IncludeSymbols Condition="'$(Configuration)'=='Release'">true</IncludeSymbols>
<SymbolPackageFormat Condition="'$(Configuration)'=='Release'">snupkg</SymbolPackageFormat>
<GeneratePackageOnBuild Condition="'$(Configuration)'=='Release'">true</GeneratePackageOnBuild>
<RepositoryUrl>https://github.com/bonsai-rx/harp.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<VersionSuffix></VersionSuffix>
<LangVersion>9.0</LangVersion>
<Features>strict</Features>
</PropertyGroup>
<Import Project="build/Common.props" />
</Project>
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017-2023 Bonsai Foundation CIC and Contributors
Copyright (c) Bonsai Foundation CIC and Contributors

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
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion Resources/Harp.svg → assets/Harp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions bonsai/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bonsai.exe
Bonsai.exe.*
Packages/
59 changes: 59 additions & 0 deletions bonsai/Bonsai.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Packages>
<Package id="Bonsai" version="2.8.5" />
<Package id="Bonsai.Core" version="2.8.5" />
<Package id="Bonsai.Design" version="2.8.5" />
<Package id="Bonsai.Editor" version="2.8.5" />
<Package id="jacobslusser.ScintillaNET" version="3.6.3" />
<Package id="Markdig" version="0.18.1" />
<Package id="Microsoft.Web.WebView2" version="1.0.1823.32" />
<Package id="Rx-Core" version="2.2.5" />
<Package id="Rx-Interfaces" version="2.2.5" />
<Package id="Rx-Linq" version="2.2.5" />
<Package id="Rx-PlatformServices" version="2.2.5" />
<Package id="SvgNet" version="3.3.3" />
<Package id="System.Buffers" version="4.5.1" />
<Package id="System.Memory" version="4.5.5" />
<Package id="System.Numerics.Vectors" version="4.5.0" />
<Package id="System.Resources.Extensions" version="8.0.0" />
<Package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" />
<Package id="YamlDotNet" version="13.1.1" />
</Packages>
<AssemblyReferences>
<AssemblyReference assemblyName="Bonsai" />
<AssemblyReference assemblyName="Bonsai.Core" />
<AssemblyReference assemblyName="Bonsai.Design" />
<AssemblyReference assemblyName="Bonsai.Editor" />
</AssemblyReferences>
<AssemblyLocations>
<AssemblyLocation assemblyName="Bonsai" processorArchitecture="MSIL" location="Packages/Bonsai.2.8.5/lib/net48/Bonsai.exe" />
<AssemblyLocation assemblyName="Bonsai.Core" processorArchitecture="MSIL" location="Packages/Bonsai.Core.2.8.5/lib/net462/Bonsai.Core.dll" />
<AssemblyLocation assemblyName="Bonsai.Design" processorArchitecture="MSIL" location="Packages/Bonsai.Design.2.8.5/lib/net462/Bonsai.Design.dll" />
<AssemblyLocation assemblyName="Bonsai.Editor" processorArchitecture="MSIL" location="Packages/Bonsai.Editor.2.8.5/lib/net472/Bonsai.Editor.dll" />
<AssemblyLocation assemblyName="Markdig" processorArchitecture="MSIL" location="Packages/Markdig.0.18.1/lib/net40/Markdig.dll" />
<AssemblyLocation assemblyName="Microsoft.Web.WebView2.Core" processorArchitecture="MSIL" location="Packages/Microsoft.Web.WebView2.1.0.1823.32/lib/net45/Microsoft.Web.WebView2.Core.dll" />
<AssemblyLocation assemblyName="Microsoft.Web.WebView2.WinForms" processorArchitecture="MSIL" location="Packages/Microsoft.Web.WebView2.1.0.1823.32/lib/net45/Microsoft.Web.WebView2.WinForms.dll" />
<AssemblyLocation assemblyName="Microsoft.Web.WebView2.Wpf" processorArchitecture="MSIL" location="Packages/Microsoft.Web.WebView2.1.0.1823.32/lib/net45/Microsoft.Web.WebView2.Wpf.dll" />
<AssemblyLocation assemblyName="ScintillaNET" processorArchitecture="MSIL" location="Packages/jacobslusser.ScintillaNET.3.6.3/lib/net40/ScintillaNET.dll" />
<AssemblyLocation assemblyName="SVG" processorArchitecture="MSIL" location="Packages/SvgNet.3.3.3/lib/net462/SVG.dll" />
<AssemblyLocation assemblyName="System.Buffers" processorArchitecture="MSIL" location="Packages/System.Buffers.4.5.1/lib/net461/System.Buffers.dll" />
<AssemblyLocation assemblyName="System.Memory" processorArchitecture="MSIL" location="Packages/System.Memory.4.5.5/lib/net461/System.Memory.dll" />
<AssemblyLocation assemblyName="System.Numerics.Vectors" processorArchitecture="MSIL" location="Packages/System.Numerics.Vectors.4.5.0/lib/net46/System.Numerics.Vectors.dll" />
<AssemblyLocation assemblyName="System.Reactive.Core" processorArchitecture="MSIL" location="Packages/Rx-Core.2.2.5/lib/net45/System.Reactive.Core.dll" />
<AssemblyLocation assemblyName="System.Reactive.Interfaces" processorArchitecture="MSIL" location="Packages/Rx-Interfaces.2.2.5/lib/net45/System.Reactive.Interfaces.dll" />
<AssemblyLocation assemblyName="System.Reactive.Linq" processorArchitecture="MSIL" location="Packages/Rx-Linq.2.2.5/lib/net45/System.Reactive.Linq.dll" />
<AssemblyLocation assemblyName="System.Reactive.PlatformServices" processorArchitecture="MSIL" location="Packages/Rx-PlatformServices.2.2.5/lib/net45/System.Reactive.PlatformServices.dll" />
<AssemblyLocation assemblyName="System.Resources.Extensions" processorArchitecture="MSIL" location="Packages/System.Resources.Extensions.8.0.0/lib/net462/System.Resources.Extensions.dll" />
<AssemblyLocation assemblyName="System.Runtime.CompilerServices.Unsafe" processorArchitecture="MSIL" location="Packages/System.Runtime.CompilerServices.Unsafe.4.5.3/lib/net461/System.Runtime.CompilerServices.Unsafe.dll" />
<AssemblyLocation assemblyName="YamlDotNet" processorArchitecture="MSIL" location="Packages/YamlDotNet.13.1.1/lib/net47/YamlDotNet.dll" />
</AssemblyLocations>
<LibraryFolders>
<LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-arm64/native" platform="arm64" />
<LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-arm64/native_uap" platform="arm64" />
<LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-x64/native" platform="x64" />
<LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-x64/native_uap" platform="x64" />
<LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-x86/native" platform="x86" />
<LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-x86/native_uap" platform="x86" />
</LibraryFolders>
</PackageConfiguration>
8 changes: 8 additions & 0 deletions bonsai/NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>
4 changes: 4 additions & 0 deletions bonsai/Setup.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
pushd %~dp0
powershell -ExecutionPolicy Bypass -File ./Setup.ps1
popd
21 changes: 21 additions & 0 deletions bonsai/Setup.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Push-Location $PSScriptRoot
if (!(Test-Path "./Bonsai.exe")) {
$release = "https://github.com/bonsai-rx/bonsai/releases/latest/download/Bonsai.zip"
$configPath = "./Bonsai.config"
if (Test-Path $configPath) {
[xml]$config = Get-Content $configPath
$bootstrapper = $config.PackageConfiguration.Packages.Package.where{$_.id -eq 'Bonsai'}
if ($bootstrapper) {
$version = $bootstrapper.version
$release = "https://github.com/bonsai-rx/bonsai/releases/download/$version/Bonsai.zip"
}
}
Invoke-WebRequest $release -OutFile "temp.zip"
Move-Item -Path "NuGet.config" "temp.config" -ErrorAction SilentlyContinue
Expand-Archive "temp.zip" -DestinationPath "." -Force
Move-Item -Path "temp.config" "NuGet.config" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "temp.zip"
Remove-Item -Path "Bonsai32.exe"
}
& .\Bonsai.exe --no-editor
Pop-Location
6 changes: 6 additions & 0 deletions build/Bonsai.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<!-- For configuring launchSettings.json we need to resolve the bootstrapper output path here -->
<PropertyGroup>
<BonsaiExecutablePath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../bonsai/Bonsai.exe'))</BonsaiExecutablePath>
</PropertyGroup>
</Project>
19 changes: 19 additions & 0 deletions build/Common.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project>
<PropertyGroup>
<!-- Common C# Properties -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<UseArtifactsOutput>true</UseArtifactsOutput>
<LangVersion>latest</LangVersion>
<Features>strict</Features>

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

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

<Import Project="Bonsai.props" />
<Import Project="Package.props" />
<Import Project="Version.props" />
</Project>
20 changes: 20 additions & 0 deletions build/Package.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<PropertyGroup>
<Authors>Bonsai</Authors>
<Copyright>Copyright © Bonsai Foundation CIC and Contributors</Copyright>
<PackageProjectUrl>https://harp-tech.org</PackageProjectUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageType>Dependency;BonsaiLibrary</PackageType>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
<IncludeSymbols>true</IncludeSymbols>
</PropertyGroup>

<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)..\LICENSE" PackagePath="/" />
<Content Include="$(MSBuildThisFileDirectory)..\icon.png" PackagePath="/" />
<Content Include="$(MSBuildThisFileDirectory)..\README.md" PackagePath="/" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions build/Version.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project>
<PropertyGroup>
<!-- Semantic version prefix -->
<VersionPrefix>3.6.0</VersionPrefix>
</PropertyGroup>

<PropertyGroup Condition="'$(ContinuousIntegrationBuild)' != 'true'">
<!-- When making local builds DevVersion can be overridden to generate multiple local versions -->
<DevVersion Condition="'$(DevVersion)' == ''">0</DevVersion>

<VersionSuffix>dev$(DevVersion)</VersionSuffix>
<_FileVersionRevision>$([MSBuild]::Add(60000, $(DevVersion)))</_FileVersionRevision>
</PropertyGroup>

<PropertyGroup Condition="'$(ContinuousIntegrationBuild)' == 'true'">
<VersionSuffix>$(CiBuildVersionSuffix)</VersionSuffix>
<_FileVersionRevision>0</_FileVersionRevision>
<_FileVersionRevision Condition="'$(CiBuildVersionSuffix)' != '' and '$(CiRunNumber)' != ''">$(CiRunNumber)</_FileVersionRevision>
</PropertyGroup>

<PropertyGroup>
<!-- Force malformed versions to be an error -->
<WarningsAsErrors>$(WarningsAsErrors);CS7035</WarningsAsErrors>
</PropertyGroup>
</Project>
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<Title>Bonsai - Harp Design Library</Title>
<Description>Bonsai Design Library containing visualizer and editor classes for configuring Harp devices.</Description>
<PackageTags>Bonsai Rx Harp Hardware Protocol Design</PackageTags>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<UseWindowsForms>true</UseWindowsForms>
<TargetFramework>net462</TargetFramework>
<VersionPrefix>3.5.0</VersionPrefix>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bonsai.Design" Version="2.8.0" />
<PackageReference Include="Bonsai.Design" Version="2.8.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Bonsai": {
"commandName": "Executable",
"executablePath": "$(registry:HKEY_CURRENT_USER\\Software\\Bonsai Foundation\\Bonsai@InstallDir)Bonsai.exe",
"executablePath": "$(BonsaiExecutablePath)",
"commandLineArgs": "--lib:\"$(TargetDir).\"",
"nativeDebugging": true
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<Version>3.5.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
Expand Down
Loading