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

Add .NET 9 unit tests, building #626

Merged
merged 19 commits into from
Nov 5, 2024
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
15 changes: 12 additions & 3 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ jobs:
uses: microsoft/[email protected]
if: matrix.os == 'windows-latest'

- name: Setup .NET 6.0, 7.0, 8.0 for tests
- name: Setup .NET 6.0, 7.0, 8.0, 9.0 for tests
uses: actions/[email protected]
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.x

- name: Run NetSparkle.Tests in .NET 4.6.2
run: dotnet test -f net462 ${{ github.workspace }}/src/NetSparkle.Tests/NetSparkle.Tests.csproj
Expand All @@ -53,6 +54,12 @@ jobs:
- name: Run NetSparkle.Tests.AppCastGenerator in .NET 8
run: dotnet test -f net8.0 ${{ github.workspace }}/src/NetSparkle.Tests.AppCastGenerator/NetSparkle.Tests.AppCastGenerator.csproj

- name: Run NetSparkle.Tests in .NET 9
run: dotnet test -f net9.0 ${{ github.workspace }}/src/NetSparkle.Tests/NetSparkle.Tests.csproj

- name: Run NetSparkle.Tests.AppCastGenerator in .NET 9
run: dotnet test -f net9.0 ${{ github.workspace }}/src/NetSparkle.Tests.AppCastGenerator/NetSparkle.Tests.AppCastGenerator.csproj

build:
name: Build all packages as smoke test
runs-on: windows-latest
Expand All @@ -67,13 +74,14 @@ jobs:
- name: Add MSBuild to PATH
uses: microsoft/[email protected]

- name: Setup .NET 6.0, 7.0, 8.0
- name: Setup .NET 6.0, 7.0, 8.0, 9.0
uses: actions/[email protected]
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.x

- name: Clean things to be safe
run: |
Expand Down Expand Up @@ -113,13 +121,14 @@ jobs:
- name: Add MSBuild to PATH
uses: microsoft/[email protected]

- name: Setup .NET 6.0, 7.0, 8.0
- name: Setup .NET 6.0, 7.0, 8.0, 9.0
uses: actions/[email protected]
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.x

- name: Publish NetSparkleUpdater.SparkleUpdater on version change
uses: nitz/publish-nuget@60fd3adf9d9eecc3bbf8a98738734d3061347172
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ The file that launches your downloaded update executable only waits for 90 secon
* Subclassing `JSONConfiguration` lets you quickly change the file path where data is saved via `GetSavePath`
* Subclass `AppCastHelper` if you want full control over the app cast downloading and parsing process. Note that you can probably do everything you need to do via the `AppCastHelper` properties (including `IAppCastFilter AppCastFilter`), but subclassing will give you full, absolute control over the whole process. To use the instance of your class, set `SparkleUpdater.AppCastHelper`.
* Subclass `ReleaseNotesGrabber` to control the release notes downloading (and therefore display) process. To use an instance of your class, set `UIFactory.ReleaseNotesGrabberOverride`.
* Override `WebFileDownloader` if you don't want to implement `IUpdateDownloader` yourself and just want to override a function or two such as `CreateHttpClient`. To use an instance of your class, set `SparkleUpdater.UpdateDownloader`.
* Override `WebFileDownloader` if you don't want to implement `IUpdateDownloader` yourself and just want to override a function or two such as `CreateHttpClient` or `RetreiveDestinationFileNameAsync`. To use an instance of your class, set `SparkleUpdater.UpdateDownloader`.
* Override `WebRequestAppCastDataDownloader` if you don't want to implement `IAppCastDataDownloader` and just want to override a function or two such as `CreateHttpClient`. To use an instance of your class, set `SparkleUpdater.AppCastDataDownloader`.
* Override `LogWriter` to implement the `PrintMessage` function; because `ILogger` is a pretty simple interface, you can probably just implement that interface yourself if your needs are complex. To use an instance of your class, set `SparkleUpdater.LogWriter`.
* Override `SparkleUpdater` to implement some different installation-related functions, including:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net7.0;net6.0</TargetFrameworks>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
Expand Down
2 changes: 1 addition & 1 deletion src/NetSparkle.Tests/NetSparkle.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ProjectGuid>{E50AC3A5-6C63-40D7-A4C4-9B359EFD5707}</ProjectGuid>
<RootNamespace>NetSparkleUnitTests</RootNamespace>
<AssemblyName>NetSparkleUnitTests</AssemblyName>
<TargetFrameworks>net8.0;net7.0;net6.0;net462</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net7.0;net6.0;net462</TargetFrameworks>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
Expand Down
2 changes: 1 addition & 1 deletion src/NetSparkle.Tests/SparkleUpdaterFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using NetSparkleUpdater.AppCastHandlers;
using NetSparkleUpdater.Interfaces;
using Xunit;
#if (NETSTANDARD || NET5 || NET6 || NET7 || NET8)
#if (NETSTANDARD || NET5 || NET6 || NET7 || NET8 || NET9)
using System.Runtime.InteropServices;
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>NetSparkleUpdater.AppCastGenerator</RootNamespace>
<AssemblyName>NetSparkleUpdater.Tools.AppCastGenerator</AssemblyName>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net7.0;net6.0</TargetFrameworks>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>NetSparkleUpdater.DSAHelper</RootNamespace>
<AssemblyName>NetSparkleUpdater.Tools.DSAHelper</AssemblyName>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net7.0;net6.0</TargetFrameworks>
<AssemblyTitle>NetSparkle</AssemblyTitle>
<Product>NetSparkleUpdater.Tools.DSAHelper</Product>
<Description>Command line tool 'netsparkle-dsa' to generate and use DSA signatures. WARNING: DSA signatures are insecure. If possible, please use NetSparkleUpdater.Tools.AppCastGenerator instead to use ed25519 signatures. Use in conjunction with the NetSparkleUpdater library.</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/NetSparkle.UI.Avalonia/NetSparkle.UI.Avalonia.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net7.0;net6.0;netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>NetSparkleUpdater.UI.Avalonia</PackageId>
<Version>3.0.0-preview20241016001</Version>
Expand Down
11 changes: 7 additions & 4 deletions src/NetSparkle.UI.WPF/NetSparkle.UI.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<ProjectGuid>{6915843C-7947-4268-B569-6F5684651DF4}</ProjectGuid>
<UseWPF>true</UseWPF>
<TargetFrameworks>net8.0-windows;net7.0-windows;net6.0-windows;net462</TargetFrameworks>
<TargetFrameworks>net9.0-windows;net8.0-windows;net7.0-windows;net6.0-windows;net462</TargetFrameworks>
<AssemblyTitle>NetSparkleUpdater.UI.WPF</AssemblyTitle>
<Product>NetSparkleUpdater.UI.WPF</Product>
<Copyright>Copyright © 2024</Copyright>
Expand Down Expand Up @@ -52,13 +52,16 @@
<ProjectReference Include="..\NetSparkle\NetSparkle.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
Expand Down
11 changes: 7 additions & 4 deletions src/NetSparkle.UI.WinForms/NetSparkle.UI.WinForms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<RootNamespace>NetSparkleUpdater.UI.WinForms</RootNamespace>
<AssemblyName>NetSparkleUpdater.UI.WinForms</AssemblyName>
<UseWindowsForms>true</UseWindowsForms>
<TargetFrameworks>net8.0-windows;net7.0-windows;net6.0-windows;net462</TargetFrameworks>
<TargetFrameworks>net9.0-windows;net8.0-windows;net7.0-windows;net6.0-windows;net462</TargetFrameworks>
<AssemblyTitle>NetSparkle.NetFramework.WinForms</AssemblyTitle>
<Product>NetSparkleUpdater.UI.WinForms</Product>
<Copyright>Copyright © 2024</Copyright>
Expand Down Expand Up @@ -95,14 +95,17 @@
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/NetSparkle.UI.WinForms/ToastNotifier.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using NetSparkleUpdater.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

Expand Down Expand Up @@ -49,6 +50,7 @@ public ToastNotifier(Icon? applicationIcon = null)
/// <summary>
/// Action to perform when the user clicks on the toast window
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Action ClickAction { get; set; }

private void PauseTimerTick(object? sender, EventArgs e)
Expand Down
2 changes: 2 additions & 0 deletions src/NetSparkle.UI.WinForms/UpdateAvailableWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Collections.Generic;
using NetSparkleUpdater.Events;
using NetSparkleUpdater.AppCastHandlers;
using System.ComponentModel;

namespace NetSparkleUpdater.UI.WinForms
{
Expand Down Expand Up @@ -40,6 +41,7 @@ public partial class UpdateAvailableWindow : Form, IUpdateAvailable
/// <summary>
/// Object responsible for downloading and formatting markdown release notes for display in HTML
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public ReleaseNotesGrabber? ReleaseNotesGrabber { get; set; }

private ISignatureVerifier? _signatureVerifier;
Expand Down
6 changes: 3 additions & 3 deletions src/NetSparkle/Configurations/RegistryConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Globalization;
using Microsoft.Win32;
using NetSparkleUpdater.Interfaces;
#if (NETSTANDARD || NET6 || NET7 || NET8)
#if (NETSTANDARD || NET6 || NET7 || NET8 || NET9)
using System.Runtime.InteropServices;
#endif

Expand Down Expand Up @@ -134,7 +134,7 @@ private DateTime ConvertStringToDate(string str)
/// <returns><c>true</c> if the items were loaded successfully; false otherwise</returns>
private bool LoadValuesFromPath(string regPath)
{
#if (NETSTANDARD || NET6 || NET7 || NET8)
#if (NETSTANDARD || NET6 || NET7 || NET8 || NET9)
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return false;
Expand Down Expand Up @@ -206,7 +206,7 @@ private void SaveDidRunOnceAsTrue(string regPath)
/// <returns><c>true</c> if the values were saved to the registry; false otherwise</returns>
private bool SaveValuesToPath(string regPath)
{
#if (NETSTANDARD || NET6 || NET7 || NET8)
#if (NETSTANDARD || NET6 || NET7 || NET8 || NET9)
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return false;
Expand Down
12 changes: 11 additions & 1 deletion src/NetSparkle/NetSparkle.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net7.0;net6.0;netstandard2.0;net462</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>NetSparkleUpdater.SparkleUpdater</PackageId>
<Version>3.0.0-preview20241016001</Version>
Expand Down Expand Up @@ -82,6 +82,16 @@
<DocumentationFile>..\bin\Debug\NetSparkle\NetSparkle.xml</DocumentationFile>
<DefineConstants>DEBUG;TRACE;NETCORE;NET8</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net9.0|AnyCPU'">
<OutputPath>..\bin\Release\NetSparkle\</OutputPath>
<DocumentationFile>..\bin\Release\NetSparkle\NetSparkle.xml</DocumentationFile>
<DefineConstants>TRACE;NETCORE;NET9</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net9.0|AnyCPU'">
<OutputPath>..\bin\Debug\NetSparkle\</OutputPath>
<DocumentationFile>..\bin\Debug\NetSparkle\NetSparkle.xml</DocumentationFile>
<DefineConstants>DEBUG;TRACE;NETCORE;NET9</DefineConstants>
</PropertyGroup>
<!-- .NET 4.6.2 references, compilation flags and build options -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<Reference Include="System" />
Expand Down
4 changes: 2 additions & 2 deletions src/NetSparkle/SparkleUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using NetSparkleUpdater.AppCastHandlers;
using NetSparkleUpdater.AssemblyAccessors;
using System.Text;
#if NETSTANDARD || NET6 || NET7 || NET8
#if NETSTANDARD || NET6 || NET7 || NET8 || NET9
using System.Runtime.InteropServices;
#endif

Expand Down Expand Up @@ -274,7 +274,7 @@ public Configuration Configuration
{
if (_configuration == null)
{
#if NETSTANDARD || NET6 || NET7 || NET8
#if NETSTANDARD || NET6 || NET7 || NET8 || NET9
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
_configuration = new RegistryConfiguration(new AssemblyDiagnosticsAccessor(_appReferenceAssembly));
Expand Down