diff --git a/appveyor.yml b/appveyor.yml index 5ed497a4..8f326ca5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,7 @@ version: '{build}' -image: ubuntu2004 +image: +- ubuntu2004 +- Visual Studio 2019 skip_branch_with_pr: true pull_requests: @@ -15,17 +17,6 @@ branches: - /release-.*/ - /^\d+\.\d+\.\d+(-\S*)?$/ -skip_commits: - files: - - '**/*.source.md' - -before_build: -- sh: sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose -- sh: sudo chmod +x /usr/local/bin/docker-compose - -build_script: -- sh: ./build.sh - artifacts: - path: ./**/*.nupkg type: NuGetPackage @@ -34,3 +25,27 @@ artifacts: test: off deploy: off + +for: +- + matrix: + only: + - image: ubuntu2004 + + before_build: + - sh: sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + - sh: sudo chmod +x /usr/local/bin/docker-compose + + build_script: + - sh: ./build.sh + +- + matrix: + only: + - image: Visual Studio 2019 + + before_build: + - cmd: docker-switch-linux + + build_script: + - cmd: .\build.cmd diff --git a/src/MyOtherService/MyOtherService.csproj b/src/MyOtherService/MyOtherService.csproj index c2bcbca0..4a37c509 100644 --- a/src/MyOtherService/MyOtherService.csproj +++ b/src/MyOtherService/MyOtherService.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + netcoreapp3.1;net48 latest diff --git a/src/MyService/MyService.csproj b/src/MyService/MyService.csproj index 135da28d..f331ac6f 100644 --- a/src/MyService/MyService.csproj +++ b/src/MyService/MyService.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + netcoreapp3.1;net48 latest diff --git a/src/MySystem.AcceptanceTests/DockerCompose.cs b/src/MySystem.AcceptanceTests/DockerCompose.cs index 6606c866..757cb70a 100644 --- a/src/MySystem.AcceptanceTests/DockerCompose.cs +++ b/src/MySystem.AcceptanceTests/DockerCompose.cs @@ -1,8 +1,15 @@ using System; -using System.Net.Http; using System.Threading.Tasks; using static SimpleExec.Command; +#if NETCOREAPP +using System.Net.Http; +#endif + +#if NET48 +using System.Net; +#endif + namespace MySystem.AcceptanceTests { public static class DockerCompose @@ -16,9 +23,18 @@ static async Task statusChecker() { try { + var managementUrl = "http://localhost:15672/"; +#if NETCOREAPP using var client = new HttpClient(); - var response = await client.GetAsync("http://localhost:15672/"); + var response = await client.GetAsync(managementUrl); return response.IsSuccessStatusCode; +#endif + +#if NET48 + var request = HttpWebRequest.Create(managementUrl); + var response = await request.GetResponseAsync(); + return ((HttpWebResponse)response).StatusCode == HttpStatusCode.OK; +#endif } catch { diff --git a/src/MySystem.AcceptanceTests/MySystem.AcceptanceTests.csproj b/src/MySystem.AcceptanceTests/MySystem.AcceptanceTests.csproj index be00b828..c523866c 100644 --- a/src/MySystem.AcceptanceTests/MySystem.AcceptanceTests.csproj +++ b/src/MySystem.AcceptanceTests/MySystem.AcceptanceTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + netcoreapp3.1;net48 false @@ -15,6 +15,10 @@ + + + + diff --git a/src/NServiceBus.AssemblyScanner.Extensions/NServiceBus.AssemblyScanner.Extensions.csproj b/src/NServiceBus.AssemblyScanner.Extensions/NServiceBus.AssemblyScanner.Extensions.csproj index e27502c5..b25ea46c 100644 --- a/src/NServiceBus.AssemblyScanner.Extensions/NServiceBus.AssemblyScanner.Extensions.csproj +++ b/src/NServiceBus.AssemblyScanner.Extensions/NServiceBus.AssemblyScanner.Extensions.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netcoreapp3.1;net48 diff --git a/src/NServiceBus.IntegrationTesting.Tests.TestEndpoint/NServiceBus.IntegrationTesting.Tests.TestEndpoint.csproj b/src/NServiceBus.IntegrationTesting.Tests.TestEndpoint/NServiceBus.IntegrationTesting.Tests.TestEndpoint.csproj index 2a9d94f6..fedc321a 100644 --- a/src/NServiceBus.IntegrationTesting.Tests.TestEndpoint/NServiceBus.IntegrationTesting.Tests.TestEndpoint.csproj +++ b/src/NServiceBus.IntegrationTesting.Tests.TestEndpoint/NServiceBus.IntegrationTesting.Tests.TestEndpoint.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + netcoreapp3.1;net48 latest diff --git a/src/NServiceBus.IntegrationTesting.Tests/API/ApiApprovals.cs b/src/NServiceBus.IntegrationTesting.Tests/API/ApiApprovals.cs index 31513c33..5595e891 100644 --- a/src/NServiceBus.IntegrationTesting.Tests/API/ApiApprovals.cs +++ b/src/NServiceBus.IntegrationTesting.Tests/API/ApiApprovals.cs @@ -1,5 +1,6 @@ using System.Runtime.CompilerServices; using ApprovalTests; +using ApprovalTests.Namers; using ApprovalTests.Reporters; using NUnit.Framework; using PublicApiGenerator; @@ -11,6 +12,12 @@ public class APIApprovals [Test] [UseReporter(typeof(DiffReporter))] [MethodImpl(MethodImplOptions.NoInlining)] +#if NETCOREAPP + [UseApprovalSubdirectory("NETCOREAPP")] +#endif +#if NET48 + [UseApprovalSubdirectory("NET48")] +#endif public void Approve_API() { var publicApi = typeof(IntegrationScenarioContext).Assembly.GeneratePublicApi(); diff --git a/src/NServiceBus.IntegrationTesting.Tests/API/NET48/APIApprovals.Approve_API.approved.txt b/src/NServiceBus.IntegrationTesting.Tests/API/NET48/APIApprovals.Approve_API.approved.txt new file mode 100644 index 00000000..18fe3bd8 --- /dev/null +++ b/src/NServiceBus.IntegrationTesting.Tests/API/NET48/APIApprovals.Approve_API.approved.txt @@ -0,0 +1,124 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/mauroservienti/NServiceBus.IntegrationTesting.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("NServiceBus.IntegrationTesting.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName=".NET Framework 4.8")] +namespace NServiceBus.IntegrationTesting +{ + public class EmptyTestCompletionHandler : NServiceBus.IntegrationTesting.IHandleTestCompletion + { + public EmptyTestCompletionHandler() { } + public System.Threading.Tasks.Task OnTestCompleted(NServiceBus.AcceptanceTesting.Support.RunSummary summary) { } + } + public static class EndpointConfigurationExtensions + { + public static void RegisterRequiredPipelineBehaviors(this NServiceBus.EndpointConfiguration builder, string endpointName, NServiceBus.IntegrationTesting.IntegrationScenarioContext integrationScenarioContext) { } + public static void RegisterScenarioContext(this NServiceBus.EndpointConfiguration builder, NServiceBus.AcceptanceTesting.ScenarioContext scenarioContext) { } + } + public abstract class EndpointTemplate : NServiceBus.AcceptanceTesting.Support.IEndpointSetupTemplate + { + protected EndpointTemplate() { } + public System.Threading.Tasks.Task GetConfiguration(NServiceBus.AcceptanceTesting.Support.RunDescriptor runDescriptor, NServiceBus.AcceptanceTesting.Support.EndpointCustomizationConfiguration endpointCustomizationConfiguration, System.Action configurationBuilderCustomization) { } + protected abstract System.Threading.Tasks.Task OnGetConfiguration(NServiceBus.AcceptanceTesting.Support.RunDescriptor runDescriptor, NServiceBus.AcceptanceTesting.Support.EndpointCustomizationConfiguration endpointCustomizationConfiguration, System.Action configurationBuilderCustomization); + } + public class EndpointTemplate : NServiceBus.IntegrationTesting.EndpointTemplate + where T : NServiceBus.EndpointConfiguration, new () + { + public EndpointTemplate() { } + protected override System.Threading.Tasks.Task OnGetConfiguration(NServiceBus.AcceptanceTesting.Support.RunDescriptor runDescriptor, NServiceBus.AcceptanceTesting.Support.EndpointCustomizationConfiguration endpointCustomizationConfiguration, System.Action configurationBuilderCustomization) { } + } + public class EndpointTemplate : NServiceBus.IntegrationTesting.EndpointTemplate + where T : NServiceBus.EndpointConfiguration, new () + where C : NServiceBus.IntegrationTesting.IHandleTestCompletion, new () + { + public EndpointTemplate() { } + protected override System.Threading.Tasks.Task OnGetConfiguration(NServiceBus.AcceptanceTesting.Support.RunDescriptor runDescriptor, NServiceBus.AcceptanceTesting.Support.EndpointCustomizationConfiguration endpointConfiguration, System.Action configurationBuilderCustomization) { } + } + public class GenericHostEndpointBehaviorBuilder + where TContext : NServiceBus.AcceptanceTesting.ScenarioContext + { + public GenericHostEndpointBehaviorBuilder() { } + public System.Collections.Generic.IList Whens { get; } + public NServiceBus.IntegrationTesting.GenericHostEndpointBehaviorBuilder When(System.Func action) { } + public NServiceBus.IntegrationTesting.GenericHostEndpointBehaviorBuilder When(System.Func action) { } + public NServiceBus.IntegrationTesting.GenericHostEndpointBehaviorBuilder When(System.Func> condition, System.Func action) { } + public NServiceBus.IntegrationTesting.GenericHostEndpointBehaviorBuilder When(System.Func> condition, System.Func action) { } + public NServiceBus.IntegrationTesting.GenericHostEndpointBehaviorBuilder When(System.Predicate condition, System.Func action) { } + public NServiceBus.IntegrationTesting.GenericHostEndpointBehaviorBuilder When(System.Predicate condition, System.Func action) { } + } + public class HandlerInvocation : NServiceBus.IntegrationTesting.Invocation + { + public HandlerInvocation() { } + public System.Type HandlerType { get; } + } + public interface IHandleTestCompletion + { + System.Threading.Tasks.Task OnTestCompleted(NServiceBus.AcceptanceTesting.Support.RunSummary summary); + } + public class IntegrationScenarioContext : NServiceBus.AcceptanceTesting.ScenarioContext + { + public IntegrationScenarioContext() { } + public System.Collections.Generic.IEnumerable InvokedHandlers { get; } + public System.Collections.Generic.IEnumerable InvokedSagas { get; } + public System.Collections.Generic.IEnumerable OutgoingMessageOperations { get; } + public bool HandlerWasInvoked() { } + public bool HasFailedMessages() { } + public bool HasHandlingErrors() { } + public bool MessageWasProcessed() { } + public bool MessageWasProcessedByHandler() { } + public bool MessageWasProcessedBySaga() { } + public void RegisterTimeoutRescheduleRule(System.Func rule) { } + public bool SagaWasCompleted() + where TSaga : NServiceBus.Saga { } + public bool SagaWasInvoked() + where TSaga : NServiceBus.Saga { } + } + public abstract class Invocation + { + protected Invocation() { } + public string EndpointName { get; } + public System.Exception HandlingError { get; } + public object Message { get; } + public System.Type MessageType { get; } + } + public abstract class OutgoingMessageOperation + { + protected OutgoingMessageOperation() { } + public System.Collections.Generic.Dictionary MessageHeaders { get; } + public string MessageId { get; } + public object MessageInstance { get; } + public System.Type MessageType { get; } + public System.Exception OperationError { get; } + public string SenderEndpoint { get; } + } + public class PublishOperation : NServiceBus.IntegrationTesting.OutgoingMessageOperation + { + public PublishOperation() { } + } + public class ReplyOperation : NServiceBus.IntegrationTesting.OutgoingMessageOperation + { + public ReplyOperation() { } + } + public class RequestTimeoutOperation : NServiceBus.IntegrationTesting.SendOperation + { + public RequestTimeoutOperation() { } + public string SagaId { get; } + public string SagaTypeAssemblyQualifiedName { get; } + } + public class SagaInvocation : NServiceBus.IntegrationTesting.Invocation + { + public SagaInvocation() { } + public bool IsCompleted { get; } + public bool IsNew { get; } + public bool NotFound { get; } + public NServiceBus.IContainSagaData SagaData { get; } + public System.Type SagaType { get; } + } + public static class ScenarioWithEndpointBehaviorExtensions + { + public static NServiceBus.AcceptanceTesting.Support.IScenarioWithEndpointBehavior WithGenericHostEndpoint(this NServiceBus.AcceptanceTesting.Support.IScenarioWithEndpointBehavior scenarioWithEndpoint, string endpointName, System.Func, Microsoft.Extensions.Hosting.IHost> hostBuilder, System.Action> behavior = null) + where TContext : NServiceBus.AcceptanceTesting.ScenarioContext { } + } + public class SendOperation : NServiceBus.IntegrationTesting.OutgoingMessageOperation + { + public SendOperation() { } + } +} \ No newline at end of file diff --git a/src/NServiceBus.IntegrationTesting.Tests/API/APIApprovals.Approve_API.approved.txt b/src/NServiceBus.IntegrationTesting.Tests/API/NETCOREAPP/APIApprovals.Approve_API.approved.txt similarity index 98% rename from src/NServiceBus.IntegrationTesting.Tests/API/APIApprovals.Approve_API.approved.txt rename to src/NServiceBus.IntegrationTesting.Tests/API/NETCOREAPP/APIApprovals.Approve_API.approved.txt index 3a742822..0315a51b 100644 --- a/src/NServiceBus.IntegrationTesting.Tests/API/APIApprovals.Approve_API.approved.txt +++ b/src/NServiceBus.IntegrationTesting.Tests/API/NETCOREAPP/APIApprovals.Approve_API.approved.txt @@ -1,6 +1,6 @@ [assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/mauroservienti/NServiceBus.IntegrationTesting.git")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("NServiceBus.IntegrationTesting.Tests")] -[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName="")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v3.1", FrameworkDisplayName="")] namespace NServiceBus.IntegrationTesting { public class EmptyTestCompletionHandler : NServiceBus.IntegrationTesting.IHandleTestCompletion diff --git a/src/NServiceBus.IntegrationTesting.Tests/NServiceBus.IntegrationTesting.Tests.csproj b/src/NServiceBus.IntegrationTesting.Tests/NServiceBus.IntegrationTesting.Tests.csproj index 3fa6491d..ac4abb7f 100644 --- a/src/NServiceBus.IntegrationTesting.Tests/NServiceBus.IntegrationTesting.Tests.csproj +++ b/src/NServiceBus.IntegrationTesting.Tests/NServiceBus.IntegrationTesting.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + netcoreapp3.1;net48 @@ -13,7 +13,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/NServiceBus.IntegrationTesting/NServiceBus.IntegrationTesting.csproj b/src/NServiceBus.IntegrationTesting/NServiceBus.IntegrationTesting.csproj index 0dfe3004..93b75bc2 100644 --- a/src/NServiceBus.IntegrationTesting/NServiceBus.IntegrationTesting.csproj +++ b/src/NServiceBus.IntegrationTesting/NServiceBus.IntegrationTesting.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netcoreapp3.1;net48 @@ -24,13 +24,13 @@ - - - + + + - + all runtime; build; native; contentfiles; analyzers diff --git a/targets/Program.cs b/targets/Program.cs index 6423ed70..082f71fe 100644 --- a/targets/Program.cs +++ b/targets/Program.cs @@ -12,6 +12,8 @@ public static void Main(string[] args) var sourceDir = "src"; var sdk = new DotnetSdkManager(); + var isUnix = Environment.OSVersion.Platform == PlatformID.Unix; + var unixFx = "netcoreapp3.1"; Target("default", DependsOn("test")); @@ -21,7 +23,7 @@ public static void Main(string[] args) Target("test", DependsOn("build"), Directory.EnumerateFiles(sourceDir, "*Tests.csproj", SearchOption.AllDirectories), - proj => Run(sdk.GetDotnetCliPath(), $"test \"{proj}\" --configuration Release --no-build")); + proj => Run(sdk.GetDotnetCliPath(), $"test \"{proj}\" {(isUnix ? "--framework " + unixFx : "")} --configuration Release --no-build")); RunTargetsAndExit(args); }