Skip to content

Commit

Permalink
Updated build scripts to support .NET 8
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed May 3, 2024
1 parent f92a9b3 commit b0ba653
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 44 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build.dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ jobs:
uses: actions/checkout@v3

- name: Install .NET 6
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: "6.0.x"

- name: Install .NET 7
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: "7.0.x"

- name: Restore NuGet packages
- name: Install .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Build and Test
run: ./build.sh test
6 changes: 3 additions & 3 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ env:
config: Release
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
dotnet_core_version: 7.0.x
dotnet_core_version: 8.0.x

jobs:
publish_job:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.dotnet_core_version }}

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Github Actions](https://github.com/oskardudycz/Ogooreck/actions/workflows/build.dotnet.yml/badge.svg?branch=main) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_net) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_net)
[![Twitter Follow](https://img.shields.io/twitter/follow/oskar_at_net?style=social)](https://twitter.com/oskar_at_net) ![Github Actions](https://github.com/oskardudycz/Ogooreck/actions/workflows/build.dotnet.yml/badge.svg?branch=main) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_net) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_net)
[![Nuget Package](https://badgen.net/nuget/v/ogooreck)](https://www.nuget.org/packages/Ogooreck/)
[![Nuget](https://img.shields.io/nuget/dt/ogooreck)](https://www.nuget.org/packages/Ogooreck/) [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/oskardudycz/)
[![Nuget](https://img.shields.io/nuget/dt/ogooreck)](https://www.nuget.org/packages/Ogooreck/)

# 🥒 Ogooreck

Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
set -euo pipefail

version="$(dotnet --version)"
if [[ $version = 7.* ]]; then
target_framework="net7.0"
if [[ $version = 8.* ]]; then
target_framework="net8.0"
else
echo "BUILD FAILURE: .NET 7 SDK required to run build"
echo "BUILD FAILURE: .NET 8 SDK required to run build"
exit 1
fi

Expand Down
6 changes: 3 additions & 3 deletions src/Ogooreck.Build/Ogooreck.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bullseye" Version="4.2.0" />
<PackageReference Include="SimpleExec" Version="11.0.0" />
<PackageReference Include="Bullseye" Version="5.0.0" />
<PackageReference Include="SimpleExec" Version="12.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Ogooreck.Build/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using static Bullseye.Targets;
using static SimpleExec.Command;

const string framework = "net7.0";
const string framework = "net8.0";
const string configuration = "Release";

Target("default", DependsOn("compile"));
Expand Down
14 changes: 7 additions & 7 deletions src/Ogooreck.Sample.Api.Tests/Ogooreck.Sample.Api.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.9" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -22,7 +22,7 @@


<ItemGroup>
<PackageReference Include="MarkdownSnippets.MsBuild" Version="24.5.1">
<PackageReference Include="MarkdownSnippets.MsBuild" Version="27.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/Ogooreck.Sample.Api/Ogooreck.Sample.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type BankAccount =

let evolve bankAccount bankAccountEvent : BankAccount =
match bankAccount, bankAccountEvent with
| Initial _, BankAccountOpened event ->
| Initial, BankAccountOpened event ->
Open
{| Id = event.BankAccountId
Balance = 0M
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let openBankAccount (command: OpenBankAccount) bankAccount : Event =
match bankAccount with
| Open _ -> invalidOp "Account is already opened!"
| Closed _ -> invalidOp "Account is already closed!"
| Initial _ ->
| Initial ->
BankAccountOpened
{ BankAccountId = command.BankAccountId
AccountNumber = command.AccountNumber
Expand All @@ -44,7 +44,7 @@ let openBankAccount (command: OpenBankAccount) bankAccount : Event =

let recordDeposit (command: RecordDeposit) bankAccount : Event =
match bankAccount with
| Initial _ -> invalidOp "Account is not opened!"
| Initial -> invalidOp "Account is not opened!"
| Closed _ -> invalidOp "Account is closed!"
| Open state ->
DepositRecorded
Expand All @@ -56,7 +56,7 @@ let recordDeposit (command: RecordDeposit) bankAccount : Event =

let withdrawCashFromAtm (command: WithdrawCashFromAtm) bankAccount : Event =
match bankAccount with
| Initial _ -> invalidOp "Account is not opened!"
| Initial -> invalidOp "Account is not opened!"
| Closed _ -> invalidOp "Account is closed!"
| Open state ->
if (state.Balance < command.Amount) then
Expand All @@ -71,7 +71,7 @@ let withdrawCashFromAtm (command: WithdrawCashFromAtm) bankAccount : Event =

let closeBankAccount (command: CloseBankAccount) bankAccount : Event =
match bankAccount with
| Initial _ -> invalidOp "Account is not opened!"
| Initial -> invalidOp "Account is not opened!"
| Closed _ -> invalidOp "Account is already closed!"
| Open state ->
BankAccountClosed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
Expand All @@ -15,17 +15,17 @@
<PackageReference Include="FsCheck" Version="2.16.6" />
<PackageReference Include="FsCheck.Xunit" Version="2.16.6" />
<PackageReference Include="FSharp.UMX" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Update="FSharp.Core" Version="7.0.300" />
<PackageReference Update="FSharp.Core" Version="8.0.200" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 2 additions & 0 deletions src/Ogooreck/Factories/ObjectFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ private static Func<T> Creator()
if (t.HasDefaultConstructor())
return Expression.Lambda<Func<T>>(Expression.New(t)).Compile();

#pragma warning disable SYSLIB0050
return () => (T)FormatterServices.GetUninitializedObject(t);
#pragma warning restore SYSLIB0050
}
}

Expand Down
14 changes: 9 additions & 5 deletions src/Ogooreck/Ogooreck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>0.8.1</VersionPrefix>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<GenerateAssemblyTitleAttribute>true</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>true</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyProductAttribute>true</GenerateAssemblyProductAttribute>
Expand All @@ -11,7 +11,7 @@
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>true</GenerateAssemblyInformationalVersionAttribute>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>11.0</LangVersion>
<LangVersion>12.0</LangVersion>
<Authors>Oskar Dudycz</Authors>
<!-- <PackageIconUrl>https://github.com/oskardudycz/Ogooreck/content/images/emblem.png</PackageIconUrl>-->
<PackageProjectUrl>https://github.com/oskardudycz/Ogooreck</PackageProjectUrl>
Expand All @@ -26,16 +26,20 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.20" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.29" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.18" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.4"/>
</ItemGroup>

</Project>

0 comments on commit b0ba653

Please sign in to comment.