Skip to content

Commit

Permalink
Build and test updates (#509)
Browse files Browse the repository at this point in the history
* Update build and test workflow

* Update nunit
  • Loading branch information
mtmk authored Jun 11, 2024
1 parent 82b1d8c commit 765e8ae
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- if: ${{ fromJSON(steps.tag.outputs.create) }}
name: Pack
# https://learn.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg
run: dotnet pack -c Release -o dist -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
run: dotnet pack -c Release -o dist -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:ContinuousIntegrationBuild=true

- if: ${{ fromJSON(steps.tag.outputs.create) }}
name: Push
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ jobs:
run: |
Invoke-WebRequest https://download.jetbrains.com/resharper/JetBrains.dotMemoryUnit.3.2.20220510.zip -OutFile dotMemoryUnit.zip
Expand-Archive dotMemoryUnit.zip
nuget install NUnit.ConsoleRunner -version 3.16.3
$current_path = (Get-Item .).FullName
echo "$current_path\dotMemoryUnit" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
dotnet tool install --global NUnit.ConsoleRunner.NetCore
- name: Build
run: dotnet build -c Debug
run: dotnet build -c Release

- name: Memory Test
run: dotMemoryUnit .\NUnit.ConsoleRunner.3.16.3\tools\nunit3-console.exe --propagate-exit-code -- .\tests\NATS.Client.Core.MemoryTests\bin\Debug\net6.0\NATS.Client.Core.MemoryTests.dll
- name: Memory Test (net6.0)
run: dotMemoryUnit $env:userprofile\.dotnet\tools\nunit.exe --propagate-exit-code -- .\tests\NATS.Client.Core.MemoryTests\bin\Release\net6.0\NATS.Client.Core.MemoryTests.dll
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<NoWarn>$(NoWarn);CS1591;SA0001</NoWarn>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)opensource.snk</AssemblyOriginatorKeyFile>

<!-- Do not package by default to avoid accidental publishing -->
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>

<!-- Disable tiered compilation so we have the best JIT optimization from the start -->
<TieredCompilation>false</TieredCompilation>
</PropertyGroup>

<ItemGroup>
Expand Down
14 changes: 4 additions & 10 deletions tests/NATS.Client.Core.MemoryTests/NatsConsumeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ public class NatsConsumeTests
[Test]
public void Subscription_should_not_be_collected_when_in_consume_async_enumerator()
{
Console.WriteLine(">>> STARTING: MEM CONSUMER TEST");

var server = NatsServer.StartJSWithTrace(new TestTextWriterOutput(Console.Out));
var server = NatsServer.StartJS();
try
{
var nats = server.CreateClientConnection(new NatsOpts { RequestTimeout = TimeSpan.FromSeconds(10) });
var js = new NatsJSContext(nats);

var rtt = nats.PingAsync().AsTask().GetAwaiter().GetResult();
Console.WriteLine($">>> RTT: {rtt.TotalMilliseconds}ms");
nats.PingAsync().AsTask().GetAwaiter().GetResult();

var sync = new TaskCompletionSource();

Expand Down Expand Up @@ -107,16 +104,13 @@ public void Subscription_should_not_be_collected_when_in_consume_async_enumerato
[Test]
public void Subscription_should_not_be_collected_when_in_ordered_consume_async_enumerator()
{
Console.WriteLine(">>> STARTING: MEM ORDERED CONSUMER TEST");

var server = NatsServer.StartJSWithTrace(new TestTextWriterOutput(Console.Out));
var server = NatsServer.StartJS();
try
{
var nats = server.CreateClientConnection(new NatsOpts { RequestTimeout = TimeSpan.FromSeconds(10) });
var js = new NatsJSContext(nats);

var rtt = nats.PingAsync().AsTask().GetAwaiter().GetResult();
Console.WriteLine($">>> RTT: {rtt.TotalMilliseconds}ms");
nats.PingAsync().AsTask().GetAwaiter().GetResult();

var sync = new TaskCompletionSource();

Expand Down

0 comments on commit 765e8ae

Please sign in to comment.