diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 111124c..4a0a0c8 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -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) @@ -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 diff --git a/.circleci/config.yml b/.circleci/config.yml index bea45df..1892af9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,7 +40,7 @@ orbs: description: The .NET Core SDK image tag to use. type: string docker: - - image: mcr.microsoft.com/dotnet/<> + - image: mcr.microsoft.com/dotnet/sdk:<> workflows: @@ -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 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2095905..4fa35d1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 }} @@ -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 diff --git a/Dockerfile b/Dockerfile index b66876b..3f6b28e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 diff --git a/castle.core.asyncinterceptor.sln b/castle.core.asyncinterceptor.sln index 68ba03b..58c7936 100644 --- a/castle.core.asyncinterceptor.sln +++ b/castle.core.asyncinterceptor.sln @@ -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 diff --git a/coverage.sh b/coverage.sh index e787750..aa8dd3b 100755 --- a/coverage.sh +++ b/coverage.sh @@ -4,7 +4,7 @@ exe() { echo; echo "\$ $*" ; "$@" ; } # Parameters -framework="${1-netcoreapp3.1}" +framework="${1-net6.0}" config="${2-Debug}" include="[Castle.Core.AsyncInterceptor]*" diff --git a/src/Castle.Core.AsyncInterceptor/AsyncInterceptorBase.cs b/src/Castle.Core.AsyncInterceptor/AsyncInterceptorBase.cs index 33c9735..03d6229 100644 --- a/src/Castle.Core.AsyncInterceptor/AsyncInterceptorBase.cs +++ b/src/Castle.Core.AsyncInterceptor/AsyncInterceptorBase.cs @@ -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 /// /// A completed . /// @@ -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(); tcs.SetException(e); return tcs.Task; +#else + return Task.FromException(e); #endif } } @@ -167,12 +167,12 @@ private static Task ProceedSynchronous( } catch (Exception e) { -#if NETSTANDARD2_0 || NET5_0 - return Task.FromException(e); -#else +#if NET45 var tcs = new TaskCompletionSource(); tcs.SetException(e); return tcs.Task; +#else + return Task.FromException(e); #endif } } diff --git a/src/Castle.Core.AsyncInterceptor/Castle.Core.AsyncInterceptor.csproj b/src/Castle.Core.AsyncInterceptor/Castle.Core.AsyncInterceptor.csproj index 170660b..b7d0645 100644 --- a/src/Castle.Core.AsyncInterceptor/Castle.Core.AsyncInterceptor.csproj +++ b/src/Castle.Core.AsyncInterceptor/Castle.Core.AsyncInterceptor.csproj @@ -1,7 +1,7 @@ - net45;netstandard2.0;net5.0 + net45;netstandard2.0;net5.0;net6.0 Castle.DynamicProxy latest true diff --git a/src/Castle.Core.AsyncInterceptor/Properties/AssemblyInfo.cs b/src/Castle.Core.AsyncInterceptor/Properties/AssemblyInfo.cs index b7b2e8b..a7dab9c 100644 --- a/src/Castle.Core.AsyncInterceptor/Properties/AssemblyInfo.cs +++ b/src/Castle.Core.AsyncInterceptor/Properties/AssemblyInfo.cs @@ -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 diff --git a/test/Castle.Core.AsyncInterceptor.Tests/Castle.Core.AsyncInterceptor.Tests.csproj b/test/Castle.Core.AsyncInterceptor.Tests/Castle.Core.AsyncInterceptor.Tests.csproj index 102c261..c6590b1 100644 --- a/test/Castle.Core.AsyncInterceptor.Tests/Castle.Core.AsyncInterceptor.Tests.csproj +++ b/test/Castle.Core.AsyncInterceptor.Tests/Castle.Core.AsyncInterceptor.Tests.csproj @@ -1,7 +1,7 @@ - net472;netcoreapp3.1;net5.0 + net472;netcoreapp3.1;net5.0;net6.0 latest Castle.DynamicProxy false @@ -53,4 +53,4 @@ - \ No newline at end of file +