Skip to content
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
58 changes: 58 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build

on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
release:
types: [created]

env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

jobs:
build:
runs-on: windows-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: 17
distribution: 'zulu' # Alternative distribution options are available.
- name: Setup dotnet
uses: actions/setup-dotnet@v5.2.0
with:
dotnet-version: 8.0.x
- name: Checkout code
uses: actions/checkout@v5
- name: Cache SonarQube Cloud packages
uses: actions/cache@v5
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarQube Cloud scanner
id: cache-sonar-scanner
uses: actions/cache@v5
with:
path: ${{ runner.temp }}\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarQube Cloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path ${{ runner.temp }}\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path ${{ runner.temp }}\scanner
- name: SonarQube Cloud scanner begin
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && env.SONAR_TOKEN != '') }}
run: ${{ runner.temp }}\scanner\dotnet-sonarscanner begin /k:"KxSystems_csharpkdb" /o:"kxsystems" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.vstest.reportsPaths="**\TestResults\*.trx" /d:sonar.cs.opencover.reportsPaths="*\coverage.opencover.xml" /d:sonar.verbose=false
- name: Build
run : dotnet build /p:Configuration=Release .\CSharpKdb.sln
- name: Test
run: dotnet test /p:Configuration=Release --no-build .\kx.Test\kx.Test.csproj --logger:trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: SonarQube Cloud scanner finish
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && env.SONAR_TOKEN != '') }}
run: ${{ runner.temp }}\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Demos/FeedDemo/FeedDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion Demos/QueryResponseDemo/QueryResponseDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion Demos/SerializationDemo/SerializationDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion Demos/SubscriberDemo/SubscriberDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion kx.Benchmark.Test/kx.Benchmark.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<StartupObject>kx.Benchmark.Test.Program</StartupObject>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>kx.Benchmark.Test.snk</AssemblyOriginatorKeyFile>
Expand Down
61 changes: 29 additions & 32 deletions kx.Test/TestUtils/TestSerialisationHelper.cs
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
using System;
using MessagePack;
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace kx.Test.TestUtils
{
/// <summary>
/// A helper class for testing serialisation and de-serialisation logic
/// in unit-tests
/// </summary>
internal static class TestSerialisationHelper
{
/// <summary>
/// A helper class for testing serialisation and de-serialisation logic
/// in unit-tests
/// Performs binary serialisation and de-serialisation on a specified exception.
/// </summary>
internal static class TestSerialisationHelper
/// <typeparam name="T">The type of exception being tested.</typeparam>
/// <param name="exception">The exception to be serialised and de-serialised.</param>
/// <returns>
/// A de-serialised instance of the exception passed. All serialisable members should match the original.
/// </returns>
/// <remarks>
/// This is primarily intended to confirm custom exceptions within the DeltaApiCore
/// library comply to ISerialization pattern.
///
/// See https://stackoverflow.com/questions/94488/what-is-the-correct-way-to-make-a-custom-net-exception-serializable
/// </remarks>
public static T SerialiseAndDeserialiseException<T>(T exception)
where T : Exception
{
/// <summary>
/// Performs binary serialisation and de-serialisation on a specified exception.
/// </summary>
/// <typeparam name="T">The type of exception being tested.</typeparam>
/// <param name="exception">The exception to be serialised and de-serialised.</param>
/// <returns>
/// A de-serialised instance of the exception passed. All serialisable members should match the original.
/// </returns>
/// <remarks>
/// This is primarily intended to confirm custom exceptions within the DeltaApiCore
/// library comply to ISerialization pattern.
///
/// See https://stackoverflow.com/questions/94488/what-is-the-correct-way-to-make-a-custom-net-exception-serializable
/// </remarks>
public static T SerialiseAndDeserialiseException<T>(T exception)
where T : Exception
{
BinaryFormatter binaryFormatter = new BinaryFormatter();

using (var stream = new MemoryStream())
{
binaryFormatter.Serialize(stream, exception);

stream.Seek(0, 0);

return (T)binaryFormatter.Deserialize(stream);
}
}
using (var stream = new MemoryStream())
{
MessagePackSerializer.Serialize(stream, exception, MessagePack.Resolvers.ContractlessStandardResolver.Options);
stream.Seek(0, 0);
return (T)MessagePackSerializer.Deserialize<T>(stream, MessagePack.Resolvers.ContractlessStandardResolver.Options);
}
}
}
}
3 changes: 2 additions & 1 deletion kx.Test/kx.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>

Expand All @@ -25,6 +25,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MessagePack" Version="3.1.3" />
<PackageReference Include="Moq" Version="4.15.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
Expand Down
2 changes: 1 addition & 1 deletion kx/kx.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFrameworks>netstandard2.1;net8.0</TargetFrameworks>
<Title>CSharpKDB</Title>
<PackageId>CSharpKDB</PackageId>
<Description>Provides functionality for .NET applications to interface with a KDB+ process.</Description>
Expand Down
19 changes: 0 additions & 19 deletions tools/travis-ci-build.sh

This file was deleted.

25 changes: 0 additions & 25 deletions tools/travis-ci-install-sonar.sh

This file was deleted.

Loading