Skip to content

Commit

Permalink
Merge pull request #140 from JSkimming/dotnet6-target
Browse files Browse the repository at this point in the history
Added the .NET 6 build targets
  • Loading branch information
JSkimming authored Jan 31, 2022
2 parents 6751968 + 9b64297 commit 7f038b4
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 79 deletions.
28 changes: 14 additions & 14 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,36 @@ jobs:
continueOnError: "true"
timeoutInMinutes: 5
variables:
buildFramework: net5.0
buildFramework: net6.0
strategy:
matrix:
"Linux 5.0 Debug":
sdkVersion: 5.0.x
"Linux 6.0 Debug":
sdkVersion: 6.0.x
config: Debug
imageName: ubuntu-latest
framework: $(buildFramework)
"Linux 5.0 Release":
sdkVersion: 5.0.x
"Linux 6.0 Release":
sdkVersion: 6.0.x
config: Release
imageName: ubuntu-latest
framework: $(buildFramework)
"MacOS 5.0 Debug":
sdkVersion: 5.0.x
"MacOS 6.0 Debug":
sdkVersion: 6.0.x
config: Debug
imageName: macOS-latest
framework: $(buildFramework)
"MacOS 5.0 Release":
sdkVersion: 5.0.x
"MacOS 6.0 Release":
sdkVersion: 6.0.x
config: Release
imageName: macOS-latest
framework: $(buildFramework)
"Windows 5.0 Debug":
sdkVersion: 5.0.x
"Windows 6.0 Debug":
sdkVersion: 6.0.x
config: Debug
imageName: windows-latest
framework: $(buildFramework)
"Windows 5.0 Release":
sdkVersion: 5.0.x
"Windows 6.0 Release":
sdkVersion: 6.0.x
config: Release
imageName: windows-latest
framework: $(buildFramework)
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
codeCoverageTool: Cobertura
summaryFileLocation: ./test/TestResults/output/coverage.$(framework).cobertura.xml

- task: BuildQualityChecks@7
- task: BuildQualityChecks@8
displayName: Check code coverage levels
inputs:
showStatistics: true
Expand Down
46 changes: 13 additions & 33 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ orbs:
description: The .NET Core SDK image tag to use.
type: string
docker:
- image: mcr.microsoft.com/dotnet/<<parameters.tag>>
- image: mcr.microsoft.com/dotnet/sdk:<<parameters.tag>>

workflows:

Expand All @@ -49,42 +49,22 @@ workflows:
- shellcheck/check:
name: shellcheck
- build/run-build:
name: 3.1 Debug Build
image-tag: "core/sdk:3.1"
name: .NET 6.0 Debug
image-tag: "6.0"
build-config: Debug
framework: netcoreapp3.1
framework: net6.0
- build/run-build:
name: 3.1 Alpine Debug Build
image-tag: "core/sdk:3.1-alpine"
name: Alpine .NET 6.0 Debug
image-tag: "6.0-alpine"
build-config: Debug
framework: netcoreapp3.1
framework: net6.0
- build/run-build:
name: 3.1 Release Build
image-tag: "core/sdk:3.1"
name: .NET 6.0 Release
image-tag: "6.0"
build-config: Release
framework: netcoreapp3.1
framework: net6.0
- build/run-build:
name: 3.1 Alpine Release Build
image-tag: "core/sdk:3.1-alpine"
name: Alpine .NET 6.0 Release
image-tag: "6.0-alpine"
build-config: Release
framework: netcoreapp3.1
- build/run-build:
name: 5.0 Debug Build
image-tag: "sdk:5.0"
build-config: Debug
framework: net5.0
- build/run-build:
name: 5.0 Alpine Debug Build
image-tag: "sdk:5.0-alpine"
build-config: Debug
framework: net5.0
- build/run-build:
name: 5.0 Release Build
image-tag: "sdk:5.0"
build-config: Release
framework: net5.0
- build/run-build:
name: 5.0 Alpine Release Build
image-tag: "sdk:5.0-alpine"
build-config: Release
framework: net5.0
framework: net6.0
21 changes: 7 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,18 @@ jobs:
- Debug
- Release
framework:
- netcoreapp3.1
- net5.0
- net6.0
name: Test ${{ matrix.os }} ${{ matrix.framework }} ${{ matrix.config }}

steps:

- uses: actions/checkout@v2

- name: Setup .NET Core 3.1
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
if: matrix.framework == 'netcoreapp3.1'
if: matrix.framework == 'net6.0'
with:
dotnet-version: 3.1.x

- name: Setup .NET 5.0
uses: actions/setup-dotnet@v1
if: matrix.framework == 'net5.0'
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x

- name: Test Coverage
run: ./coverage.sh ${{ matrix.framework }} ${{ matrix.config }}
Expand All @@ -52,16 +45,16 @@ jobs:
strategy:
matrix:
framework:
- net5.0
- net6.0

steps:

- uses: actions/checkout@v2

- name: Setup .NET 5.0
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x

- name: Test Coverage
run: ./coverage.sh ${{ matrix.framework }} Release
Expand Down
22 changes: 20 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# shellcheck - lining for bash scrips
FROM koalaman/shellcheck-alpine:stable

COPY ./ ./
COPY . .

# Run shell check on all the shell files.
RUN find . -type f -name '*.sh' | wc -l && find . -type f -name '*.sh' | xargs shellcheck --external-sources
RUN find . -type f -name '*.sh' | wc -l find . -type f -name '*.sh' | xargs shellcheck --external-sources --color=always

########################################################################################################################
# .NET Core 3.1
Expand Down Expand Up @@ -42,3 +42,21 @@ RUN dotnet restore
COPY . .

RUN ./coverage.sh net5.0 Debug

########################################################################################################################
# .NET 6
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine

WORKDIR /work

# Copy just the solution and proj files to make best use of docker image caching.
COPY ./castle.core.asyncinterceptor.sln .
COPY ./src/Castle.Core.AsyncInterceptor/Castle.Core.AsyncInterceptor.csproj ./src/Castle.Core.AsyncInterceptor/Castle.Core.AsyncInterceptor.csproj
COPY ./test/Castle.Core.AsyncInterceptor.Tests/Castle.Core.AsyncInterceptor.Tests.csproj ./test/Castle.Core.AsyncInterceptor.Tests/Castle.Core.AsyncInterceptor.Tests.csproj

# Run restore on just the project files, this should cache the image after restore.
RUN dotnet restore

COPY . .

RUN ./coverage.sh net6.0 Debug
4 changes: 2 additions & 2 deletions castle.core.asyncinterceptor.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.3
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F820D2E2-6C9C-4165-9C13-C77B2737A5AC}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
exe() { echo; echo "\$ $*" ; "$@" ; }

# Parameters
framework="${1-netcoreapp3.1}"
framework="${1-net6.0}"
config="${2-Debug}"

include="[Castle.Core.AsyncInterceptor]*"
Expand Down
20 changes: 10 additions & 10 deletions src/Castle.Core.AsyncInterceptor/AsyncInterceptorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Castle.DynamicProxy
Justification = "Must propagate the same exceptions.")]
public abstract class AsyncInterceptorBase : IAsyncInterceptor
{
#if !NETSTANDARD2_0 && !NET5_0
#if NET45
/// <summary>
/// A completed <see cref="Task"/>.
/// </summary>
Expand Down Expand Up @@ -138,20 +138,20 @@ private static Task ProceedSynchronous(IInvocation invocation, IInvocationProcee
try
{
proceedInfo.Invoke();
#if NETSTANDARD2_0 || NET5_0
return Task.CompletedTask;
#else
#if NET45
return CompletedTask;
#else
return Task.CompletedTask;
#endif
}
catch (Exception e)
{
#if NETSTANDARD2_0 || NET5_0
return Task.FromException(e);
#else
#if NET45
var tcs = new TaskCompletionSource<int>();
tcs.SetException(e);
return tcs.Task;
#else
return Task.FromException(e);
#endif
}
}
Expand All @@ -167,12 +167,12 @@ private static Task<TResult> ProceedSynchronous<TResult>(
}
catch (Exception e)
{
#if NETSTANDARD2_0 || NET5_0
return Task.FromException<TResult>(e);
#else
#if NET45
var tcs = new TaskCompletionSource<TResult>();
tcs.SetException(e);
return tcs.Task;
#else
return Task.FromException<TResult>(e);
#endif
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0;net5.0</TargetFrameworks>
<TargetFrameworks>net45;netstandard2.0;net5.0;net6.0</TargetFrameworks>
<RootNamespace>Castle.DynamicProxy</RootNamespace>
<LangVersion>latest</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
2 changes: 2 additions & 0 deletions src/Castle.Core.AsyncInterceptor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
[assembly: AssemblyTitle("Castle.Core.AsyncInterceptor .NET Framework")]
#elif NET5_0
[assembly: AssemblyTitle("Castle.Core.AsyncInterceptor .NET 5.0")]
#elif NET6_0
[assembly: AssemblyTitle("Castle.Core.AsyncInterceptor .NET 6.0")]
#else
[assembly: AssemblyTitle("Castle.Core.AsyncInterceptor .NET Standard")]
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>net472;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<RootNamespace>Castle.DynamicProxy</RootNamespace>
<IsPackable>false</IsPackable>
Expand Down Expand Up @@ -53,4 +53,4 @@
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>
</Project>

0 comments on commit 7f038b4

Please sign in to comment.