From 1b60dc7e3d94e7071abb79450830216e3f757b4b Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 6 Oct 2023 00:17:29 +0700 Subject: [PATCH] Attempt to fix AzDo Pipelines CI/CD (#284) * Attempt to fix AzDo Pipelines CI/CD * Fix build script * Cleanup script * Fix project dependencies * Revert conditional framework in csproj --- Akka.Persistence.Redis.sln | 9 +++++ build-system/pr-validation.yaml | 2 +- build.fsx | 36 +++++++++++++++++-- build.sh | 2 +- ...kka.Persistence.Redis.Cluster.Tests.csproj | 3 -- .../Akka.Persistence.Redis.Tests.csproj | 3 -- src/Directory.Packages.props | 2 -- ...istence.Redis.Benchmark.DockerTests.csproj | 2 -- 8 files changed, 45 insertions(+), 14 deletions(-) diff --git a/Akka.Persistence.Redis.sln b/Akka.Persistence.Redis.sln index 401b5b8..c244b8b 100644 --- a/Akka.Persistence.Redis.sln +++ b/Akka.Persistence.Redis.sln @@ -32,6 +32,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.Persistence.Redis.Benchmark.DockerTests", "src\benchmarks\Akka.Persistence.Redis.Benchmark.DockerTests\Akka.Persistence.Redis.Benchmark.DockerTests.csproj", "{BFBB3933-E8FC-4574-8D60-E6FA6BEABAE9}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build-system", "build-system", "{D118A7A7-A89D-450D-8218-E2AE580DEF5D}" + ProjectSection(SolutionItems) = preProject + build-system\azure-pipeline.template.yaml = build-system\azure-pipeline.template.yaml + build-system\pr-validation.yaml = build-system\pr-validation.yaml + build-system\README.md = build-system\README.md + build-system\windows-release.yaml = build-system\windows-release.yaml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -70,6 +78,7 @@ Global {6EEB8234-FAB9-4645-86EF-297240B3798A} = {1F453772-CA5E-4F41-A50E-75F3F59F72D6} {90084FC1-C04B-46BF-AA37-2ACD71E1AD4F} = {1F453772-CA5E-4F41-A50E-75F3F59F72D6} {BFBB3933-E8FC-4574-8D60-E6FA6BEABAE9} = {DA31E2A8-AE1A-474D-843C-1B6848B921E2} + {D118A7A7-A89D-450D-8218-E2AE580DEF5D} = {EB67BFB9-7589-469F-B0E0-6DDFC0032E67} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6ADAF1F3-8019-4D3E-A8B0-2BF7CF7B439B} diff --git a/build-system/pr-validation.yaml b/build-system/pr-validation.yaml index f77ecc6..849b1f4 100644 --- a/build-system/pr-validation.yaml +++ b/build-system/pr-validation.yaml @@ -29,4 +29,4 @@ jobs: displayName: 'Linux PR Validation' vmImage: 'ubuntu-latest' scriptFileName: ./build.sh - scriptArgs: RunTests + scriptArgs: RunTestsNet diff --git a/build.fsx b/build.fsx index cb473cd..c33837e 100644 --- a/build.fsx +++ b/build.fsx @@ -45,6 +45,10 @@ let outputTests = __SOURCE_DIRECTORY__ @@ "TestResults" let outputPerfTests = __SOURCE_DIRECTORY__ @@ "PerfResults" let outputNuGet = output @@ "nuget" +// Configuration values for tests +let testNetFrameworkVersion = "net471" +let testNetVersion = "net7.0" + Target "Clean" (fun _ -> ActivateFinalTarget "KillCreatedProcesses" @@ -53,6 +57,9 @@ Target "Clean" (fun _ -> CleanDir outputPerfTests CleanDir outputNuGet CleanDir "docs/_site" + + CleanDirs !! "./**/bin" + CleanDirs !! "./**/obj" ) Target "AssemblyInfo" (fun _ -> @@ -99,8 +106,31 @@ Target "RunTests" (fun _ -> let runSingleProject project = let arguments = match (hasTeamCity) with - | true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none -teamcity" (outputTests)) - | false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none" (outputTests)) + | true -> (sprintf "test -c Release --blame-crash --blame-hang-timeout 2m --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none -teamcity" testNetFrameworkVersion outputTests) + | false -> (sprintf "test -c Release --blame-crash --blame-hang-timeout 2m --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none" testNetFrameworkVersion outputTests) + + let result = ExecProcess(fun info -> + info.FileName <- "dotnet" + info.WorkingDirectory <- (Directory.GetParent project).FullName + info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0) + + ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result + + projects |> Seq.iter (log) + projects |> Seq.iter (runSingleProject) +) + +Target "RunTestsNet" (fun _ -> + let projects = + match (isWindows) with + | true -> !! "./src/**/*.Tests.csproj" + | _ -> !! "./src/**/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here + + let runSingleProject project = + let arguments = + match (hasTeamCity) with + | true -> (sprintf "test -c Release --blame-crash --blame-hang-timeout 2m --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none -teamcity" testNetVersion outputTests) + | false -> (sprintf "test -c Release --blame-crash --blame-hang-timeout 2m --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none" testNetVersion outputTests) let result = ExecProcess(fun info -> info.FileName <- "dotnet" @@ -301,6 +331,7 @@ Target "Nuget" DoNothing // tests dependencies "Build" ==> "RunTests" +"Build" ==> "RunTestsNet" // nuget dependencies "Clean" ==> "Build" ==> "CreateNuget" @@ -312,6 +343,7 @@ Target "Nuget" DoNothing // all "BuildRelease" ==> "All" "RunTests" ==> "All" +"RunTestsNet" ==> "All" "NBench" ==> "All" "Nuget" ==> "All" diff --git a/build.sh b/build.sh index fb3b8d3..d66e4b5 100644 --- a/build.sh +++ b/build.sh @@ -8,7 +8,7 @@ SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) TOOLS_DIR=$SCRIPT_DIR/tools SIGNCLIENT_DIR=$TOOLS_DIR/signclient NUGET_EXE=$TOOLS_DIR/nuget.exe -NUGET_URL=https://dist.nuget.org/win-x86-commandline/v4.0.0/nuget.exe +NUGET_URL=https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe FAKE_VERSION=4.61.2 FAKE_EXE=$TOOLS_DIR/FAKE/tools/FAKE.exe DOCFX_VERSION=2.49.0 diff --git a/src/Akka.Persistence.Redis.Cluster.Tests/Akka.Persistence.Redis.Cluster.Tests.csproj b/src/Akka.Persistence.Redis.Cluster.Tests/Akka.Persistence.Redis.Cluster.Tests.csproj index 21c4b00..5daf494 100644 --- a/src/Akka.Persistence.Redis.Cluster.Tests/Akka.Persistence.Redis.Cluster.Tests.csproj +++ b/src/Akka.Persistence.Redis.Cluster.Tests/Akka.Persistence.Redis.Cluster.Tests.csproj @@ -1,7 +1,6 @@  Akka.Persistence.Redis.Cluster.Tests - $(NetFrameworkTestVersion);$(NetTestVersion) false @@ -21,8 +20,6 @@ - - diff --git a/src/Akka.Persistence.Redis.Tests/Akka.Persistence.Redis.Tests.csproj b/src/Akka.Persistence.Redis.Tests/Akka.Persistence.Redis.Tests.csproj index 42fac94..80fd921 100644 --- a/src/Akka.Persistence.Redis.Tests/Akka.Persistence.Redis.Tests.csproj +++ b/src/Akka.Persistence.Redis.Tests/Akka.Persistence.Redis.Tests.csproj @@ -1,7 +1,6 @@  Akka.Persistence.Redis.Tests - $(NetFrameworkTestVersion);$(NetTestVersion) false @@ -21,8 +20,6 @@ - - diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 8fdebf3..82e8334 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -20,8 +20,6 @@ - - diff --git a/src/benchmarks/Akka.Persistence.Redis.Benchmark.DockerTests/Akka.Persistence.Redis.Benchmark.DockerTests.csproj b/src/benchmarks/Akka.Persistence.Redis.Benchmark.DockerTests/Akka.Persistence.Redis.Benchmark.DockerTests.csproj index 83415c5..c09c06c 100644 --- a/src/benchmarks/Akka.Persistence.Redis.Benchmark.DockerTests/Akka.Persistence.Redis.Benchmark.DockerTests.csproj +++ b/src/benchmarks/Akka.Persistence.Redis.Benchmark.DockerTests/Akka.Persistence.Redis.Benchmark.DockerTests.csproj @@ -12,8 +12,6 @@ - -