Skip to content

Commit

Permalink
Update to .net 8 (#574)
Browse files Browse the repository at this point in the history
* Updating for .net 8

* Adding 8.0 to gh actions build script

* Update dependencies

* Fix Microsoft.IO.RecyclableMemoryStream upgrade

* Fix test inference

* Fix tests

* Update release note

* Update RELEASE_NOTES.md

---------

Co-authored-by: Banashek <Banashek@users.noreply.github.com>
Co-authored-by: Vinícius Gajo <50725287+64J0@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 15, 2024
1 parent 0a16c3d commit 484c761
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
dotnet-version: |
6.x
7.x
8.x
- name: Restore
run: dotnet restore
- name: Build
Expand Down Expand Up @@ -80,6 +81,7 @@ jobs:
dotnet-version: |
6.x
7.x
8.x
- name: Create Release NuGet package
run: |
arrTag=(${GITHUB_REF//\// })
Expand Down
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release Notes
=============

## 6.4.0-alpha-1 - 2024-03-10

- [Upgrade to .NET 8](https://github.com/giraffe-fsharp/Giraffe/pull/527) - Credits @Banashek @fpellet

## 6.3.0 - 2024-03-01

- Same as 6.3.0
Expand Down
2 changes: 1 addition & 1 deletion samples/EndpointRoutingApp/EndpointRoutingApp.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/Giraffe/Giraffe.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<NeutralLanguage>en-GB</NeutralLanguage>

<!-- Build settings -->
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<DebugType>portable</DebugType>
<OutputType>Library</OutputType>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down Expand Up @@ -50,10 +50,10 @@

<ItemGroup>
<PackageReference Include="FSharp.Core" Version="6.0.0" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.*" />
<PackageReference Include="System.Text.Json" Version="7.0.*" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.*" />
<PackageReference Include="System.Text.Json" Version="8.0.*" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.*" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.*" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.*" PrivateAssets="All" />
<PackageReference Include="Giraffe.ViewEngine" Version="1.4.*" />
</ItemGroup>

Expand All @@ -80,4 +80,4 @@
<Compile Include="EndpointRouting.fs" />
</ItemGroup>

</Project>
</Project>
2 changes: 1 addition & 1 deletion src/Giraffe/Xml.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module SystemXml =

interface Xml.ISerializer with
member __.Serialize (o : obj) =
use stream = if rmsManager.ThrowExceptionOnToArray then new MemoryStream() else rmsManager.GetStream("giraffe-xml-serialize")
use stream = if rmsManager.Settings.ThrowExceptionOnToArray then new MemoryStream() else rmsManager.GetStream("giraffe-xml-serialize")
use writer = XmlWriter.Create(stream, settings)
let serializer = XmlSerializer(o.GetType())
serializer.Serialize(writer, o)
Expand Down
17 changes: 12 additions & 5 deletions tests/Giraffe.Tests/Giraffe.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<AssemblyName>Giraffe.Tests</AssemblyName>
</PropertyGroup>

Expand Down Expand Up @@ -41,13 +41,20 @@
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.*" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.*" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.*" />
<PackageReference Include="System.Net.Http" Version="4.3.*" />
<PackageReference Include="xunit" Version="2.4.*" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.*" />
<PackageReference Include="NSubstitute" Version="4.4.*" />
<PackageReference Include="xunit" Version="2.7.*" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NSubstitute" Version="5.1.*" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/Giraffe.Tests/Helpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,5 @@ let printBytes (bytes : byte[]) =
let shouldBeEmpty (bytes : byte[]) =
Assert.True(bytes.Length.Equals 0)

let shouldEqual expected actual =
let shouldEqual (expected: string) actual =
Assert.Equal(expected, actual)
6 changes: 3 additions & 3 deletions tests/Giraffe.Tests/HttpContextExtensionsTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ let ``WriteBytesAsync should not return Content-Length in header on 100`` () =
match result with
| None -> assertFail "Result was expected to be non-empty"
| Some ctx ->
Assert.Empty(ctx.Response.Headers["Content-Length"])
Assert.Null(ctx.Response.Headers.ContentLength)
}

[<Fact>]
Expand All @@ -221,7 +221,7 @@ let ``WriteBytesAsync should not return Content-Length in header on 204`` () =
match result with
| None -> assertFail "Result was expected to be non-empty"
| Some ctx ->
Assert.Empty(ctx.Response.Headers["Content-Length"])
Assert.Null(ctx.Response.Headers.ContentLength)
}

[<Fact>]
Expand All @@ -245,7 +245,7 @@ let ``WriteBytesAsync with HTTP CONNECT should not return Content-Length in head
match result with
| None -> assertFail "Result was expected to be non-empty"
| Some ctx ->
Assert.Empty(ctx.Response.Headers["Content-Length"])
Assert.Null(ctx.Response.Headers.ContentLength)
}

[<Fact>]
Expand Down

0 comments on commit 484c761

Please sign in to comment.