Skip to content

Commit

Permalink
Dotnet 9 (#8)
Browse files Browse the repository at this point in the history
* Dotnet 9

* Fix ci
  • Loading branch information
Martin-Molinero authored Dec 23, 2024
1 parent b0aa492 commit f3b2717
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 22 deletions.
33 changes: 22 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,28 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
container:
image: quantconnect/lean:foundation
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2

- name: BuildDataSource
run: dotnet build ./QuantConnect.DataSource.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1
- name: Liberate disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
large-packages: false
docker-images: false
swap-storage: false

- name: BuildTests
run: dotnet build ./tests/Tests.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1

- name: Run Tests
run: dotnet test ./tests/bin/Release/net6.0/Tests.dll
- uses: addnab/docker-run-action@v3
with:
image: quantconnect/lean:foundation
options: --workdir /__w/Lean.DataSource.BenzingaNews/Lean.DataSource.BenzingaNews -v /home/runner/work:/__w
shell: bash
run: |
# BuildDataSource
dotnet build ./QuantConnect.DataSource.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1 && \
# BuildTests
dotnet build ./tests/Tests.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1 && \
# Run Tests
dotnet test ./tests/bin/Release/net9.0/Tests.dll
4 changes: 1 addition & 3 deletions DataProcessing/DataProcessing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyName>process</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="QuantConnect.Common" Version="2.5.*" />
<PackageReference Include="QuantConnect.Compression" Version="2.5.*" />
<PackageReference Include="QuantConnect.Lean.Engine" Version="2.5.*" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion DataQueueHandlers/DataQueueHandlers.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>QuantConnect.DataSource.DataQueueHandlers</RootNamespace>
<AssemblyName>QuantConnect.DataSource.DataQueueHandlers.BenzingaNews</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down
3 changes: 1 addition & 2 deletions QuantConnect.DataSource.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>QuantConnect.DataSource</RootNamespace>
<AssemblyName>QuantConnect.DataSource.BenzingaNews</AssemblyName>
<OutputPath>bin\$(Configuration)</OutputPath>
Expand All @@ -12,7 +12,6 @@

<ItemGroup>
<PackageReference Include="QuantConnect.Common" Version="2.5.*" />
<PackageReference Include="protobuf-net" Version="3.1.33" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>

Expand Down
11 changes: 10 additions & 1 deletion tests/BenzingaNewsJsonConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,22 @@
using NUnit.Framework;
using QuantConnect.Configuration;
using QuantConnect.Data;
using QuantConnect.Data.Auxiliary;
using QuantConnect.DataSource;
using QuantConnect.Interfaces;
using QuantConnect.Util;

namespace QuantConnect.DataLibrary.Tests
{
[TestFixture]
public class BenzingaNewsJsonConverterTests
{
[OneTimeSetUp]
public void Setup()
{
Composer.Instance.GetExportedValueByTypeName<IMapFileProvider>(Configuration.Config.Get("map-file-provider", typeof(LocalDiskMapFileProvider).Name));
}

[Test]
public void DeserializesCorrectly()
{
Expand Down Expand Up @@ -60,7 +69,7 @@ public void DeserializesCorrectly()
}";

// Put in a single line to avoid potential failure due to platform-specific behavior (\r\n vs. \n)
var expectedSerialized = @"{""id"":1,""author"":""Gerardo"",""created"":""2018-01-25T12:00:00Z"",""updated"":""2018-01-26T12:00:00Z"",""title"":""Unit Test Beats Expectations"",""teaser"":""The unit test beat reviewer's expectations, reporters say"",""body"":"" The unit test beat reviewer's expectations, reporters say - 'This is the best test I've ever seen' says Martin "",""channels"":[{""name"":""earnings""}],""stocks"":[{""name"":""AAPL""}],""tags"":[{""name"":""unit test""},{""name"":""testing""}],""EndTime"":""2018-01-26T12:00:00Z"",""DataType"":0,""IsFillForward"":false,""Time"":""2018-01-26T12:00:00Z"",""Symbol"":{""Value"":""AAPL"",""ID"":""AAPL.BenzingaNews 2S"",""Permtick"":""AAPL""},""Value"":0.0,""Price"":0.0}";
var expectedSerialized = @"{""id"":1,""author"":""Gerardo"",""created"":""2018-01-25T12:00:00Z"",""updated"":""2018-01-26T12:00:00Z"",""title"":""Unit Test Beats Expectations"",""teaser"":""The unit test beat reviewer's expectations, reporters say"",""body"":"" The unit test beat reviewer's expectations, reporters say - 'This is the best test I've ever seen' says Martin "",""channels"":[{""name"":""earnings""}],""stocks"":[{""name"":""AAPL""}],""tags"":[{""name"":""unit test""},{""name"":""testing""}],""EndTime"":""2018-01-26T12:00:00Z"",""DataType"":0,""IsFillForward"":false,""Time"":""2018-01-26T12:00:00Z"",""Symbol"":{""value"":""AAPL"",""id"":""AAPL.BenzingaNews 2S"",""permtick"":""AAPL""},""Value"":0.0,""Price"":0.0}";
var expectedSymbol = new Symbol(
SecurityIdentifier.GenerateEquity(
"AAPL",
Expand Down
9 changes: 9 additions & 0 deletions tests/BenzingaNewsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,21 @@
using System.Collections.Generic;
using QuantConnect.Data;
using QuantConnect.DataSource;
using QuantConnect.Data.Auxiliary;
using QuantConnect.Interfaces;
using QuantConnect.Util;

namespace QuantConnect.DataLibrary.Tests
{
[TestFixture]
public class BenzingaNewsTests
{
[OneTimeSetUp]
public void Setup()
{
Composer.Instance.GetExportedValueByTypeName<IMapFileProvider>(Configuration.Config.Get("map-file-provider", typeof(LocalDiskMapFileProvider).Name));
}

[Test]
public void JsonRoundTrip()
{
Expand Down
10 changes: 6 additions & 4 deletions tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>QuantConnect.DataLibrary.Tests</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
Expand All @@ -9,15 +9,17 @@
<Compile Include="..\BenzingaNewsAlgorithm.cs" Link="BenzingaNewsAlgorithm.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="protobuf-net" Version="3.1.33" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1">
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="16.9.4" />
<PackageReference Include="QuantConnect.Algorithm" Version="2.5.*" />
</ItemGroup>
<ItemGroup>
<Using Include="NUnit.Framework.Legacy.ClassicAssert" Alias="Assert" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\QuantConnect.DataSource.csproj" />
<ProjectReference Include="..\DataQueueHandlers\DataQueueHandlers.csproj" />
Expand Down

0 comments on commit f3b2717

Please sign in to comment.