Skip to content

Commit

Permalink
Github CI: Build and push multi-arch package (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
pglombardo authored May 28, 2024
1 parent e9c57eb commit 86a9ec9
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 32 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ jobs:
- name: "Dotnet Cake Pack"
run: dotnet cake --target=Pack
shell: pwsh
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Push to NuGet
if: github.event_name == 'release'
run: dotnet nuget push ./Artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
shell: pwsh
2 changes: 1 addition & 1 deletion Source/HiveMQtt/Client/HiveMQClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ private async Task<bool> HandleDisconnectionAsync(bool clean = true)

// Cancel all background tasks and close the socket
this.ConnectState = ConnectState.Disconnected;
await this.cancellationTokenSource.CancelAsync().ConfigureAwait(false);
this.cancellationTokenSource.Cancel();

Check warning on line 506 in Source/HiveMQtt/Client/HiveMQClient.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-6.0.x

Cancel synchronously blocks. Await CancelAsync instead. (https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md)

Check warning on line 506 in Source/HiveMQtt/Client/HiveMQClient.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-7.0.x

Cancel synchronously blocks. Await CancelAsync instead. (https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md)

Check warning on line 506 in Source/HiveMQtt/Client/HiveMQClient.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-8.0.x

Cancel synchronously blocks. Await CancelAsync instead. (https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md)

Check warning on line 506 in Source/HiveMQtt/Client/HiveMQClient.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-6.0.x

Cancel synchronously blocks. Await CancelAsync instead. (https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md)

Check warning on line 506 in Source/HiveMQtt/Client/HiveMQClient.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-7.0.x

Cancel synchronously blocks. Await CancelAsync instead. (https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md)

Check warning on line 506 in Source/HiveMQtt/Client/HiveMQClient.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-8.0.x

Cancel synchronously blocks. Await CancelAsync instead. (https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md)
this.CloseSocket();

if (clean)
Expand Down
60 changes: 30 additions & 30 deletions Source/HiveMQtt/Client/HiveMQClientEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected virtual void BeforeConnectEventLauncher(HiveMQClientOptions options)
{
if (t.IsFaulted)
{
Logger.Error("BeforeConnectEventLauncher exception: " + t.Exception.Message);
Logger.Error("BeforeConnectEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -68,7 +68,7 @@ protected virtual void AfterConnectEventLauncher(ConnectResult results)
{
if (t.IsFaulted)
{
Logger.Error("AfterConnectEventLauncher exception: " + t.Exception.Message);
Logger.Error("AfterConnectEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -91,7 +91,7 @@ protected virtual void BeforeDisconnectEventLauncher()
{
if (t.IsFaulted)
{
Logger.Error("BeforeDisconnectEventLauncher exception: " + t.Exception.Message);
Logger.Error("BeforeDisconnectEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -114,7 +114,7 @@ protected virtual void AfterDisconnectEventLauncher(bool clean = false)
{
if (t.IsFaulted)
{
Logger.Error("AfterDisconnectEventLauncher exception: " + t.Exception.Message);
Logger.Error("AfterDisconnectEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -137,7 +137,7 @@ protected virtual void BeforeSubscribeEventLauncher(SubscribeOptions options)
{
if (t.IsFaulted)
{
Logger.Error("BeforeSubscribeEventLauncher exception: " + t.Exception.Message);
Logger.Error("BeforeSubscribeEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -160,7 +160,7 @@ protected virtual void AfterSubscribeEventLauncher(SubscribeResult results)
{
if (t.IsFaulted)
{
Logger.Error("AfterSubscribeEventLauncher exception: " + t.Exception.Message);
Logger.Error("AfterSubscribeEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -183,7 +183,7 @@ protected virtual void BeforeUnsubscribeEventLauncher(List<Subscription> subscri
{
if (t.IsFaulted)
{
Logger.Error("BeforeUnsubscribeEventLauncher exception: " + t.Exception.Message);
Logger.Error("BeforeUnsubscribeEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -206,7 +206,7 @@ protected virtual void AfterUnsubscribeEventLauncher(UnsubscribeResult results)
{
if (t.IsFaulted)
{
Logger.Error("AfterUnsubscribeEventLauncher exception: " + t.Exception.Message);
Logger.Error("AfterUnsubscribeEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -233,7 +233,7 @@ protected virtual void OnMessageReceivedEventLauncher(PublishPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnMessageReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnMessageReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -254,7 +254,7 @@ protected virtual void OnMessageReceivedEventLauncher(PublishPacket packet)
{
if (t.IsFaulted)
{
Logger.Error($"per-subscription MessageReceivedEventLauncher faulted ({packet.Message.Topic}): " + t.Exception.Message);
Logger.Error($"per-subscription MessageReceivedEventLauncher faulted ({packet.Message.Topic}): " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand Down Expand Up @@ -293,7 +293,7 @@ protected virtual void OnConnectSentEventLauncher(ConnectPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnConnectSentEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnConnectSentEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -316,7 +316,7 @@ protected virtual void OnConnAckReceivedEventLauncher(ConnAckPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnConnAckReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnConnAckReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -339,7 +339,7 @@ protected virtual void OnDisconnectSentEventLauncher(DisconnectPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnDisconnectSentEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnDisconnectSentEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -362,7 +362,7 @@ protected virtual void OnDisconnectReceivedEventLauncher(DisconnectPacket packet
{
if (t.IsFaulted)
{
Logger.Error("OnDisconnectReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnDisconnectReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -385,7 +385,7 @@ protected virtual void OnPingReqSentEventLauncher(PingReqPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnPingReqSentEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnPingReqSentEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -408,7 +408,7 @@ protected virtual void OnPingRespReceivedEventLauncher(PingRespPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnPingRespReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnPingRespReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -431,7 +431,7 @@ protected virtual void OnSubscribeSentEventLauncher(SubscribePacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnSubscribeSentEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnSubscribeSentEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -454,7 +454,7 @@ protected virtual void OnSubAckReceivedEventLauncher(SubAckPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnSubAckReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnSubAckReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -477,7 +477,7 @@ protected virtual void OnUnsubscribeSentEventLauncher(UnsubscribePacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnUnsubscribeSentEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnUnsubscribeSentEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -500,7 +500,7 @@ protected virtual void OnUnsubAckReceivedEventLauncher(UnsubAckPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnUnsubAckReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnUnsubAckReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -523,7 +523,7 @@ protected virtual void OnPublishReceivedEventLauncher(PublishPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnPublishReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnPublishReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -546,7 +546,7 @@ protected virtual void OnPublishSentEventLauncher(PublishPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnPublishSentEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnPublishSentEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -569,7 +569,7 @@ protected virtual void OnPubAckReceivedEventLauncher(PubAckPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnPubAckReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnPubAckReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -592,7 +592,7 @@ protected virtual void OnPubAckSentEventLauncher(PubAckPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnPubAckSentEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnPubAckSentEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -615,7 +615,7 @@ protected virtual void OnPubRecReceivedEventLauncher(PubRecPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnPubRecReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnPubRecReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -638,7 +638,7 @@ protected virtual void OnPubRecSentEventLauncher(PubRecPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnPubRecSentEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnPubRecSentEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -661,7 +661,7 @@ protected virtual void OnPubRelReceivedEventLauncher(PubRelPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnPubRelReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnPubRelReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -684,7 +684,7 @@ protected virtual void OnPubRelSentEventLauncher(PubRelPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("OnPubRelSentEventLauncher exception: " + t.Exception.Message);
Logger.Error("OnPubRelSentEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -707,7 +707,7 @@ protected virtual void OnPubCompReceivedEventLauncher(PubCompPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("PubCompReceivedEventLauncher exception: " + t.Exception.Message);
Logger.Error("PubCompReceivedEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand All @@ -730,7 +730,7 @@ protected virtual void OnPubCompSentEventLauncher(PubCompPacket packet)
{
if (t.IsFaulted)
{
Logger.Error("PubCompSentEventLauncher exception: " + t.Exception.Message);
Logger.Error("PubCompSentEventLauncher exception: " + t.Exception?.Message);
}
},
TaskScheduler.Default);
Expand Down
6 changes: 5 additions & 1 deletion Source/HiveMQtt/HiveMQtt.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>HiveMQtt</AssemblyName>
<Description>The HiveMQ MQTT Client is a MQTT 5.0 compatible C# library.</Description>
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<PropertyGroup>
<MinVerTagPrefix>v</MinVerTagPrefix>
</PropertyGroup>
Expand Down

0 comments on commit 86a9ec9

Please sign in to comment.