From b0416e89a46ce7a86bbef3d3335a3362d35f3ca4 Mon Sep 17 00:00:00 2001 From: Martin Cramp <60093543+MJCramp@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:10:11 +0100 Subject: [PATCH 01/80] Set up CI with Azure Pipelines [skip ci] --- impact-testing.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 impact-testing.yml diff --git a/impact-testing.yml b/impact-testing.yml new file mode 100644 index 000000000..f53e97b6b --- /dev/null +++ b/impact-testing.yml @@ -0,0 +1,19 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- main + +pool: + vmImage: ubuntu-latest + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + displayName: 'Run a multi-line script' From 97e0f4da5c8c9c61795687a69cdc2db05fc771b3 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 16:07:24 +0100 Subject: [PATCH 02/80] ci: disable main pipelines for this commit --- build-test-deploy.yml | 6 +++++- build-test-nightly.yml | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build-test-deploy.yml b/build-test-deploy.yml index b6a306639..6e1e17ca5 100644 --- a/build-test-deploy.yml +++ b/build-test-deploy.yml @@ -1,7 +1,11 @@ # https://aka.ms/yaml trigger: -- main + branches: + include: + - main + exclude: + - 'task/GSAGH-555-new-pipeline' variables: - group: s3PushInstallers diff --git a/build-test-nightly.yml b/build-test-nightly.yml index bb7758867..d5686daeb 100644 --- a/build-test-nightly.yml +++ b/build-test-nightly.yml @@ -4,6 +4,8 @@ trigger: branches: include: - release/* + exclude: + - 'task/GSAGH-555-new-pipeline' variables: - group: s3PushInstallers From 3217ba488b7b8a398774ee85e26731974186c2e0 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 16:45:10 +0100 Subject: [PATCH 03/80] ci: disabled deploy and nightly? --- build-test-deploy.yml | 2 - build-test-nightly.yml | 2 - impact-testing.yml | 241 ++++++++++++++++++++++++++++++++++++++--- 3 files changed, 228 insertions(+), 17 deletions(-) diff --git a/build-test-deploy.yml b/build-test-deploy.yml index 6e1e17ca5..1f591fde3 100644 --- a/build-test-deploy.yml +++ b/build-test-deploy.yml @@ -2,8 +2,6 @@ trigger: branches: - include: - - main exclude: - 'task/GSAGH-555-new-pipeline' diff --git a/build-test-nightly.yml b/build-test-nightly.yml index d5686daeb..51ba4d626 100644 --- a/build-test-nightly.yml +++ b/build-test-nightly.yml @@ -2,8 +2,6 @@ trigger: branches: - include: - - release/* exclude: - 'task/GSAGH-555-new-pipeline' diff --git a/impact-testing.yml b/impact-testing.yml index f53e97b6b..2e282ae9a 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -1,19 +1,234 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml trigger: -- main + branches: + include: + - release/* + paths: + include: + - GsaGH/** + - GsaGHTests/** -pool: - vmImage: ubuntu-latest +variables: + - group: s3PushInstallers + - group: pipeline-tokens + - name: configuration + value: Release -steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' +jobs: + - job: SetupMachine + displayName: Setup Machine with GSA Version + pool: 'rhino-compute' + condition: always() + workspace: + clean: all + + steps: + - powershell: | + Get-ChildItem *.msi -Recurse | Remove-Item + aws s3 cp s3://oasys-installer-store/GSA/nightly . --exclude "*" --include *Arup*.msi --recursive + # Move-Item -Path $(Pipeline.Workspace)\*Arup*.msi -Destination $(Pipeline.Workspace)\gsa.msi + displayName: 'Download GSA nightly' + failOnStderr: true + + - powershell: | + $msiFile = Get-ChildItem -Filter *.msi -Recurse | Select-Object -First 1 + if ($msiFile) { + Move-Item -Path $msiFile.FullName -Destination "$(Pipeline.Workspace)\gsa.msi" + Write-Output "MSI file moved and renamed to: $(Pipeline.Workspace)\gsa.msi" + } else { + Write-Output "No .msi file found." + } + failOnStderr: true + displayName: 'rename file' + + - publish: $(Pipeline.Workspace)/gsa.msi + displayName: 'Publish MSI Installer as an Artifact' + artifact: GSAInstaller + + - powershell: | + $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) + Write-output "Installer Path: ${installerPath}" + Write-output "GSA Version:" + if (!(Test-Path $installerPath.FullName)) { + Write-output "File '{0}' does not exist" -f $installerPath.FullName + } + try { + $WindowsInstaller = New-Object -com WindowsInstaller.Installer + $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) + $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" + $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) + $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null + $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) + $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) + Write-output $Version + } catch { + Write-output "Failed to get MSI file version: {0}." -f $_ + } + $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait + $app.WaitForExit() + Write-Output "Exit code: $($app.ExitCode)" + Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" + if ($app.ExitCode -ne 0) { + Write-Error "Application could not be installed. Error code $($app.ExitCode)" + exit(1) + } + displayName: 'Install GSA' + failOnStderr: true + + - powershell: | + & 'C:\Program Files\Oasys\*\GSA.exe' /Register + displayName: 'Register GSA COM' + failOnStderr: false + + - task: NuGetToolInstaller@1 + + - task: NuGetCommand@2 + displayName: 'Restoring NuGet packages' + inputs: + command: 'restore' + restoreSolution: 'GsaGH.sln' + + - task: VSBuild@1 + displayName: 'Building project in $(configuration)' + inputs: + solution: 'GsaGH.sln' + msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' + platform: 'x64' + configuration: '$(configuration)' + clean: true + env: + MSBUILDDISABLENODEREUSE: 1 + + - task: VisualStudioTestPlatformInstaller@1 + displayName: 'Install Test Platform' + + - task: VSTest@3 + inputs: + testSelector: 'testAssemblies' # Enables Test Impact Analysis + testAssemblyVer2: | + GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll + searchFolder: '$(System.DefaultWorkingDirectory)' + runOnlyImpactedTests: true + runInParallel: true + failOnStderr: true + + # **\bin\**\GsaReTests.dll # Modify this pattern based on where your test assemblies are + # - powershell: | + # dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll + # displayName: Unit Tests + # failOnStderr: true + + - powershell: | + if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { + Write-Output "codecov.yml is invalid" + Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post + exit(1) + } else { + Write-Output "codecov.yml is valid" + } + displayName: Validate codecov.yml + failOnStderr: true + + - powershell: | + $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path + echo $coverage_file_gsagh + Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml + $ProgressPreference = 'SilentlyContinue' + Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe + ls $(System.DefaultWorkingDirectory)\ + cd $(System.DefaultWorkingDirectory)\ + .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh + env: + CODECOV_TOKEN: $(CODECOV_TOKEN) + displayName: Upload Code Coverage to codecovio + failOnStderr: true + + - publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml + displayName: Publish GsaGHTest xml to Azure + artifact: GsaGHTestsCoverage + continueOnError: true +# - powershell: | +# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll +# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll +# displayName: dotnet tests +# failOnStderr: true +# +# - powershell: | +# if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { +# Write-Output "codecov.yml is invalid" +# Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post +# exit(1) +# } else { +# Write-Output "codecov.yml is valid" +# } +# displayName: Validate codecov.yml +# failOnStderr: true +# +# - powershell: | +# $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path +# echo $coverage_file_gsagh +# $coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path +# echo $coverage_file_integration +# Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml +# Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml +# $ProgressPreference = 'SilentlyContinue' +# Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe +# ls $(System.DefaultWorkingDirectory)\ +# cd $(System.DefaultWorkingDirectory)\ +# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh +# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration +# env: +# CODECOV_TOKEN: $(CODECOV_TOKEN) +# displayName: Upload Code Coverage to codecovio +# failOnStderr: true +# +# - publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml +# displayName: Publish GsaGHTest xml to Azure +# artifact: GsaGHTestsCoverage +# continueOnError: true +# +# - publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml +# displayName: Publish IntegrationTest xml to Azure +# artifact: IntegrationTestsCoverage +# continueOnError: true +# + + # - job: UninstallAndClean + # displayName: Uninstall And Clean + # dependsOn: [SetupMachine, RunUnitTests] + # condition: always() + # pool: 'rhino-compute' + # workspace: + # clean: none + # steps: + # - task: DownloadPipelineArtifact@2 + # inputs: + # artifact: GSAInstaller + # path: $(Pipeline.Workspace) # Download it to the same workspace path + # displayName: 'Download MSI Installer Artifact' + + - powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink + displayName: 'Delete orphan .ghlink files' + condition: always() + + - powershell: | + $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) + Write-output "Installer Path: ${installerPath}" + $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait + $app.WaitForExit() + Write-Output "Exit code: $($app.ExitCode)" + Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" + ### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED + ### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes + if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { + Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" + rm $installerPath + exit(0) + } else { + Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" + exit(1) + } + condition: always() + displayName: 'Uninstall Application' -- script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' From 68acb2118172c1785962698f4ac0a2de53c0dae9 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 16:52:34 +0100 Subject: [PATCH 04/80] ci: commented out runs --- build-test-deploy.yml | 526 ++++++++++++++++++++--------------------- build-test-nightly.yml | 358 ++++++++++++++-------------- 2 files changed, 442 insertions(+), 442 deletions(-) diff --git a/build-test-deploy.yml b/build-test-deploy.yml index 1f591fde3..da3cf06a4 100644 --- a/build-test-deploy.yml +++ b/build-test-deploy.yml @@ -1,263 +1,263 @@ -# https://aka.ms/yaml - -trigger: - branches: - exclude: - - 'task/GSAGH-555-new-pipeline' - -variables: - - group: s3PushInstallers - - group: pipeline-tokens - - name: configuration - value: Release - -pool: 'rhino-compute' - -steps: -- powershell: | - Get-ChildItem *.msi -Recurse | Remove-Item - aws s3 cp s3://oasys-installer-store/GSA/latest . --exclude "*" --include *Arup*.msi --recursive - Get-ChildItem *.msi | Rename-Item -NewName gsa.msi - displayName: 'Download GSA latest' - failOnStderr: true - -- powershell: | - $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) - Write-output "Installer Path: ${installerPath}" - Write-output "GSA Version:" - if (!(Test-Path $installerPath.FullName)) { - Write-output "File '{0}' does not exist" -f $installerPath.FullName - } - try { - $WindowsInstaller = New-Object -com WindowsInstaller.Installer - $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) - $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" - $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) - $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null - $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) - $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) - Write-output $Version - } catch { - Write-output "Failed to get MSI file version: {0}." -f $_ - } - $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait - $app.WaitForExit() - Write-Output "Exit code: $($app.ExitCode)" - Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" - if ($app.ExitCode -ne 0) { - Write-Error "Application could not be installed. Error code $($app.ExitCode)" - exit(1) - } - displayName: 'Install GSA' - failOnStderr: true - -- powershell: | - & 'C:\Program Files\Oasys\*\GSA.exe' /Register - displayName: 'Register GSA COM' - failOnStderr: false - -- powershell: | - ./cleanRegistry.ps1 - displayName: 'Run Registry Cleaner' - failOnStderr: true - -- task: NuGetToolInstaller@1 - -- task: NuGetCommand@2 - displayName: 'Restoring NuGet packages' - inputs: - command: 'restore' - restoreSolution: 'GsaGH.sln' - -- task: VSBuild@1 - displayName: 'Building project in $(configuration)' - inputs: - solution: 'GsaGH.sln' - msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' - platform: 'x64' - configuration: '$(configuration)' - clean: true - env: - MSBUILDDISABLENODEREUSE: 1 - -- powershell: | - dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll - dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll - displayName: dotnet tests - failOnStderr: true - -- powershell: | - if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { - Write-Output "codecov.yml is invalid" - Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post - exit(1) - } else { - Write-Output "codecov.yml is valid" - } - displayName: Validate codecov.yml - failOnStderr: true - -- powershell: | - $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path - echo $coverage_file_gsagh - $coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path - echo $coverage_file_integration - Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml - Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml - $ProgressPreference = 'SilentlyContinue' - Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe - ls $(System.DefaultWorkingDirectory)\ - cd $(System.DefaultWorkingDirectory)\ - .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh - .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration - env: - CODECOV_TOKEN: $(CODECOV_TOKEN) - displayName: Upload Code Coverage to codecovio - failOnStderr: true - -- task: PublishCodeCoverageResults@1 - displayName: Create Azure GsaGH CodeCoverage - inputs: - codeCoverageTool: 'cobertura' - summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/gsagh/**/coverage.cobertura.xml' - pathToSources: '$(System.DefaultWorkingDirectory)' - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) - -- task: PublishCodeCoverageResults@1 - displayName: Create Azure IntegrationTest CodeCoverage - inputs: - codeCoverageTool: 'cobertura' - summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/integration/**/coverage.cobertura.xml' - pathToSources: '$(System.DefaultWorkingDirectory)' - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) - -- publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml - displayName: Publish GsaGHTest xml to Azure - artifact: GsaGHTestsCoverage - continueOnError: true - -- publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml - displayName: Publish IntegrationTest xml to Azure - artifact: IntegrationTestsCoverage - continueOnError: true - -- task: PowerShell@2 - displayName: Check for existing tags - inputs: - targetType: 'inline' - script: | - $versionInfo = $(Get-Item .\GsaGH\bin\x64\Release\net48\GsaGH.dll).VersionInfo - echo $versionInfo - $fullVersion = [array]${versionInfo}.FileVersion.split('.') - $currentTime = $(Get-Date -Format "dddd MM/dd/yyyy HH:mm") - $majorVersion = [string]$fullVersion[0] - $minorVersion = [string]$fullVersion[1] - $spVersion = [string]$fullVersion[2] - $buildNumber = [string]$fullVersion[3] - - $tag = [array]@($exeName,$majorVersion,$minorVersion,$spVersion,$buildNumber) - $tagNumbersOnly = [array]@($majorVersion,$minorVersion,$spVersion,$buildNumber) - - $dotSeparatedTag = $majorVersion + "." + $minorVersion + "." + $spVersion - $underscoreSeparatedTag = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber - $tagNumbersOnlyUnderscore = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber - $tagNumbersOnlydot = $majorVersion + "." + $minorVersion + "." + $spVersion + "." + $buildNumber - - Write-Host ("##vso[task.setvariable variable=dotSeparatedTag]$dotSeparatedTag") - git rev-parse $dotSeparatedTag - if($lastExitCode -eq 0){Write-Host ("##vso[task.setvariable variable=TAG_EXISTS]true")} - if($lastExitCode -eq 0){ - $tagExists = 'true' - echo $tagExists - } - errorActionPreference: 'continue' - workingDirectory: '$(System.DefaultWorkingDirectory)' - ignoreLASTEXITCODE: true - -- powershell: | - cd GsaGH\bin\x64\Release - curl https://files.mcneel.com/yak/tools/latest/yak.exe -o yak.exe - .\yak version - cd net48 - ..\yak spec - Add-Content manifest.yml 'icon: GsaIcon.png' - Add-Content manifest.yml 'keywords:' - Add-Content manifest.yml '- oasys' - Add-Content manifest.yml '- gsa' - Add-Content manifest.yml '- gsagh' - Add-Content manifest.yml '- fe' - Add-Content manifest.yml '- fea' - Add-Content manifest.yml '- fem' - Add-Content manifest.yml '- structural' - Add-Content manifest.yml '- structuralanalysis' - ..\yak build --platform win - $yakCurrentVersName = Get-ChildItem -Path . -Filter "*.yak" - $yakRh7Name = $yakCurrentVersName -Replace "rh6_27", "rh7_0" - Rename-Item -Path $yakCurrentVersName -NewName $yakRh7Name - ..\yak build --platform win - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) - displayName: Package yak - -- powershell: | - cd GsaGH - & 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe' GsaGH.csproj /t:pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:DebugType=portable /property:Configuration=Debug - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) - displayName: Package NuGet - -- powershell: | - .\DocsGeneration\bin\x64\Debug\net48\DocsGeneration.exe - Compress-Archive -Path .\Output -DestinationPath .\results\$(dotSeparatedTag)-docs.zip -Force - displayName: Generate docs site - failOnStderr: true - -- publish: $(System.DefaultWorkingDirectory)\results\$(dotSeparatedTag)-docs.zip - displayName: Publish Docs artifact - artifact: Docs - continueOnError: false - -- task: GitHubRelease@1 - displayName: 'Publishing assets to Github' - inputs: - gitHubConnection: 'github.com_MJCramp' - repositoryName: 'arup-group/GSA-Grasshopper' - action: 'edit' - target: '$(Build.SourceVersion)' - tag: '$(dotSeparatedTag)' - title: 'GsaGH version $(dotSeparatedTag)' - releaseNotesSource: 'inline' - releaseNotesInline: | - Created from commit https://github.com/arup-group/GSA-Grasshopper/commit/$(Build.SourceVersion) - assets: | - $(System.DefaultWorkingDirectory)/**/*.yak - $(System.DefaultWorkingDirectory)/**/*.nupkg - $(System.DefaultWorkingDirectory)/**/*.snupkg - $(System.DefaultWorkingDirectory)/**/$(dotSeparatedTag)-docs.zip - assetUploadMode: 'replace' - isDraft: true - isPreRelease: false - addChangeLog: false - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) - -- powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink - displayName: 'Delete orphan .ghlink files' - condition: always() - -- powershell: | - $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) - Write-output "Installer Path: ${installerPath}" - $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait - $app.WaitForExit() - Write-Output "Exit code: $($app.ExitCode)" - Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" - ### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED - ### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes - if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { - Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" - rm $installerPath - exit(0) - } else { - Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" - exit(1) - } - condition: always() - displayName: 'Uninstall Application' +# # https://aka.ms/yaml +# +# trigger: +# branches: +# exclude: +# - 'task/GSAGH-555-new-pipeline' +# +# variables: +# - group: s3PushInstallers +# - group: pipeline-tokens +# - name: configuration +# value: Release +# +# pool: 'rhino-compute' +# +# steps: +# - powershell: | +# Get-ChildItem *.msi -Recurse | Remove-Item +# aws s3 cp s3://oasys-installer-store/GSA/latest . --exclude "*" --include *Arup*.msi --recursive +# Get-ChildItem *.msi | Rename-Item -NewName gsa.msi +# displayName: 'Download GSA latest' +# failOnStderr: true +# +# - powershell: | +# $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) +# Write-output "Installer Path: ${installerPath}" +# Write-output "GSA Version:" +# if (!(Test-Path $installerPath.FullName)) { +# Write-output "File '{0}' does not exist" -f $installerPath.FullName +# } +# try { +# $WindowsInstaller = New-Object -com WindowsInstaller.Installer +# $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) +# $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" +# $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) +# $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null +# $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) +# $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) +# Write-output $Version +# } catch { +# Write-output "Failed to get MSI file version: {0}." -f $_ +# } +# $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait +# $app.WaitForExit() +# Write-Output "Exit code: $($app.ExitCode)" +# Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" +# if ($app.ExitCode -ne 0) { +# Write-Error "Application could not be installed. Error code $($app.ExitCode)" +# exit(1) +# } +# displayName: 'Install GSA' +# failOnStderr: true +# +# - powershell: | +# & 'C:\Program Files\Oasys\*\GSA.exe' /Register +# displayName: 'Register GSA COM' +# failOnStderr: false +# +# - powershell: | +# ./cleanRegistry.ps1 +# displayName: 'Run Registry Cleaner' +# failOnStderr: true +# +# - task: NuGetToolInstaller@1 +# +# - task: NuGetCommand@2 +# displayName: 'Restoring NuGet packages' +# inputs: +# command: 'restore' +# restoreSolution: 'GsaGH.sln' +# +# - task: VSBuild@1 +# displayName: 'Building project in $(configuration)' +# inputs: +# solution: 'GsaGH.sln' +# msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' +# platform: 'x64' +# configuration: '$(configuration)' +# clean: true +# env: +# MSBUILDDISABLENODEREUSE: 1 +# +# - powershell: | +# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll +# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll +# displayName: dotnet tests +# failOnStderr: true +# +# - powershell: | +# if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { +# Write-Output "codecov.yml is invalid" +# Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post +# exit(1) +# } else { +# Write-Output "codecov.yml is valid" +# } +# displayName: Validate codecov.yml +# failOnStderr: true +# +# - powershell: | +# $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path +# echo $coverage_file_gsagh +# $coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path +# echo $coverage_file_integration +# Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml +# Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml +# $ProgressPreference = 'SilentlyContinue' +# Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe +# ls $(System.DefaultWorkingDirectory)\ +# cd $(System.DefaultWorkingDirectory)\ +# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh +# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration +# env: +# CODECOV_TOKEN: $(CODECOV_TOKEN) +# displayName: Upload Code Coverage to codecovio +# failOnStderr: true +# +# - task: PublishCodeCoverageResults@1 +# displayName: Create Azure GsaGH CodeCoverage +# inputs: +# codeCoverageTool: 'cobertura' +# summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/gsagh/**/coverage.cobertura.xml' +# pathToSources: '$(System.DefaultWorkingDirectory)' +# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) +# +# - task: PublishCodeCoverageResults@1 +# displayName: Create Azure IntegrationTest CodeCoverage +# inputs: +# codeCoverageTool: 'cobertura' +# summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/integration/**/coverage.cobertura.xml' +# pathToSources: '$(System.DefaultWorkingDirectory)' +# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) +# +# - publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml +# displayName: Publish GsaGHTest xml to Azure +# artifact: GsaGHTestsCoverage +# continueOnError: true +# +# - publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml +# displayName: Publish IntegrationTest xml to Azure +# artifact: IntegrationTestsCoverage +# continueOnError: true +# +# - task: PowerShell@2 +# displayName: Check for existing tags +# inputs: +# targetType: 'inline' +# script: | +# $versionInfo = $(Get-Item .\GsaGH\bin\x64\Release\net48\GsaGH.dll).VersionInfo +# echo $versionInfo +# $fullVersion = [array]${versionInfo}.FileVersion.split('.') +# $currentTime = $(Get-Date -Format "dddd MM/dd/yyyy HH:mm") +# $majorVersion = [string]$fullVersion[0] +# $minorVersion = [string]$fullVersion[1] +# $spVersion = [string]$fullVersion[2] +# $buildNumber = [string]$fullVersion[3] +# +# $tag = [array]@($exeName,$majorVersion,$minorVersion,$spVersion,$buildNumber) +# $tagNumbersOnly = [array]@($majorVersion,$minorVersion,$spVersion,$buildNumber) +# +# $dotSeparatedTag = $majorVersion + "." + $minorVersion + "." + $spVersion +# $underscoreSeparatedTag = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber +# $tagNumbersOnlyUnderscore = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber +# $tagNumbersOnlydot = $majorVersion + "." + $minorVersion + "." + $spVersion + "." + $buildNumber +# +# Write-Host ("##vso[task.setvariable variable=dotSeparatedTag]$dotSeparatedTag") +# git rev-parse $dotSeparatedTag +# if($lastExitCode -eq 0){Write-Host ("##vso[task.setvariable variable=TAG_EXISTS]true")} +# if($lastExitCode -eq 0){ +# $tagExists = 'true' +# echo $tagExists +# } +# errorActionPreference: 'continue' +# workingDirectory: '$(System.DefaultWorkingDirectory)' +# ignoreLASTEXITCODE: true +# +# - powershell: | +# cd GsaGH\bin\x64\Release +# curl https://files.mcneel.com/yak/tools/latest/yak.exe -o yak.exe +# .\yak version +# cd net48 +# ..\yak spec +# Add-Content manifest.yml 'icon: GsaIcon.png' +# Add-Content manifest.yml 'keywords:' +# Add-Content manifest.yml '- oasys' +# Add-Content manifest.yml '- gsa' +# Add-Content manifest.yml '- gsagh' +# Add-Content manifest.yml '- fe' +# Add-Content manifest.yml '- fea' +# Add-Content manifest.yml '- fem' +# Add-Content manifest.yml '- structural' +# Add-Content manifest.yml '- structuralanalysis' +# ..\yak build --platform win +# $yakCurrentVersName = Get-ChildItem -Path . -Filter "*.yak" +# $yakRh7Name = $yakCurrentVersName -Replace "rh6_27", "rh7_0" +# Rename-Item -Path $yakCurrentVersName -NewName $yakRh7Name +# ..\yak build --platform win +# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) +# displayName: Package yak +# +# - powershell: | +# cd GsaGH +# & 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe' GsaGH.csproj /t:pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:DebugType=portable /property:Configuration=Debug +# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) +# displayName: Package NuGet +# +# - powershell: | +# .\DocsGeneration\bin\x64\Debug\net48\DocsGeneration.exe +# Compress-Archive -Path .\Output -DestinationPath .\results\$(dotSeparatedTag)-docs.zip -Force +# displayName: Generate docs site +# failOnStderr: true +# +# - publish: $(System.DefaultWorkingDirectory)\results\$(dotSeparatedTag)-docs.zip +# displayName: Publish Docs artifact +# artifact: Docs +# continueOnError: false +# +# - task: GitHubRelease@1 +# displayName: 'Publishing assets to Github' +# inputs: +# gitHubConnection: 'github.com_MJCramp' +# repositoryName: 'arup-group/GSA-Grasshopper' +# action: 'edit' +# target: '$(Build.SourceVersion)' +# tag: '$(dotSeparatedTag)' +# title: 'GsaGH version $(dotSeparatedTag)' +# releaseNotesSource: 'inline' +# releaseNotesInline: | +# Created from commit https://github.com/arup-group/GSA-Grasshopper/commit/$(Build.SourceVersion) +# assets: | +# $(System.DefaultWorkingDirectory)/**/*.yak +# $(System.DefaultWorkingDirectory)/**/*.nupkg +# $(System.DefaultWorkingDirectory)/**/*.snupkg +# $(System.DefaultWorkingDirectory)/**/$(dotSeparatedTag)-docs.zip +# assetUploadMode: 'replace' +# isDraft: true +# isPreRelease: false +# addChangeLog: false +# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) +# +# - powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink +# displayName: 'Delete orphan .ghlink files' +# condition: always() +# +# - powershell: | +# $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) +# Write-output "Installer Path: ${installerPath}" +# $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait +# $app.WaitForExit() +# Write-Output "Exit code: $($app.ExitCode)" +# Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" +# ### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED +# ### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes +# if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { +# Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" +# rm $installerPath +# exit(0) +# } else { +# Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" +# exit(1) +# } +# condition: always() +# displayName: 'Uninstall Application' diff --git a/build-test-nightly.yml b/build-test-nightly.yml index 51ba4d626..3f494fc7b 100644 --- a/build-test-nightly.yml +++ b/build-test-nightly.yml @@ -1,181 +1,181 @@ # https://aka.ms/yaml -trigger: - branches: - exclude: - - 'task/GSAGH-555-new-pipeline' - -variables: - - group: s3PushInstallers - - group: pipeline-tokens - - name: configuration - value: Release - -pool: 'rhino-compute' - -steps: -- powershell: | - Get-ChildItem *.msi -Recurse | Remove-Item - aws s3 cp s3://oasys-installer-store/GSA/nightly . --exclude "*" --include *Arup*.msi --recursive - Get-ChildItem *.msi | Rename-Item -NewName gsa.msi - displayName: 'Download GSA nightly' - failOnStderr: true - -- powershell: | - $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) - Write-output "Installer Path: ${installerPath}" - Write-output "GSA Version:" - if (!(Test-Path $installerPath.FullName)) { - Write-output "File '{0}' does not exist" -f $installerPath.FullName - } - try { - $WindowsInstaller = New-Object -com WindowsInstaller.Installer - $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) - $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" - $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) - $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null - $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) - $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) - Write-output $Version - } catch { - Write-output "Failed to get MSI file version: {0}." -f $_ - } - $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait - $app.WaitForExit() - Write-Output "Exit code: $($app.ExitCode)" - Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" - if ($app.ExitCode -ne 0) { - Write-Error "Application could not be installed. Error code $($app.ExitCode)" - exit(1) - } - displayName: 'Install GSA' - failOnStderr: true - -- powershell: | - & 'C:\Program Files\Oasys\*\GSA.exe' /Register - displayName: 'Register GSA COM' - failOnStderr: false - -- powershell: | - ./cleanRegistry.ps1 - displayName: 'Run Registry Cleaner' - failOnStderr: true - -- task: NuGetToolInstaller@1 - -- task: NuGetCommand@2 - displayName: 'Restoring NuGet packages' - inputs: - command: 'restore' - restoreSolution: 'GsaGH.sln' - -- task: VSBuild@1 - displayName: 'Building project in $(configuration)' - inputs: - solution: 'GsaGH.sln' - msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' - platform: 'x64' - configuration: '$(configuration)' - clean: true - env: - MSBUILDDISABLENODEREUSE: 1 - -- powershell: | - dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll - dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll - displayName: dotnet tests - failOnStderr: true - -- powershell: | - if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { - Write-Output "codecov.yml is invalid" - Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post - exit(1) - } else { - Write-Output "codecov.yml is valid" - } - displayName: Validate codecov.yml - failOnStderr: true - -- powershell: | - $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path - echo $coverage_file_gsagh - $coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path - echo $coverage_file_integration - Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml - Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml - $ProgressPreference = 'SilentlyContinue' - Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe - ls $(System.DefaultWorkingDirectory)\ - cd $(System.DefaultWorkingDirectory)\ - .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh - .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration - env: - CODECOV_TOKEN: $(CODECOV_TOKEN) - displayName: Upload Code Coverage to codecovio - failOnStderr: true - -- publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml - displayName: Publish GsaGHTest xml to Azure - artifact: GsaGHTestsCoverage - continueOnError: true - -- publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml - displayName: Publish IntegrationTest xml to Azure - artifact: IntegrationTestsCoverage - continueOnError: true - -- powershell: | - cd GsaGH\bin\x64\Release - curl https://files.mcneel.com/yak/tools/latest/yak.exe -o yak.exe - .\yak version - cd net48 - ..\yak spec - Add-Content manifest.yml 'icon: GsaIcon.png' - Add-Content manifest.yml 'keywords:' - Add-Content manifest.yml '- oasys' - Add-Content manifest.yml '- gsa' - Add-Content manifest.yml '- gsagh' - Add-Content manifest.yml '- fe' - Add-Content manifest.yml '- fea' - Add-Content manifest.yml '- fem' - Add-Content manifest.yml '- structural' - Add-Content manifest.yml '- structuralanalysis' - ..\yak build --platform win - $yakCurrentVersName = Get-ChildItem -Path . -Filter "*.yak" - $yakRh7Name = $yakCurrentVersName -Replace "rh6_27", "rh7_0" - Rename-Item -Path $yakCurrentVersName -NewName $yakRh7Name - ..\yak build --platform win - New-Item -ItemType Directory -Path $(System.DefaultWorkingDirectory)\results\yak - Copy-Item $yakCurrentVersName $(System.DefaultWorkingDirectory)\results\yak\$yakCurrentVersName - Copy-Item $yakRh7Name $(System.DefaultWorkingDirectory)\results\yak\$yakRh7Name - displayName: Package yak - -- publish: $(System.DefaultWorkingDirectory)\results\yak\ - displayName: Publish Yak Package to Azure - artifact: Yak Package - continueOnError: false - -- powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink - displayName: 'Delete orphan .ghlink files' - condition: always() - -- powershell: | - $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) - Write-output "Installer Path: ${installerPath}" - $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait - $app.WaitForExit() - Write-Output "Exit code: $($app.ExitCode)" - Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" - ### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED - ### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes - if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { - Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" - rm $installerPath - exit(0) - } else { - Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" - exit(1) - } - condition: always() - displayName: 'Uninstall Application' +# trigger: +# branches: +# exclude: +# - 'task/GSAGH-555-new-pipeline' +# +# variables: +# - group: s3PushInstallers +# - group: pipeline-tokens +# - name: configuration +# value: Release +# +# pool: 'rhino-compute' +# +# steps: +# - powershell: | +# Get-ChildItem *.msi -Recurse | Remove-Item +# aws s3 cp s3://oasys-installer-store/GSA/nightly . --exclude "*" --include *Arup*.msi --recursive +# Get-ChildItem *.msi | Rename-Item -NewName gsa.msi +# displayName: 'Download GSA nightly' +# failOnStderr: true +# +# - powershell: | +# $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) +# Write-output "Installer Path: ${installerPath}" +# Write-output "GSA Version:" +# if (!(Test-Path $installerPath.FullName)) { +# Write-output "File '{0}' does not exist" -f $installerPath.FullName +# } +# try { +# $WindowsInstaller = New-Object -com WindowsInstaller.Installer +# $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) +# $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" +# $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) +# $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null +# $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) +# $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) +# Write-output $Version +# } catch { +# Write-output "Failed to get MSI file version: {0}." -f $_ +# } +# $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait +# $app.WaitForExit() +# Write-Output "Exit code: $($app.ExitCode)" +# Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" +# if ($app.ExitCode -ne 0) { +# Write-Error "Application could not be installed. Error code $($app.ExitCode)" +# exit(1) +# } +# displayName: 'Install GSA' +# failOnStderr: true +# +# - powershell: | +# & 'C:\Program Files\Oasys\*\GSA.exe' /Register +# displayName: 'Register GSA COM' +# failOnStderr: false +# +# - powershell: | +# ./cleanRegistry.ps1 +# displayName: 'Run Registry Cleaner' +# failOnStderr: true +# +# - task: NuGetToolInstaller@1 +# +# - task: NuGetCommand@2 +# displayName: 'Restoring NuGet packages' +# inputs: +# command: 'restore' +# restoreSolution: 'GsaGH.sln' +# +# - task: VSBuild@1 +# displayName: 'Building project in $(configuration)' +# inputs: +# solution: 'GsaGH.sln' +# msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' +# platform: 'x64' +# configuration: '$(configuration)' +# clean: true +# env: +# MSBUILDDISABLENODEREUSE: 1 +# +# - powershell: | +# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll +# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll +# displayName: dotnet tests +# failOnStderr: true +# +# - powershell: | +# if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { +# Write-Output "codecov.yml is invalid" +# Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post +# exit(1) +# } else { +# Write-Output "codecov.yml is valid" +# } +# displayName: Validate codecov.yml +# failOnStderr: true +# +# - powershell: | +# $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path +# echo $coverage_file_gsagh +# $coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path +# echo $coverage_file_integration +# Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml +# Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml +# $ProgressPreference = 'SilentlyContinue' +# Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe +# ls $(System.DefaultWorkingDirectory)\ +# cd $(System.DefaultWorkingDirectory)\ +# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh +# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration +# env: +# CODECOV_TOKEN: $(CODECOV_TOKEN) +# displayName: Upload Code Coverage to codecovio +# failOnStderr: true +# +# - publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml +# displayName: Publish GsaGHTest xml to Azure +# artifact: GsaGHTestsCoverage +# continueOnError: true +# +# - publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml +# displayName: Publish IntegrationTest xml to Azure +# artifact: IntegrationTestsCoverage +# continueOnError: true +# +# - powershell: | +# cd GsaGH\bin\x64\Release +# curl https://files.mcneel.com/yak/tools/latest/yak.exe -o yak.exe +# .\yak version +# cd net48 +# ..\yak spec +# Add-Content manifest.yml 'icon: GsaIcon.png' +# Add-Content manifest.yml 'keywords:' +# Add-Content manifest.yml '- oasys' +# Add-Content manifest.yml '- gsa' +# Add-Content manifest.yml '- gsagh' +# Add-Content manifest.yml '- fe' +# Add-Content manifest.yml '- fea' +# Add-Content manifest.yml '- fem' +# Add-Content manifest.yml '- structural' +# Add-Content manifest.yml '- structuralanalysis' +# ..\yak build --platform win +# $yakCurrentVersName = Get-ChildItem -Path . -Filter "*.yak" +# $yakRh7Name = $yakCurrentVersName -Replace "rh6_27", "rh7_0" +# Rename-Item -Path $yakCurrentVersName -NewName $yakRh7Name +# ..\yak build --platform win +# New-Item -ItemType Directory -Path $(System.DefaultWorkingDirectory)\results\yak +# Copy-Item $yakCurrentVersName $(System.DefaultWorkingDirectory)\results\yak\$yakCurrentVersName +# Copy-Item $yakRh7Name $(System.DefaultWorkingDirectory)\results\yak\$yakRh7Name +# displayName: Package yak +# +# - publish: $(System.DefaultWorkingDirectory)\results\yak\ +# displayName: Publish Yak Package to Azure +# artifact: Yak Package +# continueOnError: false +# +# - powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink +# displayName: 'Delete orphan .ghlink files' +# condition: always() +# +# - powershell: | +# $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) +# Write-output "Installer Path: ${installerPath}" +# $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait +# $app.WaitForExit() +# Write-Output "Exit code: $($app.ExitCode)" +# Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" +# ### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED +# ### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes +# if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { +# Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" +# rm $installerPath +# exit(0) +# } else { +# Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" +# exit(1) +# } +# condition: always() +# displayName: 'Uninstall Application' From dc06ccc4f9e180d21aa6a0ea7cf28e688ff04fef Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 17:07:17 +0100 Subject: [PATCH 05/80] ci: stages that check Unit or Integration Tests need --- impact-testing.yml | 290 ++++++++++----------------------------------- 1 file changed, 62 insertions(+), 228 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 2e282ae9a..e45e173ec 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -1,234 +1,68 @@ -# https://aka.ms/yaml - -trigger: +pr: branches: include: - - release/* - paths: - include: - - GsaGH/** - - GsaGHTests/** - -variables: - - group: s3PushInstallers - - group: pipeline-tokens - - name: configuration - value: Release - -jobs: - - job: SetupMachine - displayName: Setup Machine with GSA Version - pool: 'rhino-compute' - condition: always() - workspace: - clean: all - + - 'release/*' + +stages: +- stage: CheckRepoChanges + displayName: 'Check Repository Changes' + jobs: + - job: CheckChanges + displayName: 'Check for Changes in GsaGH and IntegrationTests' + pool: + vmImage: 'windows-latest' steps: - - powershell: | - Get-ChildItem *.msi -Recurse | Remove-Item - aws s3 cp s3://oasys-installer-store/GSA/nightly . --exclude "*" --include *Arup*.msi --recursive - # Move-Item -Path $(Pipeline.Workspace)\*Arup*.msi -Destination $(Pipeline.Workspace)\gsa.msi - displayName: 'Download GSA nightly' - failOnStderr: true - - - powershell: | - $msiFile = Get-ChildItem -Filter *.msi -Recurse | Select-Object -First 1 - if ($msiFile) { - Move-Item -Path $msiFile.FullName -Destination "$(Pipeline.Workspace)\gsa.msi" - Write-Output "MSI file moved and renamed to: $(Pipeline.Workspace)\gsa.msi" - } else { - Write-Output "No .msi file found." - } - failOnStderr: true - displayName: 'rename file' - - - publish: $(Pipeline.Workspace)/gsa.msi - displayName: 'Publish MSI Installer as an Artifact' - artifact: GSAInstaller - - - powershell: | - $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) - Write-output "Installer Path: ${installerPath}" - Write-output "GSA Version:" - if (!(Test-Path $installerPath.FullName)) { - Write-output "File '{0}' does not exist" -f $installerPath.FullName - } - try { - $WindowsInstaller = New-Object -com WindowsInstaller.Installer - $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) - $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" - $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) - $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null - $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) - $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) - Write-output $Version - } catch { - Write-output "Failed to get MSI file version: {0}." -f $_ - } - $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait - $app.WaitForExit() - Write-Output "Exit code: $($app.ExitCode)" - Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" - if ($app.ExitCode -ne 0) { - Write-Error "Application could not be installed. Error code $($app.ExitCode)" - exit(1) - } - displayName: 'Install GSA' - failOnStderr: true - - - powershell: | - & 'C:\Program Files\Oasys\*\GSA.exe' /Register - displayName: 'Register GSA COM' - failOnStderr: false - - - task: NuGetToolInstaller@1 - - - task: NuGetCommand@2 - displayName: 'Restoring NuGet packages' - inputs: - command: 'restore' - restoreSolution: 'GsaGH.sln' - - - task: VSBuild@1 - displayName: 'Building project in $(configuration)' - inputs: - solution: 'GsaGH.sln' - msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' - platform: 'x64' - configuration: '$(configuration)' - clean: true - env: - MSBUILDDISABLENODEREUSE: 1 - - - task: VisualStudioTestPlatformInstaller@1 - displayName: 'Install Test Platform' - - - task: VSTest@3 - inputs: - testSelector: 'testAssemblies' # Enables Test Impact Analysis - testAssemblyVer2: | - GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll - searchFolder: '$(System.DefaultWorkingDirectory)' - runOnlyImpactedTests: true - runInParallel: true - failOnStderr: true - - # **\bin\**\GsaReTests.dll # Modify this pattern based on where your test assemblies are - # - powershell: | - # dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll - # displayName: Unit Tests - # failOnStderr: true - - - powershell: | - if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { - Write-Output "codecov.yml is invalid" - Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post - exit(1) - } else { - Write-Output "codecov.yml is valid" + - powershell: | + Write-Output "Checking for changes in GsaGH/** and IntegrationTests/**..." + $gitChanges = git diff --name-only HEAD~1 HEAD + $unitTestsChanged = $false + $integrationTestsChanged = $false + + foreach ($file in $gitChanges) { + if ($file -like 'GsaGH/*') { + $unitTestsChanged = $true } - displayName: Validate codecov.yml - failOnStderr: true - - - powershell: | - $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path - echo $coverage_file_gsagh - Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml - $ProgressPreference = 'SilentlyContinue' - Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe - ls $(System.DefaultWorkingDirectory)\ - cd $(System.DefaultWorkingDirectory)\ - .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh - env: - CODECOV_TOKEN: $(CODECOV_TOKEN) - displayName: Upload Code Coverage to codecovio - failOnStderr: true - - - publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml - displayName: Publish GsaGHTest xml to Azure - artifact: GsaGHTestsCoverage - continueOnError: true -# - powershell: | -# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll -# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll -# displayName: dotnet tests -# failOnStderr: true -# -# - powershell: | -# if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { -# Write-Output "codecov.yml is invalid" -# Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post -# exit(1) -# } else { -# Write-Output "codecov.yml is valid" -# } -# displayName: Validate codecov.yml -# failOnStderr: true -# -# - powershell: | -# $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path -# echo $coverage_file_gsagh -# $coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path -# echo $coverage_file_integration -# Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml -# Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml -# $ProgressPreference = 'SilentlyContinue' -# Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe -# ls $(System.DefaultWorkingDirectory)\ -# cd $(System.DefaultWorkingDirectory)\ -# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh -# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration -# env: -# CODECOV_TOKEN: $(CODECOV_TOKEN) -# displayName: Upload Code Coverage to codecovio -# failOnStderr: true -# -# - publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml -# displayName: Publish GsaGHTest xml to Azure -# artifact: GsaGHTestsCoverage -# continueOnError: true -# -# - publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml -# displayName: Publish IntegrationTest xml to Azure -# artifact: IntegrationTestsCoverage -# continueOnError: true -# - - # - job: UninstallAndClean - # displayName: Uninstall And Clean - # dependsOn: [SetupMachine, RunUnitTests] - # condition: always() - # pool: 'rhino-compute' - # workspace: - # clean: none - # steps: - # - task: DownloadPipelineArtifact@2 - # inputs: - # artifact: GSAInstaller - # path: $(Pipeline.Workspace) # Download it to the same workspace path - # displayName: 'Download MSI Installer Artifact' - - - powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink - displayName: 'Delete orphan .ghlink files' - condition: always() - - - powershell: | - $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) - Write-output "Installer Path: ${installerPath}" - $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait - $app.WaitForExit() - Write-Output "Exit code: $($app.ExitCode)" - Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" - ### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED - ### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes - if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { - Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" - rm $installerPath - exit(0) - } else { - Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" - exit(1) + if ($file -like 'IntegrationTests/*') { + $integrationTestsChanged = $true } - condition: always() - displayName: 'Uninstall Application' + } + + Write-Output "Setting pipeline variables based on changes detected..." + if ($unitTestsChanged) { + Write-Output "UnitTests=True" + echo "##vso[task.setvariable variable=UnitTests]true" + } + if ($integrationTestsChanged) { + Write-Output "Integration=True" + echo "##vso[task.setvariable variable=Integration]true" + } + displayName: 'Detect Changes in Repo' + +- stage: ImpactTestingUnit + displayName: 'Impact Testing (Unit)' + dependsOn: CheckRepoChanges + condition: eq(variables['UnitTests'], 'true') + jobs: + - job: UnitTests + displayName: 'Run Unit Tests' + pool: + vmImage: 'windows-latest' + steps: + - powershell: | + Write-Output "Running Unit Tests..." + displayName: 'Run Unit Tests' + +- stage: ImpactTestingIntegration + displayName: 'Impact Testing (Integration)' + dependsOn: ImpactTestingUnit + condition: eq(variables['Integration'], 'true') + jobs: + - job: IntegrationTests + displayName: 'Run Integration Tests' + pool: + vmImage: 'windows-latest' + steps: + - powershell: | + Write-Output "Running Integration Tests..." + displayName: 'Run Integration Tests' From 49da8e28eb46ddaa1da2ebff372f51d1c57f1770 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 17:18:43 +0100 Subject: [PATCH 06/80] ci: do not clone and checkout minimal --- impact-testing.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index e45e173ec..79725b6d8 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -12,12 +12,15 @@ stages: pool: vmImage: 'windows-latest' steps: + - checkout: none - powershell: | + git clone --filter=blob:none --branch "$(sourceBranch)" Write-Output "Checking for changes in GsaGH/** and IntegrationTests/**..." + git fetch origin $gitChanges = git diff --name-only HEAD~1 HEAD $unitTestsChanged = $false $integrationTestsChanged = $false - + foreach ($file in $gitChanges) { if ($file -like 'GsaGH/*') { $unitTestsChanged = $true @@ -26,7 +29,7 @@ stages: $integrationTestsChanged = $true } } - + Write-Output "Setting pipeline variables based on changes detected..." if ($unitTestsChanged) { Write-Output "UnitTests=True" @@ -65,4 +68,3 @@ stages: - powershell: | Write-Output "Running Integration Tests..." displayName: 'Run Integration Tests' - From 7362f18d7e74bb0b86ab0cbee4e4cf614f5ea285 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 17:25:44 +0100 Subject: [PATCH 07/80] ci: clone minimal repo --- impact-testing.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/impact-testing.yml b/impact-testing.yml index 79725b6d8..1ccbdcb38 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -3,6 +3,10 @@ pr: include: - 'release/*' +variables: + - group: s3PushInstallers + - group: pipeline-tokens + stages: - stage: CheckRepoChanges displayName: 'Check Repository Changes' @@ -12,8 +16,19 @@ stages: pool: vmImage: 'windows-latest' steps: + - checkout: none + - powershell: | + Write-Output "Minimal checkout of repository..." + git clone --filter=blob:none --branch $env:System.PullRequest.SourceBranch --depth 100 --sparse https://$env:GITHUB_TOKEN@github.com/arup-group/GSA-Grasshopper . + git fetch --no-tags --filter=blob:none origin $env:targetBranch:refs/remotes/origin/$env:targetBranch + git branch $env:targetBranch FETCH_HEAD + displayName: 'Minimal Checkout' + env: + GITHUB_TOKEN: $(GITHUB_TOKEN) + + - powershell: | git clone --filter=blob:none --branch "$(sourceBranch)" Write-Output "Checking for changes in GsaGH/** and IntegrationTests/**..." git fetch origin From b2aae71fb660a4995efd670511e29012a130ada4 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 17:26:36 +0100 Subject: [PATCH 08/80] ci: fixed identation --- impact-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index 1ccbdcb38..18039546e 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -28,7 +28,7 @@ stages: env: GITHUB_TOKEN: $(GITHUB_TOKEN) - - powershell: | + - powershell: | git clone --filter=blob:none --branch "$(sourceBranch)" Write-Output "Checking for changes in GsaGH/** and IntegrationTests/**..." git fetch origin From 5b3712d19beb0cac5b1ae3d927352f9b7e3a748d Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 17:33:15 +0100 Subject: [PATCH 09/80] ci: dependancy and simpler clone --- impact-testing.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 18039546e..d060f839f 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -21,15 +21,15 @@ stages: - powershell: | Write-Output "Minimal checkout of repository..." - git clone --filter=blob:none --branch $env:System.PullRequest.SourceBranch --depth 100 --sparse https://$env:GITHUB_TOKEN@github.com/arup-group/GSA-Grasshopper . - git fetch --no-tags --filter=blob:none origin $env:targetBranch:refs/remotes/origin/$env:targetBranch - git branch $env:targetBranch FETCH_HEAD + git clone --filter=blob:none --branch $env:System.PullRequest.SourceBranch + # git clone --branch $env:System.PullRequest.SourceBranch --depth 100 --sparse https://$env:GITHUB_TOKEN@github.com/arup-group/GSA-Grasshopper . + # git fetch --no-tags --filter=blob:none origin $env:targetBranch:refs/remotes/origin/$env:targetBranch + # git branch $env:targetBranch FETCH_HEAD displayName: 'Minimal Checkout' env: GITHUB_TOKEN: $(GITHUB_TOKEN) - powershell: | - git clone --filter=blob:none --branch "$(sourceBranch)" Write-Output "Checking for changes in GsaGH/** and IntegrationTests/**..." git fetch origin $gitChanges = git diff --name-only HEAD~1 HEAD @@ -72,7 +72,7 @@ stages: - stage: ImpactTestingIntegration displayName: 'Impact Testing (Integration)' - dependsOn: ImpactTestingUnit + dependsOn: CheckRepoChanges condition: eq(variables['Integration'], 'true') jobs: - job: IntegrationTests From 34b29700f4641666675682e74a52ffe57b09bc7b Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 17:41:23 +0100 Subject: [PATCH 10/80] ci: different trigger, to avoid duplicate job --- impact-testing.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index d060f839f..58fd1b852 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -1,4 +1,4 @@ -pr: +trigger: branches: include: - 'release/*' @@ -20,11 +20,8 @@ stages: - checkout: none - powershell: | - Write-Output "Minimal checkout of repository..." - git clone --filter=blob:none --branch $env:System.PullRequest.SourceBranch - # git clone --branch $env:System.PullRequest.SourceBranch --depth 100 --sparse https://$env:GITHUB_TOKEN@github.com/arup-group/GSA-Grasshopper . - # git fetch --no-tags --filter=blob:none origin $env:targetBranch:refs/remotes/origin/$env:targetBranch - # git branch $env:targetBranch FETCH_HEAD + Write-Output "Minimal checkout of repository...Branch=$env:System.PullRequest.SourceBranch" + # git clone --filter=blob:none --branch $env:System.PullRequest.SourceBranch displayName: 'Minimal Checkout' env: GITHUB_TOKEN: $(GITHUB_TOKEN) From 5fb4d9f32133ec1b57be1b65b56a37f104f2edbe Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 17:50:09 +0100 Subject: [PATCH 11/80] ci: pull repo --- impact-testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 58fd1b852..da5f12549 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -17,11 +17,11 @@ stages: vmImage: 'windows-latest' steps: - - checkout: none + # - checkout: none - powershell: | - Write-Output "Minimal checkout of repository...Branch=$env:System.PullRequest.SourceBranch" - # git clone --filter=blob:none --branch $env:System.PullRequest.SourceBranch + Write-Output "Minimal checkout of repository...Branch= $(System.PullRequest.SourceBranch)" + # git clone --filter=blob:none --branch $(System.PullRequest.SourceBranch) displayName: 'Minimal Checkout' env: GITHUB_TOKEN: $(GITHUB_TOKEN) From b4d01d7a21ac610922ff48ca29dbdab4e2b94480 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 17:54:13 +0100 Subject: [PATCH 12/80] ci: status and clone --- impact-testing.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index da5f12549..f26f8df7a 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -21,7 +21,7 @@ stages: - powershell: | Write-Output "Minimal checkout of repository...Branch= $(System.PullRequest.SourceBranch)" - # git clone --filter=blob:none --branch $(System.PullRequest.SourceBranch) + git clone --branch $(System.PullRequest.SourceBranch) --depth 100 --sparse https://$(GITHUB_TOKEN)@github.com/arup-group/GSA-Grasshopper.git . displayName: 'Minimal Checkout' env: GITHUB_TOKEN: $(GITHUB_TOKEN) @@ -29,6 +29,8 @@ stages: - powershell: | Write-Output "Checking for changes in GsaGH/** and IntegrationTests/**..." git fetch origin + git status + $gitChanges = git diff --name-only HEAD~1 HEAD $unitTestsChanged = $false $integrationTestsChanged = $false From 37407d7e869c607e2e7792dec17cb2f9c4bcb417 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 17:55:48 +0100 Subject: [PATCH 13/80] ci: no clone --- impact-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index f26f8df7a..37353a99e 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -17,7 +17,7 @@ stages: vmImage: 'windows-latest' steps: - # - checkout: none + - checkout: none - powershell: | Write-Output "Minimal checkout of repository...Branch= $(System.PullRequest.SourceBranch)" From 3b9e19a629b528cc684a06be3405eaa679c5ce69 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 18:00:14 +0100 Subject: [PATCH 14/80] ci: always print the state --- impact-testing.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 37353a99e..01ab1982a 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -20,7 +20,7 @@ stages: - checkout: none - powershell: | - Write-Output "Minimal checkout of repository...Branch= $(System.PullRequest.SourceBranch)" + Write-Output "Minimal checkout of repository...Branch:$(System.PullRequest.SourceBranch)" git clone --branch $(System.PullRequest.SourceBranch) --depth 100 --sparse https://$(GITHUB_TOKEN)@github.com/arup-group/GSA-Grasshopper.git . displayName: 'Minimal Checkout' env: @@ -45,14 +45,10 @@ stages: } Write-Output "Setting pipeline variables based on changes detected..." - if ($unitTestsChanged) { - Write-Output "UnitTests=True" - echo "##vso[task.setvariable variable=UnitTests]true" - } - if ($integrationTestsChanged) { - Write-Output "Integration=True" - echo "##vso[task.setvariable variable=Integration]true" - } + Write-Output "UnitTests=$unitTestsChanged" + echo "##vso[task.setvariable variable=UnitTests]$unitTestsChanged" + Write-Output "Integration=$integrationTestsChanged" + echo "##vso[task.setvariable variable=Integration]$integrationTestsChanged" displayName: 'Detect Changes in Repo' - stage: ImpactTestingUnit From fdb551ffd10be7eabec19fb568d8f7f3a1c2902c Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 18:09:21 +0100 Subject: [PATCH 15/80] ci: download gsa --- impact-testing.yml | 6 +++++- install-gsa-latest.yml | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 install-gsa-latest.yml diff --git a/impact-testing.yml b/impact-testing.yml index 01ab1982a..0cd823312 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -54,7 +54,8 @@ stages: - stage: ImpactTestingUnit displayName: 'Impact Testing (Unit)' dependsOn: CheckRepoChanges - condition: eq(variables['UnitTests'], 'true') + condition: always() + # condition: eq(variables['UnitTests'], 'true') jobs: - job: UnitTests displayName: 'Run Unit Tests' @@ -64,6 +65,9 @@ stages: - powershell: | Write-Output "Running Unit Tests..." displayName: 'Run Unit Tests' + - template: install-gsa-latest.yml + parameters: + version: latest - stage: ImpactTestingIntegration displayName: 'Impact Testing (Integration)' diff --git a/install-gsa-latest.yml b/install-gsa-latest.yml new file mode 100644 index 000000000..a93595cc1 --- /dev/null +++ b/install-gsa-latest.yml @@ -0,0 +1,12 @@ +parameters: +- name: version + type: string + default: 'nightly' + +steps: +- powershell: | + Get-ChildItem *.msi -Recurse | Remove-Item + aws s3 cp s3://oasys-installer-store/GSA/${{ parameters.version }} . --exclude "*" --include *Arup*.msi --recursive + Get-ChildItem *.msi | Rename-Item -NewName gsa.msi + displayName: 'Download GSA nightly' + failOnStderr: true From af31e5f832cc50b4eb0c88414c5f6fd74fbd7c09 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 18:12:17 +0100 Subject: [PATCH 16/80] ci: uninstall as well --- impact-testing.yml | 3 ++- install-gsa-latest.yml | 12 ------------ install-gsa.yml | 12 ++++++++++++ uninstall-gsa.yml | 20 ++++++++++++++++++++ 4 files changed, 34 insertions(+), 13 deletions(-) delete mode 100644 install-gsa-latest.yml create mode 100644 install-gsa.yml create mode 100644 uninstall-gsa.yml diff --git a/impact-testing.yml b/impact-testing.yml index 0cd823312..5eb342a59 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -65,9 +65,10 @@ stages: - powershell: | Write-Output "Running Unit Tests..." displayName: 'Run Unit Tests' - - template: install-gsa-latest.yml + - template: install-gsa.yml parameters: version: latest + - template: uninstall-gsa.yml - stage: ImpactTestingIntegration displayName: 'Impact Testing (Integration)' diff --git a/install-gsa-latest.yml b/install-gsa-latest.yml deleted file mode 100644 index a93595cc1..000000000 --- a/install-gsa-latest.yml +++ /dev/null @@ -1,12 +0,0 @@ -parameters: -- name: version - type: string - default: 'nightly' - -steps: -- powershell: | - Get-ChildItem *.msi -Recurse | Remove-Item - aws s3 cp s3://oasys-installer-store/GSA/${{ parameters.version }} . --exclude "*" --include *Arup*.msi --recursive - Get-ChildItem *.msi | Rename-Item -NewName gsa.msi - displayName: 'Download GSA nightly' - failOnStderr: true diff --git a/install-gsa.yml b/install-gsa.yml new file mode 100644 index 000000000..41eb8782f --- /dev/null +++ b/install-gsa.yml @@ -0,0 +1,12 @@ +parameters: +- name: version + type: string + default: 'nightly' + +steps: + - powershell: | + Get-ChildItem *.msi -Recurse | Remove-Item + aws s3 cp s3://oasys-installer-store/GSA/${{ parameters.version }} . --exclude "*" --include *Arup*.msi --recursive + Get-ChildItem *.msi | Rename-Item -NewName gsa.msi + displayName: 'Download GSA nightly' + failOnStderr: true diff --git a/uninstall-gsa.yml b/uninstall-gsa.yml new file mode 100644 index 000000000..a61fe673a --- /dev/null +++ b/uninstall-gsa.yml @@ -0,0 +1,20 @@ + +steps: + - powershell: | + $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) + Write-output "Installer Path: ${installerPath}" + $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait + $app.WaitForExit() + Write-Output "Exit code: $($app.ExitCode)" + Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" + + if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { + Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" + rm $installerPath + exit(0) + } else { + Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" + exit(1) + } + condition: always() + displayName: 'Uninstall Application' From 4dcc56ae463e6a8adbe48e0fbc004242f1c3dadc Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 18:13:58 +0100 Subject: [PATCH 17/80] ci: also install not just download --- install-gsa.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/install-gsa.yml b/install-gsa.yml index 41eb8782f..80bac466b 100644 --- a/install-gsa.yml +++ b/install-gsa.yml @@ -10,3 +10,38 @@ steps: Get-ChildItem *.msi | Rename-Item -NewName gsa.msi displayName: 'Download GSA nightly' failOnStderr: true + + - powershell: | + $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) + Write-output "Installer Path: ${installerPath}" + Write-output "GSA Version:" + if (!(Test-Path $installerPath.FullName)) { + Write-output "File '{0}' does not exist" -f $installerPath.FullName + } + try { + $WindowsInstaller = New-Object -com WindowsInstaller.Installer + $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) + $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" + $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) + $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null + $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) + $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) + Write-output $Version + } catch { + Write-output "Failed to get MSI file version: {0}." -f $_ + } + $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait + $app.WaitForExit() + Write-Output "Exit code: $($app.ExitCode)" + Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" + if ($app.ExitCode -ne 0) { + Write-Error "Application could not be installed. Error code $($app.ExitCode)" + exit(1) + } + displayName: 'Install GSA' + failOnStderr: true + + - powershell: | + & 'C:\Program Files\Oasys\*\GSA.exe' /Register + displayName: 'Register GSA COM' + failOnStderr: false From 2814ea57544908e1aebac4f30717f29f60ab80c3 Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 18:18:53 +0100 Subject: [PATCH 18/80] ci: identation mistake --- impact-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index 5eb342a59..309c2eece 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -20,7 +20,7 @@ stages: - checkout: none - powershell: | - Write-Output "Minimal checkout of repository...Branch:$(System.PullRequest.SourceBranch)" + Write-Output "Minimal checkout of repository...Branch:$(System.PullRequest.SourceBranch)" git clone --branch $(System.PullRequest.SourceBranch) --depth 100 --sparse https://$(GITHUB_TOKEN)@github.com/arup-group/GSA-Grasshopper.git . displayName: 'Minimal Checkout' env: From 6b0c865b8c17b1a9d4bce2f4d87910806ed6eebd Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 18:49:02 +0100 Subject: [PATCH 19/80] ci: pool rhino-compute --- impact-testing.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 309c2eece..0dd2ddfcc 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -7,14 +7,14 @@ variables: - group: s3PushInstallers - group: pipeline-tokens +pool: 'rhino-compute' + stages: - stage: CheckRepoChanges displayName: 'Check Repository Changes' jobs: - job: CheckChanges displayName: 'Check for Changes in GsaGH and IntegrationTests' - pool: - vmImage: 'windows-latest' steps: - checkout: none @@ -59,8 +59,6 @@ stages: jobs: - job: UnitTests displayName: 'Run Unit Tests' - pool: - vmImage: 'windows-latest' steps: - powershell: | Write-Output "Running Unit Tests..." @@ -77,8 +75,6 @@ stages: jobs: - job: IntegrationTests displayName: 'Run Integration Tests' - pool: - vmImage: 'windows-latest' steps: - powershell: | Write-Output "Running Integration Tests..." From 0705d44ef469fc30721b331359500b518f78745a Mon Sep 17 00:00:00 2001 From: spsarras Date: Thu, 17 Oct 2024 18:53:42 +0100 Subject: [PATCH 20/80] ci: first job can use the windows-latest --- impact-testing.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/impact-testing.yml b/impact-testing.yml index 0dd2ddfcc..ba9076e8b 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -12,6 +12,8 @@ pool: 'rhino-compute' stages: - stage: CheckRepoChanges displayName: 'Check Repository Changes' + pool: + vmImage: 'windows-latest' jobs: - job: CheckChanges displayName: 'Check for Changes in GsaGH and IntegrationTests' From 33faf9416816dbe883442a09562c176a9d6941ee Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 21:07:10 +0100 Subject: [PATCH 21/80] added build template for msbuild --- build-solution.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 build-solution.yml diff --git a/build-solution.yml b/build-solution.yml new file mode 100644 index 000000000..1e17719f8 --- /dev/null +++ b/build-solution.yml @@ -0,0 +1,26 @@ +parameters: +- name: solution + type: string +- name: configuration + type: string + default: Release + +steps: +- task: NuGetToolInstaller@1 + +- task: NuGetCommand@2 + displayName: 'Restoring NuGet packages' + inputs: + command: 'restore' + restoreSolution: '$(solution)' + +- task: VSBuild@1 + displayName: 'Building project in $(configuration)' + inputs: + solution: '$(solution)' + msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' + platform: 'x64' + configuration: '$(configuration)' + clean: true + env: + MSBUILDDISABLENODEREUSE: 1 From dab4c5054725fa57d241286edc4191957e5c09cd Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 21:12:53 +0100 Subject: [PATCH 22/80] call template for build --- impact-testing.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/impact-testing.yml b/impact-testing.yml index ba9076e8b..4293a8c02 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -68,6 +68,10 @@ stages: - template: install-gsa.yml parameters: version: latest + - template: build-solution.yml + parameters: + solution: gsa.sln + configuration: Release - template: uninstall-gsa.yml - stage: ImpactTestingIntegration From 2297dfe783f23775ff327415ef4c7d09687098a1 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 21:16:14 +0100 Subject: [PATCH 23/80] Update build-solution.yml --- build-solution.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-solution.yml b/build-solution.yml index 1e17719f8..101671d0b 100644 --- a/build-solution.yml +++ b/build-solution.yml @@ -20,7 +20,7 @@ steps: solution: '$(solution)' msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' platform: 'x64' - configuration: '$(configuration)' - clean: true + configuration: '$(configuration)' + clean: true env: MSBUILDDISABLENODEREUSE: 1 From 8ee972452b5aef71cd74825754186aaf7aaf6c1d Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 21:20:06 +0100 Subject: [PATCH 24/80] Update impact-testing.yml --- impact-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index 4293a8c02..be6736bc2 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -70,7 +70,7 @@ stages: version: latest - template: build-solution.yml parameters: - solution: gsa.sln + solution: GSA-Grasshopper/gsa.sln configuration: Release - template: uninstall-gsa.yml From 4b20a9abe1716258906a41012e92e120f9a9bdcf Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 21:39:25 +0100 Subject: [PATCH 25/80] ci: correct solution name --- impact-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index be6736bc2..418145666 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -70,7 +70,7 @@ stages: version: latest - template: build-solution.yml parameters: - solution: GSA-Grasshopper/gsa.sln + solution: GsaGH.sln configuration: Release - template: uninstall-gsa.yml From 02307ad793202d2368a80f1ebe579ad5440ff78e Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 22:00:20 +0100 Subject: [PATCH 26/80] Update impact-testing.yml --- impact-testing.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/impact-testing.yml b/impact-testing.yml index 418145666..d795a5140 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -65,9 +65,13 @@ stages: - powershell: | Write-Output "Running Unit Tests..." displayName: 'Run Unit Tests' + - template: install-gsa.yml parameters: version: latest + - powershell: | + dir + displayName: 'list dir' - template: build-solution.yml parameters: solution: GsaGH.sln From 61108e9743bc73457bd475d16b292dfbbe85440e Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 22:20:45 +0100 Subject: [PATCH 27/80] Update impact-testing.yml --- impact-testing.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index d795a5140..25fab0c7e 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -71,7 +71,18 @@ stages: version: latest - powershell: | dir - displayName: 'list dir' + displayName: 'list dir' + - task: VSBuild@1 + displayName: 'Building project in $(configuration)' + inputs: + solution: 'GsaGH.sln' + msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' + platform: 'x64' + configuration: Release + clean: true + env: + MSBUILDDISABLENODEREUSE: 1 + - template: build-solution.yml parameters: solution: GsaGH.sln From 83ab6ef50f1ea53e3a6cc89e83b81e396e4c42cc Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 22:22:09 +0100 Subject: [PATCH 28/80] Update impact-testing.yml --- impact-testing.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 25fab0c7e..a6694e7ce 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -73,15 +73,15 @@ stages: dir displayName: 'list dir' - task: VSBuild@1 - displayName: 'Building project in $(configuration)' - inputs: - solution: 'GsaGH.sln' - msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' - platform: 'x64' - configuration: Release - clean: true - env: - MSBUILDDISABLENODEREUSE: 1 + displayName: 'Building project in $(configuration)' + inputs: + solution: 'GsaGH.sln' + msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' + platform: 'x64' + configuration: Release + clean: true + env: + MSBUILDDISABLENODEREUSE: 1 - template: build-solution.yml parameters: From 68fbb2a79fcfdff58c756aab7bbecf0cfffdd382 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 22:27:10 +0100 Subject: [PATCH 29/80] Update impact-testing.yml --- impact-testing.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/impact-testing.yml b/impact-testing.yml index a6694e7ce..3a50082c5 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -72,6 +72,15 @@ stages: - powershell: | dir displayName: 'list dir' + + - task: NuGetToolInstaller@1 + + - task: NuGetCommand@2 + displayName: 'Restoring NuGet packages' + inputs: + command: 'restore' + restoreSolution: 'GsaGH.sln' + - task: VSBuild@1 displayName: 'Building project in $(configuration)' inputs: From fc5544989c603cb9839d280c286fec005b96ccb8 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 22:36:53 +0100 Subject: [PATCH 30/80] Update build-solution.yml --- build-solution.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-solution.yml b/build-solution.yml index 101671d0b..82aaf3e41 100644 --- a/build-solution.yml +++ b/build-solution.yml @@ -1,4 +1,7 @@ parameters: +- name: repoRoot + type: string + dedault: '' - name: solution type: string - name: configuration @@ -17,6 +20,7 @@ steps: - task: VSBuild@1 displayName: 'Building project in $(configuration)' inputs: + solution: '$(repoRoot)/$(solution)' solution: '$(solution)' msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' platform: 'x64' From 0b920328613f0f679a2b5c0502d1c58c4e0b85c4 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 22:38:15 +0100 Subject: [PATCH 31/80] adding repo root --- impact-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/impact-testing.yml b/impact-testing.yml index 3a50082c5..c5de7e579 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -94,6 +94,7 @@ stages: - template: build-solution.yml parameters: + repoRoot: GSA-Grasshopper solution: GsaGH.sln configuration: Release - template: uninstall-gsa.yml From 4e5ac39776681ad06da6b7a2146d4d352d94db17 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 22:39:42 +0100 Subject: [PATCH 32/80] Update build-solution.yml typo --- build-solution.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-solution.yml b/build-solution.yml index 82aaf3e41..8e3553b44 100644 --- a/build-solution.yml +++ b/build-solution.yml @@ -1,7 +1,7 @@ parameters: - name: repoRoot type: string - dedault: '' + default: '' - name: solution type: string - name: configuration From 4f234d62e203912317cc6dd7863ca0b78a4c72c8 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 22:41:46 +0100 Subject: [PATCH 33/80] Update build-solution.yml typo --- build-solution.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/build-solution.yml b/build-solution.yml index 8e3553b44..d7bb85986 100644 --- a/build-solution.yml +++ b/build-solution.yml @@ -21,7 +21,6 @@ steps: displayName: 'Building project in $(configuration)' inputs: solution: '$(repoRoot)/$(solution)' - solution: '$(solution)' msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' platform: 'x64' configuration: '$(configuration)' From b38c4ab6a2bb56ab76c7b80a2c4a707147735d04 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 22:49:07 +0100 Subject: [PATCH 34/80] Update build-solution.yml --- build-solution.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-solution.yml b/build-solution.yml index d7bb85986..68ec3e682 100644 --- a/build-solution.yml +++ b/build-solution.yml @@ -9,6 +9,10 @@ parameters: default: Release steps: +- powershell: | + dir + displayName: 'list dir' + - task: NuGetToolInstaller@1 - task: NuGetCommand@2 From 699f9413496e655182960ccdbe4059a22a314a31 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 22:59:00 +0100 Subject: [PATCH 35/80] Update impact-testing.yml --- impact-testing.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index c5de7e579..3a50082c5 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -94,7 +94,6 @@ stages: - template: build-solution.yml parameters: - repoRoot: GSA-Grasshopper solution: GsaGH.sln configuration: Release - template: uninstall-gsa.yml From 2cc63e05aaf93b19898890bd9b59a7d463d1a85b Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 23:14:36 +0100 Subject: [PATCH 36/80] Update impact-testing.yml --- impact-testing.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 3a50082c5..59c1c6175 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -94,8 +94,9 @@ stages: - template: build-solution.yml parameters: - solution: GsaGH.sln - configuration: Release + repoRoot: '.' + solution: 'GsaGH.sln' + configuration: 'Release' - template: uninstall-gsa.yml - stage: ImpactTestingIntegration From c9fb7fb8343145033946e9cd7832bc53091822d7 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 23:34:42 +0100 Subject: [PATCH 37/80] Checkout self --- impact-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/impact-testing.yml b/impact-testing.yml index 59c1c6175..54501008a 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -62,6 +62,7 @@ stages: - job: UnitTests displayName: 'Run Unit Tests' steps: + - checkout: self - powershell: | Write-Output "Running Unit Tests..." displayName: 'Run Unit Tests' From d539cf18146a579f3c761dcb99d5586e06f95353 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 23:40:31 +0100 Subject: [PATCH 38/80] different syntax for getting the solution --- build-solution.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-solution.yml b/build-solution.yml index 68ec3e682..80256e552 100644 --- a/build-solution.yml +++ b/build-solution.yml @@ -24,7 +24,7 @@ steps: - task: VSBuild@1 displayName: 'Building project in $(configuration)' inputs: - solution: '$(repoRoot)/$(solution)' + solution: ${{ parameters.solution }} msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' platform: 'x64' configuration: '$(configuration)' From 7d13f9a65cfcb3f8b82b0e86738803c7a5a83899 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 23:45:10 +0100 Subject: [PATCH 39/80] Change syntax everywhere --- build-solution.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build-solution.yml b/build-solution.yml index 80256e552..3359648d4 100644 --- a/build-solution.yml +++ b/build-solution.yml @@ -19,15 +19,15 @@ steps: displayName: 'Restoring NuGet packages' inputs: command: 'restore' - restoreSolution: '$(solution)' + restoreSolution: ${{ parameters.solution }} - task: VSBuild@1 - displayName: 'Building project in $(configuration)' + displayName: 'Building project in ${{ parameters.configuration }}' inputs: solution: ${{ parameters.solution }} msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' platform: 'x64' - configuration: '$(configuration)' + configuration: ${{ parameters.configuration }} clean: true env: MSBUILDDISABLENODEREUSE: 1 From d0559fb2a0f41403d89b756ef73b1b52ce9ba7fe Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 23:52:42 +0100 Subject: [PATCH 40/80] cleaned extra build --- impact-testing.yml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 54501008a..d17a3b9f7 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -70,32 +70,9 @@ stages: - template: install-gsa.yml parameters: version: latest - - powershell: | - dir - displayName: 'list dir' - - - task: NuGetToolInstaller@1 - - - task: NuGetCommand@2 - displayName: 'Restoring NuGet packages' - inputs: - command: 'restore' - restoreSolution: 'GsaGH.sln' - - - task: VSBuild@1 - displayName: 'Building project in $(configuration)' - inputs: - solution: 'GsaGH.sln' - msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' - platform: 'x64' - configuration: Release - clean: true - env: - MSBUILDDISABLENODEREUSE: 1 - template: build-solution.yml parameters: - repoRoot: '.' solution: 'GsaGH.sln' configuration: 'Release' - template: uninstall-gsa.yml From c8a75a6c1d4e7be9acd390b25b4bfcc282ae39be Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 17 Oct 2024 23:53:16 +0100 Subject: [PATCH 41/80] Removed repo root --- build-solution.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/build-solution.yml b/build-solution.yml index 3359648d4..2b9b375cf 100644 --- a/build-solution.yml +++ b/build-solution.yml @@ -1,7 +1,4 @@ parameters: -- name: repoRoot - type: string - default: '' - name: solution type: string - name: configuration From 24432e927a160babaa2c8fcc8398fd8bd411e41a Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 18 Oct 2024 23:13:59 +0100 Subject: [PATCH 42/80] added test run and artifacts upload --- impact-testing.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/impact-testing.yml b/impact-testing.yml index d17a3b9f7..e9d04683c 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -76,6 +76,25 @@ stages: solution: 'GsaGH.sln' configuration: 'Release' - template: uninstall-gsa.yml + + - task: VisualStudioTestPlatformInstaller@1 + displayName: 'Install Test Platform' + + - task: VSTest@3 + inputs: + testSelector: 'testAssemblies' # Enables Test Impact Analysis + testAssemblyVer2: | + GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll + searchFolder: '$(System.DefaultWorkingDirectory)' + runOnlyImpactedTests: true + runInParallel: true + failOnStderr: true + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' + ArtifactName: 'drop' + publishLocation: 'Container' - stage: ImpactTestingIntegration displayName: 'Impact Testing (Integration)' From 40270922e588078107a4c44415926af2bb62e02f Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Sat, 19 Oct 2024 12:06:14 +0100 Subject: [PATCH 43/80] Do not run in parallel --- impact-testing.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index e9d04683c..bbff058d1 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -87,10 +87,11 @@ stages: GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll searchFolder: '$(System.DefaultWorkingDirectory)' runOnlyImpactedTests: true - runInParallel: true + runInParallel: false failOnStderr: true - task: PublishBuildArtifacts@1 + condition: always() inputs: PathtoPublish: '$(Build.ArtifactStagingDirectory)' ArtifactName: 'drop' From 934358a3b7df222c5ac9fe5e50a38bf2cc0b90e2 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 24 Oct 2024 21:00:29 +0100 Subject: [PATCH 44/80] I install at the end --- impact-testing.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index bbff058d1..37e1ee31a 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -75,7 +75,6 @@ stages: parameters: solution: 'GsaGH.sln' configuration: 'Release' - - template: uninstall-gsa.yml - task: VisualStudioTestPlatformInstaller@1 displayName: 'Install Test Platform' @@ -97,6 +96,8 @@ stages: ArtifactName: 'drop' publishLocation: 'Container' + - template: uninstall-gsa.yml + - stage: ImpactTestingIntegration displayName: 'Impact Testing (Integration)' dependsOn: CheckRepoChanges From 0d7f31f014c1e896c7917bd5f91af5a061e5582d Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 24 Oct 2024 21:29:08 +0100 Subject: [PATCH 45/80] Added empty line --- GsaGH/Components/4_Analysis/CreateAnalysisTask.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs b/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs index 4481e4df9..128657550 100644 --- a/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs +++ b/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs @@ -449,6 +449,7 @@ private static bool HasDirectionFromString(out ResponseDirection responseDirecti switch (ghString.Trim().ToUpper()) { case "1": case "Z": + responseDirection = ResponseDirection.Z; break; From d63b6151004d0b205a65b91acca9920ae9f95477 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 24 Oct 2024 22:12:54 +0100 Subject: [PATCH 46/80] Introduced error --- GsaGH/Components/4_Analysis/CreateAnalysisTask.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs b/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs index 128657550..3ce5334ee 100644 --- a/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs +++ b/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs @@ -447,7 +447,7 @@ private static bool HasValidDirection(GH_ObjectWrapper ghDirection, out Response private static bool HasDirectionFromString(out ResponseDirection responseDirection, string ghString) { switch (ghString.Trim().ToUpper()) { - case "1": + case "5": case "Z": responseDirection = ResponseDirection.Z; From a65428c21fa632d6ca5b7d5c6b7f9d9f361fae9f Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Thu, 24 Oct 2024 23:23:53 +0100 Subject: [PATCH 47/80] Fixed error --- GsaGH/Components/4_Analysis/CreateAnalysisTask.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs b/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs index 3ce5334ee..4481e4df9 100644 --- a/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs +++ b/GsaGH/Components/4_Analysis/CreateAnalysisTask.cs @@ -447,9 +447,8 @@ private static bool HasValidDirection(GH_ObjectWrapper ghDirection, out Response private static bool HasDirectionFromString(out ResponseDirection responseDirection, string ghString) { switch (ghString.Trim().ToUpper()) { - case "5": + case "1": case "Z": - responseDirection = ResponseDirection.Z; break; From d95fa0eda6c8f0253fb652f7f124d214e67b9561 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 10:50:27 +0100 Subject: [PATCH 48/80] reconfigured VSTest@3 --- impact-testing.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index 37e1ee31a..97ced6f34 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -83,11 +83,13 @@ stages: inputs: testSelector: 'testAssemblies' # Enables Test Impact Analysis testAssemblyVer2: | - GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll + **\*Tests.dll + !**\obj\** searchFolder: '$(System.DefaultWorkingDirectory)' runOnlyImpactedTests: true runInParallel: false failOnStderr: true + codeCoverageEnabled: true - task: PublishBuildArtifacts@1 condition: always() From d4de3d4ec0394200d1083273e2201a8fc1e8c51b Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 11:42:55 +0100 Subject: [PATCH 49/80] specified the dll with its fullname --- impact-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index 97ced6f34..d0a1b76d4 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -83,7 +83,7 @@ stages: inputs: testSelector: 'testAssemblies' # Enables Test Impact Analysis testAssemblyVer2: | - **\*Tests.dll + **\GsaGHTests.dll !**\obj\** searchFolder: '$(System.DefaultWorkingDirectory)' runOnlyImpactedTests: true From 01dd600455e025a6ddf1f2f038be0bde245c0eb7 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 13:17:06 +0100 Subject: [PATCH 50/80] Specified again thoroughly the dll --- impact-testing.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index d0a1b76d4..4c050ae8d 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -83,8 +83,7 @@ stages: inputs: testSelector: 'testAssemblies' # Enables Test Impact Analysis testAssemblyVer2: | - **\GsaGHTests.dll - !**\obj\** + GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll searchFolder: '$(System.DefaultWorkingDirectory)' runOnlyImpactedTests: true runInParallel: false From 25309533c482c7daebe5322729ebe0e3e56731bb Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 15:33:26 +0100 Subject: [PATCH 51/80] changed publish to use a different dir, and VSTest verison 16 --- impact-testing.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 4c050ae8d..bf54b05a3 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -78,6 +78,7 @@ stages: - task: VisualStudioTestPlatformInstaller@1 displayName: 'Install Test Platform' + testPlatformVersion: '16.11.0' - task: VSTest@3 inputs: @@ -90,11 +91,11 @@ stages: failOnStderr: true codeCoverageEnabled: true - - task: PublishBuildArtifacts@1 + - task: PublishBuildArtifacts@2 condition: always() inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - ArtifactName: 'drop' + PathtoPublish: '$(System.DefaultWorkingDirectory)' + ArtifactName: 'Tests Results' publishLocation: 'Container' - template: uninstall-gsa.yml From 96ed9779562b158f89ea6ba82513205895618fd2 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 15:37:32 +0100 Subject: [PATCH 52/80] reworked the testplatform installer task --- impact-testing.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index bf54b05a3..ad3848ecc 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -78,9 +78,12 @@ stages: - task: VisualStudioTestPlatformInstaller@1 displayName: 'Install Test Platform' - testPlatformVersion: '16.11.0' + inputs: + packageFeedSelector: 'nugetOrg' + versionSelector: 'specificVersion' + testPlatformVersion: '16.11.0' - - task: VSTest@3 + - task: VSTest@2 inputs: testSelector: 'testAssemblies' # Enables Test Impact Analysis testAssemblyVer2: | From 50c7340b92187b77252de9d1764590580cda9a1c Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 15:40:34 +0100 Subject: [PATCH 53/80] downgraded publish artifacts --- impact-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index ad3848ecc..6bb49c03d 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -94,7 +94,7 @@ stages: failOnStderr: true codeCoverageEnabled: true - - task: PublishBuildArtifacts@2 + - task: PublishBuildArtifacts@1 condition: always() inputs: PathtoPublish: '$(System.DefaultWorkingDirectory)' From f3c4418af0202b0d1a4321a5bd678703a0c712b7 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 15:56:24 +0100 Subject: [PATCH 54/80] run in parallel? --- impact-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index 6bb49c03d..bd88a04ee 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -90,7 +90,7 @@ stages: GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll searchFolder: '$(System.DefaultWorkingDirectory)' runOnlyImpactedTests: true - runInParallel: false + runInParallel: true failOnStderr: true codeCoverageEnabled: true From f84669f5d9832e034561b842289e2548b8c46c1f Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 16:19:20 +0100 Subject: [PATCH 55/80] filter to make it faster and publish new location --- impact-testing.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index bd88a04ee..759af4261 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -93,11 +93,12 @@ stages: runInParallel: true failOnStderr: true codeCoverageEnabled: true + testFiltercriteria: "FullyQualifiedName=GsaGHTests.Components.Analysis.CreateAnalysisTaskTests" - task: PublishBuildArtifacts@1 condition: always() inputs: - PathtoPublish: '$(System.DefaultWorkingDirectory)' + PathtoPublish: '$(Agent.TempDirectory)\TestResults\**\*xml' ArtifactName: 'Tests Results' publishLocation: 'Container' From 1dbbc240b1873d10ded9ea16a9805781d14fa2c3 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 16:22:39 +0100 Subject: [PATCH 56/80] whole test folder --- impact-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index 759af4261..720bd8901 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -98,7 +98,7 @@ stages: - task: PublishBuildArtifacts@1 condition: always() inputs: - PathtoPublish: '$(Agent.TempDirectory)\TestResults\**\*xml' + PathtoPublish: '$(Agent.TempDirectory)\TestResults' ArtifactName: 'Tests Results' publishLocation: 'Container' From 026f3a093f5290f71ac9b390b4d84cff14fdc603 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 16:28:56 +0100 Subject: [PATCH 57/80] tweaked name of the filter --- impact-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index 720bd8901..a61ad8019 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -93,7 +93,7 @@ stages: runInParallel: true failOnStderr: true codeCoverageEnabled: true - testFiltercriteria: "FullyQualifiedName=GsaGHTests.Components.Analysis.CreateAnalysisTaskTests" + testFiltercriteria: "FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests.CreateAnalysisTest" - task: PublishBuildArtifacts@1 condition: always() From 5e8e050eb4ca8f12b1a2fc17f8dd795b839b8747 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 16:39:56 +0100 Subject: [PATCH 58/80] publish coverage --- impact-testing.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index a61ad8019..5c3b43460 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -98,10 +98,18 @@ stages: - task: PublishBuildArtifacts@1 condition: always() inputs: - PathtoPublish: '$(Agent.TempDirectory)\TestResults' + PathtoPublish: '$(Agent.TempDirectory)\TestResults\*.trx' ArtifactName: 'Tests Results' publishLocation: 'Container' + # Publish code coverage results v2 + # Publish any of the code coverage results from a build. + - task: PublishCodeCoverageResults@2 + inputs: + summaryFileLocation: '$(Agent.TempDirectory)\TestResults\*.trx' + #pathToSources: # string. Path to Source files. + #failIfCoverageEmpty: false # boolean. Fail if code coverage results are missing. Default: false. + - template: uninstall-gsa.yml - stage: ImpactTestingIntegration From e052a1b3a5d998bd3665c63e77eb13576abe2951 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 16:48:54 +0100 Subject: [PATCH 59/80] locate TRX file --- impact-testing.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 5c3b43460..8a3701986 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -93,20 +93,26 @@ stages: runInParallel: true failOnStderr: true codeCoverageEnabled: true - testFiltercriteria: "FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests.CreateAnalysisTest" - + testFiltercriteria: "FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests" + + - powershell: | + $coverage_file = (Resolve-Path $(Agent.TempDirectory)/TestResults/*.trx).Path + echo $coverage_file + displayName: 'Find TRX File' + - task: PublishBuildArtifacts@1 condition: always() inputs: - PathtoPublish: '$(Agent.TempDirectory)\TestResults\*.trx' + PathtoPublish: '$(Agent.TempDirectory)\TestResults' ArtifactName: 'Tests Results' publishLocation: 'Container' # Publish code coverage results v2 # Publish any of the code coverage results from a build. - task: PublishCodeCoverageResults@2 + condition: always() inputs: - summaryFileLocation: '$(Agent.TempDirectory)\TestResults\*.trx' + summaryFileLocation: $coverage_file #pathToSources: # string. Path to Source files. #failIfCoverageEmpty: false # boolean. Fail if code coverage results are missing. Default: false. From 55cffd2048f44db5605f724415588ad8b42e8391 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 16:53:47 +0100 Subject: [PATCH 60/80] added hint cobertura --- impact-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/impact-testing.yml b/impact-testing.yml index 8a3701986..9d347adb6 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -112,6 +112,7 @@ stages: - task: PublishCodeCoverageResults@2 condition: always() inputs: + codeCoverageTool: 'Cobertura' # 'JaCoCo' summaryFileLocation: $coverage_file #pathToSources: # string. Path to Source files. #failIfCoverageEmpty: false # boolean. Fail if code coverage results are missing. Default: false. From b990619d56f65d01d74bf7fa9322b653312164e0 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 17:17:17 +0100 Subject: [PATCH 61/80] Create .runsettings --- .runsettings | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .runsettings diff --git a/.runsettings b/.runsettings new file mode 100644 index 000000000..40f2cad7d --- /dev/null +++ b/.runsettings @@ -0,0 +1,81 @@ + + + 0 + 1000 + C:\a\_work\_temp\TestResults + + + + + + C:\a\_work\12\s + file + true + + + + + + + + .*\.dll$ + .*\.exe$ + + + .*CPPUnitTestFramework.* + + + + + ^Fabrikam\.UnitTest\..* + ^std::.* + ^ATL::.* + .*::__GetTestMethodInfo.* + ^Microsoft::VisualStudio::CppCodeCoverageFramework::.* + ^Microsoft::VisualStudio::CppUnitTestFramework::.* + + + + + ^System\.Diagnostics\.DebuggerHiddenAttribute$ + ^System\.Diagnostics\.DebuggerNonUserCodeAttribute$ + ^System\.Runtime\.CompilerServices\.CompilerGeneratedAttribute$ + ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$ + ^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$ + + + + + .*\\atlmfc\\.* + .*\\vctools\\.* + .*\\public\\sdk\\.* + .*\\microsoft sdks\\.* + .*\\vc\\include\\.* + + + + + .*microsoft.* + + + + + ^B77A5C561934E089$ + ^B03F5F7F11D50A3A$ + ^31BF3856AD364E35$ + ^89845DCD8080CC91$ + ^71E9BCE111E9429C$ + ^8F50407C4E9E73B6$ + ^E361AF139669C375$ + + + True + True + True + False + + + + + + From 6056d248ecafedd13393afc70b8c62b8e8ecfd0d Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 25 Oct 2024 17:29:39 +0100 Subject: [PATCH 62/80] feat: custom runsettings --- .runsettings | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.runsettings b/.runsettings index 40f2cad7d..1336ca2e7 100644 --- a/.runsettings +++ b/.runsettings @@ -6,14 +6,15 @@ - + C:\a\_work\12\s file true - + + From 3fb767358541d3019e20aa685d031e9c7d68f8ad Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 17:45:49 +0100 Subject: [PATCH 63/80] use Debug instead of Release --- impact-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 9d347adb6..27449684c 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -74,7 +74,7 @@ stages: - template: build-solution.yml parameters: solution: 'GsaGH.sln' - configuration: 'Release' + configuration: 'Debug' - task: VisualStudioTestPlatformInstaller@1 displayName: 'Install Test Platform' @@ -87,7 +87,7 @@ stages: inputs: testSelector: 'testAssemblies' # Enables Test Impact Analysis testAssemblyVer2: | - GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll + GsaGHTests\bin\x64\Debug\net48\GsaGHTests.dll searchFolder: '$(System.DefaultWorkingDirectory)' runOnlyImpactedTests: true runInParallel: true From fe8cc260bb11ea0db45fff030b0536933cc8fe21 Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 25 Oct 2024 17:53:52 +0100 Subject: [PATCH 64/80] feat: custom runsettings 2 --- .runsettings | 63 +++------------------------------------------------- 1 file changed, 3 insertions(+), 60 deletions(-) diff --git a/.runsettings b/.runsettings index 1336ca2e7..7f1fc06ff 100644 --- a/.runsettings +++ b/.runsettings @@ -2,74 +2,17 @@ 0 1000 - C:\a\_work\_temp\TestResults + TestResults - C:\a\_work\12\s + cobertura,opencover + .\CoverageOutput\ file true - - - - - - - - .*\.dll$ - .*\.exe$ - - - .*CPPUnitTestFramework.* - - - - - ^Fabrikam\.UnitTest\..* - ^std::.* - ^ATL::.* - .*::__GetTestMethodInfo.* - ^Microsoft::VisualStudio::CppCodeCoverageFramework::.* - ^Microsoft::VisualStudio::CppUnitTestFramework::.* - - - - - ^System\.Diagnostics\.DebuggerHiddenAttribute$ - ^System\.Diagnostics\.DebuggerNonUserCodeAttribute$ - ^System\.Runtime\.CompilerServices\.CompilerGeneratedAttribute$ - ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$ - ^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$ - - - - - .*\\atlmfc\\.* - .*\\vctools\\.* - .*\\public\\sdk\\.* - .*\\microsoft sdks\\.* - .*\\vc\\include\\.* - - - - - .*microsoft.* - - - - - ^B77A5C561934E089$ - ^B03F5F7F11D50A3A$ - ^31BF3856AD364E35$ - ^89845DCD8080CC91$ - ^71E9BCE111E9429C$ - ^8F50407C4E9E73B6$ - ^E361AF139669C375$ - - True True True From 8f2fcaf31a5f2b00ba91145686f7b959264ed196 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Fri, 25 Oct 2024 21:16:11 +0100 Subject: [PATCH 65/80] Added template for testing --- impact-testing.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/impact-testing.yml b/impact-testing.yml index 27449684c..e411efca0 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -116,6 +116,8 @@ stages: summaryFileLocation: $coverage_file #pathToSources: # string. Path to Source files. #failIfCoverageEmpty: false # boolean. Fail if code coverage results are missing. Default: false. + + - template: run-tests.yml - template: uninstall-gsa.yml From 84fc2abd79ccebee1f3a430f246018a48c85f013 Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 25 Oct 2024 22:16:51 +0100 Subject: [PATCH 66/80] feat: dotnet tests --- build-test-deploy.yml | 526 ++++++++++++++++----------------- dotnet-tests-with-coverage.yml | 55 ++++ impact-testing.yml | 12 +- 3 files changed, 324 insertions(+), 269 deletions(-) create mode 100644 dotnet-tests-with-coverage.yml diff --git a/build-test-deploy.yml b/build-test-deploy.yml index da3cf06a4..09b4e120e 100644 --- a/build-test-deploy.yml +++ b/build-test-deploy.yml @@ -1,263 +1,263 @@ -# # https://aka.ms/yaml -# -# trigger: -# branches: -# exclude: -# - 'task/GSAGH-555-new-pipeline' -# -# variables: -# - group: s3PushInstallers -# - group: pipeline-tokens -# - name: configuration -# value: Release -# -# pool: 'rhino-compute' -# -# steps: -# - powershell: | -# Get-ChildItem *.msi -Recurse | Remove-Item -# aws s3 cp s3://oasys-installer-store/GSA/latest . --exclude "*" --include *Arup*.msi --recursive -# Get-ChildItem *.msi | Rename-Item -NewName gsa.msi -# displayName: 'Download GSA latest' -# failOnStderr: true -# -# - powershell: | -# $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) -# Write-output "Installer Path: ${installerPath}" -# Write-output "GSA Version:" -# if (!(Test-Path $installerPath.FullName)) { -# Write-output "File '{0}' does not exist" -f $installerPath.FullName -# } -# try { -# $WindowsInstaller = New-Object -com WindowsInstaller.Installer -# $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) -# $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" -# $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) -# $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null -# $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) -# $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) -# Write-output $Version -# } catch { -# Write-output "Failed to get MSI file version: {0}." -f $_ -# } -# $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait -# $app.WaitForExit() -# Write-Output "Exit code: $($app.ExitCode)" -# Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" -# if ($app.ExitCode -ne 0) { -# Write-Error "Application could not be installed. Error code $($app.ExitCode)" -# exit(1) -# } -# displayName: 'Install GSA' -# failOnStderr: true -# -# - powershell: | -# & 'C:\Program Files\Oasys\*\GSA.exe' /Register -# displayName: 'Register GSA COM' -# failOnStderr: false -# -# - powershell: | -# ./cleanRegistry.ps1 -# displayName: 'Run Registry Cleaner' -# failOnStderr: true -# -# - task: NuGetToolInstaller@1 -# -# - task: NuGetCommand@2 -# displayName: 'Restoring NuGet packages' -# inputs: -# command: 'restore' -# restoreSolution: 'GsaGH.sln' -# -# - task: VSBuild@1 -# displayName: 'Building project in $(configuration)' -# inputs: -# solution: 'GsaGH.sln' -# msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' -# platform: 'x64' -# configuration: '$(configuration)' -# clean: true -# env: -# MSBUILDDISABLENODEREUSE: 1 -# -# - powershell: | -# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll -# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll -# displayName: dotnet tests -# failOnStderr: true -# -# - powershell: | -# if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { -# Write-Output "codecov.yml is invalid" -# Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post -# exit(1) -# } else { -# Write-Output "codecov.yml is valid" -# } -# displayName: Validate codecov.yml -# failOnStderr: true -# -# - powershell: | -# $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path -# echo $coverage_file_gsagh -# $coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path -# echo $coverage_file_integration -# Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml -# Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml -# $ProgressPreference = 'SilentlyContinue' -# Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe -# ls $(System.DefaultWorkingDirectory)\ -# cd $(System.DefaultWorkingDirectory)\ -# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh -# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration -# env: -# CODECOV_TOKEN: $(CODECOV_TOKEN) -# displayName: Upload Code Coverage to codecovio -# failOnStderr: true -# -# - task: PublishCodeCoverageResults@1 -# displayName: Create Azure GsaGH CodeCoverage -# inputs: -# codeCoverageTool: 'cobertura' -# summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/gsagh/**/coverage.cobertura.xml' -# pathToSources: '$(System.DefaultWorkingDirectory)' -# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) -# -# - task: PublishCodeCoverageResults@1 -# displayName: Create Azure IntegrationTest CodeCoverage -# inputs: -# codeCoverageTool: 'cobertura' -# summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/integration/**/coverage.cobertura.xml' -# pathToSources: '$(System.DefaultWorkingDirectory)' -# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) -# -# - publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml -# displayName: Publish GsaGHTest xml to Azure -# artifact: GsaGHTestsCoverage -# continueOnError: true -# -# - publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml -# displayName: Publish IntegrationTest xml to Azure -# artifact: IntegrationTestsCoverage -# continueOnError: true -# -# - task: PowerShell@2 -# displayName: Check for existing tags -# inputs: -# targetType: 'inline' -# script: | -# $versionInfo = $(Get-Item .\GsaGH\bin\x64\Release\net48\GsaGH.dll).VersionInfo -# echo $versionInfo -# $fullVersion = [array]${versionInfo}.FileVersion.split('.') -# $currentTime = $(Get-Date -Format "dddd MM/dd/yyyy HH:mm") -# $majorVersion = [string]$fullVersion[0] -# $minorVersion = [string]$fullVersion[1] -# $spVersion = [string]$fullVersion[2] -# $buildNumber = [string]$fullVersion[3] -# -# $tag = [array]@($exeName,$majorVersion,$minorVersion,$spVersion,$buildNumber) -# $tagNumbersOnly = [array]@($majorVersion,$minorVersion,$spVersion,$buildNumber) -# -# $dotSeparatedTag = $majorVersion + "." + $minorVersion + "." + $spVersion -# $underscoreSeparatedTag = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber -# $tagNumbersOnlyUnderscore = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber -# $tagNumbersOnlydot = $majorVersion + "." + $minorVersion + "." + $spVersion + "." + $buildNumber -# -# Write-Host ("##vso[task.setvariable variable=dotSeparatedTag]$dotSeparatedTag") -# git rev-parse $dotSeparatedTag -# if($lastExitCode -eq 0){Write-Host ("##vso[task.setvariable variable=TAG_EXISTS]true")} -# if($lastExitCode -eq 0){ -# $tagExists = 'true' -# echo $tagExists -# } -# errorActionPreference: 'continue' -# workingDirectory: '$(System.DefaultWorkingDirectory)' -# ignoreLASTEXITCODE: true -# -# - powershell: | -# cd GsaGH\bin\x64\Release -# curl https://files.mcneel.com/yak/tools/latest/yak.exe -o yak.exe -# .\yak version -# cd net48 -# ..\yak spec -# Add-Content manifest.yml 'icon: GsaIcon.png' -# Add-Content manifest.yml 'keywords:' -# Add-Content manifest.yml '- oasys' -# Add-Content manifest.yml '- gsa' -# Add-Content manifest.yml '- gsagh' -# Add-Content manifest.yml '- fe' -# Add-Content manifest.yml '- fea' -# Add-Content manifest.yml '- fem' -# Add-Content manifest.yml '- structural' -# Add-Content manifest.yml '- structuralanalysis' -# ..\yak build --platform win -# $yakCurrentVersName = Get-ChildItem -Path . -Filter "*.yak" -# $yakRh7Name = $yakCurrentVersName -Replace "rh6_27", "rh7_0" -# Rename-Item -Path $yakCurrentVersName -NewName $yakRh7Name -# ..\yak build --platform win -# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) -# displayName: Package yak -# -# - powershell: | -# cd GsaGH -# & 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe' GsaGH.csproj /t:pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:DebugType=portable /property:Configuration=Debug -# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) -# displayName: Package NuGet -# -# - powershell: | -# .\DocsGeneration\bin\x64\Debug\net48\DocsGeneration.exe -# Compress-Archive -Path .\Output -DestinationPath .\results\$(dotSeparatedTag)-docs.zip -Force -# displayName: Generate docs site -# failOnStderr: true -# -# - publish: $(System.DefaultWorkingDirectory)\results\$(dotSeparatedTag)-docs.zip -# displayName: Publish Docs artifact -# artifact: Docs -# continueOnError: false -# -# - task: GitHubRelease@1 -# displayName: 'Publishing assets to Github' -# inputs: -# gitHubConnection: 'github.com_MJCramp' -# repositoryName: 'arup-group/GSA-Grasshopper' -# action: 'edit' -# target: '$(Build.SourceVersion)' -# tag: '$(dotSeparatedTag)' -# title: 'GsaGH version $(dotSeparatedTag)' -# releaseNotesSource: 'inline' -# releaseNotesInline: | -# Created from commit https://github.com/arup-group/GSA-Grasshopper/commit/$(Build.SourceVersion) -# assets: | -# $(System.DefaultWorkingDirectory)/**/*.yak -# $(System.DefaultWorkingDirectory)/**/*.nupkg -# $(System.DefaultWorkingDirectory)/**/*.snupkg -# $(System.DefaultWorkingDirectory)/**/$(dotSeparatedTag)-docs.zip -# assetUploadMode: 'replace' -# isDraft: true -# isPreRelease: false -# addChangeLog: false -# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) -# -# - powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink -# displayName: 'Delete orphan .ghlink files' -# condition: always() -# -# - powershell: | -# $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) -# Write-output "Installer Path: ${installerPath}" -# $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait -# $app.WaitForExit() -# Write-Output "Exit code: $($app.ExitCode)" -# Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" -# ### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED -# ### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes -# if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { -# Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" -# rm $installerPath -# exit(0) -# } else { -# Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" -# exit(1) -# } -# condition: always() -# displayName: 'Uninstall Application' + # https://aka.ms/yaml + + trigger: + branches: + exclude: + - 'task/GSAGH-555-new-pipeline' + + variables: + - group: s3PushInstallers + - group: pipeline-tokens + - name: configuration + value: Release + + pool: 'rhino-compute' + + steps: + - powershell: | + Get-ChildItem *.msi -Recurse | Remove-Item + aws s3 cp s3://oasys-installer-store/GSA/latest . --exclude "*" --include *Arup*.msi --recursive + Get-ChildItem *.msi | Rename-Item -NewName gsa.msi + displayName: 'Download GSA latest' + failOnStderr: true + + - powershell: | + $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) + Write-output "Installer Path: ${installerPath}" + Write-output "GSA Version:" + if (!(Test-Path $installerPath.FullName)) { + Write-output "File '{0}' does not exist" -f $installerPath.FullName + } + try { + $WindowsInstaller = New-Object -com WindowsInstaller.Installer + $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) + $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" + $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) + $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null + $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) + $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) + Write-output $Version + } catch { + Write-output "Failed to get MSI file version: {0}." -f $_ + } + $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait + $app.WaitForExit() + Write-Output "Exit code: $($app.ExitCode)" + Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" + if ($app.ExitCode -ne 0) { + Write-Error "Application could not be installed. Error code $($app.ExitCode)" + exit(1) + } + displayName: 'Install GSA' + failOnStderr: true + + - powershell: | + & 'C:\Program Files\Oasys\*\GSA.exe' /Register + displayName: 'Register GSA COM' + failOnStderr: false + + - powershell: | + ./cleanRegistry.ps1 + displayName: 'Run Registry Cleaner' + failOnStderr: true + + - task: NuGetToolInstaller@1 + + - task: NuGetCommand@2 + displayName: 'Restoring NuGet packages' + inputs: + command: 'restore' + restoreSolution: 'GsaGH.sln' + + - task: VSBuild@1 + displayName: 'Building project in $(configuration)' + inputs: + solution: 'GsaGH.sln' + msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' + platform: 'x64' + configuration: '$(configuration)' + clean: true + env: + MSBUILDDISABLENODEREUSE: 1 + + - powershell: | + dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll + dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll + displayName: dotnet tests + failOnStderr: true + + - powershell: | + if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { + Write-Output "codecov.yml is invalid" + Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post + exit(1) + } else { + Write-Output "codecov.yml is valid" + } + displayName: Validate codecov.yml + failOnStderr: true + + - powershell: | + $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path + echo $coverage_file_gsagh + $coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path + echo $coverage_file_integration + Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml + Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml + $ProgressPreference = 'SilentlyContinue' + Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe + ls $(System.DefaultWorkingDirectory)\ + cd $(System.DefaultWorkingDirectory)\ + .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh + .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration + env: + CODECOV_TOKEN: $(CODECOV_TOKEN) + displayName: Upload Code Coverage to codecovio + failOnStderr: true + + - task: PublishCodeCoverageResults@1 + displayName: Create Azure GsaGH CodeCoverage + inputs: + codeCoverageTool: 'cobertura' + summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/gsagh/**/coverage.cobertura.xml' + pathToSources: '$(System.DefaultWorkingDirectory)' + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) + + - task: PublishCodeCoverageResults@1 + displayName: Create Azure IntegrationTest CodeCoverage + inputs: + codeCoverageTool: 'cobertura' + summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/integration/**/coverage.cobertura.xml' + pathToSources: '$(System.DefaultWorkingDirectory)' + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) + + - publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml + displayName: Publish GsaGHTest xml to Azure + artifact: GsaGHTestsCoverage + continueOnError: true + + - publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml + displayName: Publish IntegrationTest xml to Azure + artifact: IntegrationTestsCoverage + continueOnError: true + + - task: PowerShell@2 + displayName: Check for existing tags + inputs: + targetType: 'inline' + script: | + $versionInfo = $(Get-Item .\GsaGH\bin\x64\Release\net48\GsaGH.dll).VersionInfo + echo $versionInfo + $fullVersion = [array]${versionInfo}.FileVersion.split('.') + $currentTime = $(Get-Date -Format "dddd MM/dd/yyyy HH:mm") + $majorVersion = [string]$fullVersion[0] + $minorVersion = [string]$fullVersion[1] + $spVersion = [string]$fullVersion[2] + $buildNumber = [string]$fullVersion[3] + + $tag = [array]@($exeName,$majorVersion,$minorVersion,$spVersion,$buildNumber) + $tagNumbersOnly = [array]@($majorVersion,$minorVersion,$spVersion,$buildNumber) + + $dotSeparatedTag = $majorVersion + "." + $minorVersion + "." + $spVersion + $underscoreSeparatedTag = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber + $tagNumbersOnlyUnderscore = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber + $tagNumbersOnlydot = $majorVersion + "." + $minorVersion + "." + $spVersion + "." + $buildNumber + + Write-Host ("##vso[task.setvariable variable=dotSeparatedTag]$dotSeparatedTag") + git rev-parse $dotSeparatedTag + if($lastExitCode -eq 0){Write-Host ("##vso[task.setvariable variable=TAG_EXISTS]true")} + if($lastExitCode -eq 0){ + $tagExists = 'true' + echo $tagExists + } + errorActionPreference: 'continue' + workingDirectory: '$(System.DefaultWorkingDirectory)' + ignoreLASTEXITCODE: true + + - powershell: | + cd GsaGH\bin\x64\Release + curl https://files.mcneel.com/yak/tools/latest/yak.exe -o yak.exe + .\yak version + cd net48 + ..\yak spec + Add-Content manifest.yml 'icon: GsaIcon.png' + Add-Content manifest.yml 'keywords:' + Add-Content manifest.yml '- oasys' + Add-Content manifest.yml '- gsa' + Add-Content manifest.yml '- gsagh' + Add-Content manifest.yml '- fe' + Add-Content manifest.yml '- fea' + Add-Content manifest.yml '- fem' + Add-Content manifest.yml '- structural' + Add-Content manifest.yml '- structuralanalysis' + ..\yak build --platform win + $yakCurrentVersName = Get-ChildItem -Path . -Filter "*.yak" + $yakRh7Name = $yakCurrentVersName -Replace "rh6_27", "rh7_0" + Rename-Item -Path $yakCurrentVersName -NewName $yakRh7Name + ..\yak build --platform win + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) + displayName: Package yak + + - powershell: | + cd GsaGH + & 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe' GsaGH.csproj /t:pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:DebugType=portable /property:Configuration=Debug + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) + displayName: Package NuGet + + - powershell: | + .\DocsGeneration\bin\x64\Debug\net48\DocsGeneration.exe + Compress-Archive -Path .\Output -DestinationPath .\results\$(dotSeparatedTag)-docs.zip -Force + displayName: Generate docs site + failOnStderr: true + + - publish: $(System.DefaultWorkingDirectory)\results\$(dotSeparatedTag)-docs.zip + displayName: Publish Docs artifact + artifact: Docs + continueOnError: false + + - task: GitHubRelease@1 + displayName: 'Publishing assets to Github' + inputs: + gitHubConnection: 'github.com_MJCramp' + repositoryName: 'arup-group/GSA-Grasshopper' + action: 'edit' + target: '$(Build.SourceVersion)' + tag: '$(dotSeparatedTag)' + title: 'GsaGH version $(dotSeparatedTag)' + releaseNotesSource: 'inline' + releaseNotesInline: | + Created from commit https://github.com/arup-group/GSA-Grasshopper/commit/$(Build.SourceVersion) + assets: | + $(System.DefaultWorkingDirectory)/**/*.yak + $(System.DefaultWorkingDirectory)/**/*.nupkg + $(System.DefaultWorkingDirectory)/**/*.snupkg + $(System.DefaultWorkingDirectory)/**/$(dotSeparatedTag)-docs.zip + assetUploadMode: 'replace' + isDraft: true + isPreRelease: false + addChangeLog: false + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) + + - powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink + displayName: 'Delete orphan .ghlink files' + condition: always() + + - powershell: | + $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) + Write-output "Installer Path: ${installerPath}" + $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait + $app.WaitForExit() + Write-Output "Exit code: $($app.ExitCode)" + Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" + ### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED + ### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes + if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { + Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" + rm $installerPath + exit(0) + } else { + Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" + exit(1) + } + condition: always() + displayName: 'Uninstall Application' diff --git a/dotnet-tests-with-coverage.yml b/dotnet-tests-with-coverage.yml new file mode 100644 index 000000000..7328bc557 --- /dev/null +++ b/dotnet-tests-with-coverage.yml @@ -0,0 +1,55 @@ +parameters: + - name: dllName + type: string + default: 'GsaGHTests' + - name: configuration + type: string + default: Release + +steps: + - powershell: | + $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\${{ dllName }}\bin\**\${{ configuration }}\${{ dllName }}.dll").FullName + displayName: 'Find dll file' + + - powershell: | + dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\${{ dllName }} $dllFile --filter FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests + displayName: dotnet tests + failOnStderr: true + + - powershell: | + if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { + Write-Output "codecov.yml is invalid" + Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post + exit(1) + } else { + Write-Output "codecov.yml is valid" + } + displayName: Validate codecov.yml + failOnStderr: true + + - powershell: | + $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path + echo $coverage_file_gsagh + Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_${{ dllName }}.xml + $ProgressPreference = 'SilentlyContinue' + Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe + ls $(System.DefaultWorkingDirectory)\ + cd $(System.DefaultWorkingDirectory)\ + .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_${{ dllName }}.xml -F {{ dllName }} + env: + CODECOV_TOKEN: $(CODECOV_TOKEN) + displayName: Upload Code Coverage to codecovio + failOnStderr: true + + - task: PublishCodeCoverageResults@1 + displayName: Create Azure ${{ dllName }} CodeCoverage + inputs: + codeCoverageTool: 'cobertura' + summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/${{ dllName }}/**/coverage.cobertura.xml' + pathToSources: '$(System.DefaultWorkingDirectory)' + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) + + - publish: $(System.DefaultWorkingDirectory)\results\coverage_${{ dllName }}.xml + displayName: Publish GsaGHTest xml to Azure + artifact: ${{ dllName }}TestsCoverage + continueOnError: true diff --git a/impact-testing.yml b/impact-testing.yml index e411efca0..2c225bbac 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -70,12 +70,12 @@ stages: - template: install-gsa.yml parameters: version: latest - + - template: build-solution.yml parameters: solution: 'GsaGH.sln' configuration: 'Debug' - + - task: VisualStudioTestPlatformInstaller@1 displayName: 'Install Test Platform' inputs: @@ -99,7 +99,7 @@ stages: $coverage_file = (Resolve-Path $(Agent.TempDirectory)/TestResults/*.trx).Path echo $coverage_file displayName: 'Find TRX File' - + - task: PublishBuildArtifacts@1 condition: always() inputs: @@ -114,10 +114,10 @@ stages: inputs: codeCoverageTool: 'Cobertura' # 'JaCoCo' summaryFileLocation: $coverage_file - #pathToSources: # string. Path to Source files. + #pathToSources: # string. Path to Source files. #failIfCoverageEmpty: false # boolean. Fail if code coverage results are missing. Default: false. - - - template: run-tests.yml + + - template: dotnet-tests-with-coverage.yml - template: uninstall-gsa.yml From e6e175506a475b142165cec60b809a42669cdf1f Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 25 Oct 2024 22:24:03 +0100 Subject: [PATCH 67/80] feat: made sure we use parameters for inputs --- dotnet-tests-with-coverage.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dotnet-tests-with-coverage.yml b/dotnet-tests-with-coverage.yml index 7328bc557..c27cb0d85 100644 --- a/dotnet-tests-with-coverage.yml +++ b/dotnet-tests-with-coverage.yml @@ -8,11 +8,13 @@ parameters: steps: - powershell: | - $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\${{ dllName }}\bin\**\${{ configuration }}\${{ dllName }}.dll").FullName + $name = $ {{ parameters.dllName }} + - powershell: | + $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\$name\bin\**\${{ parameters.configuration }}\$name.dll").FullName displayName: 'Find dll file' - powershell: | - dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\${{ dllName }} $dllFile --filter FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests + dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\$name $dllFile --filter FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests displayName: dotnet tests failOnStderr: true @@ -30,26 +32,26 @@ steps: - powershell: | $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path echo $coverage_file_gsagh - Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_${{ dllName }}.xml + Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_$name.xml $ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe ls $(System.DefaultWorkingDirectory)\ cd $(System.DefaultWorkingDirectory)\ - .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_${{ dllName }}.xml -F {{ dllName }} + .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_$name.xml -F $name env: CODECOV_TOKEN: $(CODECOV_TOKEN) displayName: Upload Code Coverage to codecovio failOnStderr: true - task: PublishCodeCoverageResults@1 - displayName: Create Azure ${{ dllName }} CodeCoverage + displayName: Create Azure $name CodeCoverage inputs: codeCoverageTool: 'cobertura' - summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/${{ dllName }}/**/coverage.cobertura.xml' + summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/$name/**/coverage.cobertura.xml' pathToSources: '$(System.DefaultWorkingDirectory)' condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) - - publish: $(System.DefaultWorkingDirectory)\results\coverage_${{ dllName }}.xml + - publish: $(System.DefaultWorkingDirectory)\results\coverage_$name.xml displayName: Publish GsaGHTest xml to Azure - artifact: ${{ dllName }}TestsCoverage + artifact: $nameTestsCoverage continueOnError: true From 086f2683264f399f032ebddbd08e2860a9855d3f Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 25 Oct 2024 22:35:25 +0100 Subject: [PATCH 68/80] feat: disabled nightly --- build-test-deploy.yml | 526 +++++++++++++++++++++--------------------- 1 file changed, 263 insertions(+), 263 deletions(-) diff --git a/build-test-deploy.yml b/build-test-deploy.yml index 09b4e120e..da3cf06a4 100644 --- a/build-test-deploy.yml +++ b/build-test-deploy.yml @@ -1,263 +1,263 @@ - # https://aka.ms/yaml - - trigger: - branches: - exclude: - - 'task/GSAGH-555-new-pipeline' - - variables: - - group: s3PushInstallers - - group: pipeline-tokens - - name: configuration - value: Release - - pool: 'rhino-compute' - - steps: - - powershell: | - Get-ChildItem *.msi -Recurse | Remove-Item - aws s3 cp s3://oasys-installer-store/GSA/latest . --exclude "*" --include *Arup*.msi --recursive - Get-ChildItem *.msi | Rename-Item -NewName gsa.msi - displayName: 'Download GSA latest' - failOnStderr: true - - - powershell: | - $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) - Write-output "Installer Path: ${installerPath}" - Write-output "GSA Version:" - if (!(Test-Path $installerPath.FullName)) { - Write-output "File '{0}' does not exist" -f $installerPath.FullName - } - try { - $WindowsInstaller = New-Object -com WindowsInstaller.Installer - $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) - $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" - $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) - $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null - $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) - $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) - Write-output $Version - } catch { - Write-output "Failed to get MSI file version: {0}." -f $_ - } - $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait - $app.WaitForExit() - Write-Output "Exit code: $($app.ExitCode)" - Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" - if ($app.ExitCode -ne 0) { - Write-Error "Application could not be installed. Error code $($app.ExitCode)" - exit(1) - } - displayName: 'Install GSA' - failOnStderr: true - - - powershell: | - & 'C:\Program Files\Oasys\*\GSA.exe' /Register - displayName: 'Register GSA COM' - failOnStderr: false - - - powershell: | - ./cleanRegistry.ps1 - displayName: 'Run Registry Cleaner' - failOnStderr: true - - - task: NuGetToolInstaller@1 - - - task: NuGetCommand@2 - displayName: 'Restoring NuGet packages' - inputs: - command: 'restore' - restoreSolution: 'GsaGH.sln' - - - task: VSBuild@1 - displayName: 'Building project in $(configuration)' - inputs: - solution: 'GsaGH.sln' - msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' - platform: 'x64' - configuration: '$(configuration)' - clean: true - env: - MSBUILDDISABLENODEREUSE: 1 - - - powershell: | - dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll - dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll - displayName: dotnet tests - failOnStderr: true - - - powershell: | - if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { - Write-Output "codecov.yml is invalid" - Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post - exit(1) - } else { - Write-Output "codecov.yml is valid" - } - displayName: Validate codecov.yml - failOnStderr: true - - - powershell: | - $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path - echo $coverage_file_gsagh - $coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path - echo $coverage_file_integration - Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml - Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml - $ProgressPreference = 'SilentlyContinue' - Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe - ls $(System.DefaultWorkingDirectory)\ - cd $(System.DefaultWorkingDirectory)\ - .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh - .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration - env: - CODECOV_TOKEN: $(CODECOV_TOKEN) - displayName: Upload Code Coverage to codecovio - failOnStderr: true - - - task: PublishCodeCoverageResults@1 - displayName: Create Azure GsaGH CodeCoverage - inputs: - codeCoverageTool: 'cobertura' - summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/gsagh/**/coverage.cobertura.xml' - pathToSources: '$(System.DefaultWorkingDirectory)' - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) - - - task: PublishCodeCoverageResults@1 - displayName: Create Azure IntegrationTest CodeCoverage - inputs: - codeCoverageTool: 'cobertura' - summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/integration/**/coverage.cobertura.xml' - pathToSources: '$(System.DefaultWorkingDirectory)' - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) - - - publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml - displayName: Publish GsaGHTest xml to Azure - artifact: GsaGHTestsCoverage - continueOnError: true - - - publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml - displayName: Publish IntegrationTest xml to Azure - artifact: IntegrationTestsCoverage - continueOnError: true - - - task: PowerShell@2 - displayName: Check for existing tags - inputs: - targetType: 'inline' - script: | - $versionInfo = $(Get-Item .\GsaGH\bin\x64\Release\net48\GsaGH.dll).VersionInfo - echo $versionInfo - $fullVersion = [array]${versionInfo}.FileVersion.split('.') - $currentTime = $(Get-Date -Format "dddd MM/dd/yyyy HH:mm") - $majorVersion = [string]$fullVersion[0] - $minorVersion = [string]$fullVersion[1] - $spVersion = [string]$fullVersion[2] - $buildNumber = [string]$fullVersion[3] - - $tag = [array]@($exeName,$majorVersion,$minorVersion,$spVersion,$buildNumber) - $tagNumbersOnly = [array]@($majorVersion,$minorVersion,$spVersion,$buildNumber) - - $dotSeparatedTag = $majorVersion + "." + $minorVersion + "." + $spVersion - $underscoreSeparatedTag = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber - $tagNumbersOnlyUnderscore = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber - $tagNumbersOnlydot = $majorVersion + "." + $minorVersion + "." + $spVersion + "." + $buildNumber - - Write-Host ("##vso[task.setvariable variable=dotSeparatedTag]$dotSeparatedTag") - git rev-parse $dotSeparatedTag - if($lastExitCode -eq 0){Write-Host ("##vso[task.setvariable variable=TAG_EXISTS]true")} - if($lastExitCode -eq 0){ - $tagExists = 'true' - echo $tagExists - } - errorActionPreference: 'continue' - workingDirectory: '$(System.DefaultWorkingDirectory)' - ignoreLASTEXITCODE: true - - - powershell: | - cd GsaGH\bin\x64\Release - curl https://files.mcneel.com/yak/tools/latest/yak.exe -o yak.exe - .\yak version - cd net48 - ..\yak spec - Add-Content manifest.yml 'icon: GsaIcon.png' - Add-Content manifest.yml 'keywords:' - Add-Content manifest.yml '- oasys' - Add-Content manifest.yml '- gsa' - Add-Content manifest.yml '- gsagh' - Add-Content manifest.yml '- fe' - Add-Content manifest.yml '- fea' - Add-Content manifest.yml '- fem' - Add-Content manifest.yml '- structural' - Add-Content manifest.yml '- structuralanalysis' - ..\yak build --platform win - $yakCurrentVersName = Get-ChildItem -Path . -Filter "*.yak" - $yakRh7Name = $yakCurrentVersName -Replace "rh6_27", "rh7_0" - Rename-Item -Path $yakCurrentVersName -NewName $yakRh7Name - ..\yak build --platform win - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) - displayName: Package yak - - - powershell: | - cd GsaGH - & 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe' GsaGH.csproj /t:pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:DebugType=portable /property:Configuration=Debug - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) - displayName: Package NuGet - - - powershell: | - .\DocsGeneration\bin\x64\Debug\net48\DocsGeneration.exe - Compress-Archive -Path .\Output -DestinationPath .\results\$(dotSeparatedTag)-docs.zip -Force - displayName: Generate docs site - failOnStderr: true - - - publish: $(System.DefaultWorkingDirectory)\results\$(dotSeparatedTag)-docs.zip - displayName: Publish Docs artifact - artifact: Docs - continueOnError: false - - - task: GitHubRelease@1 - displayName: 'Publishing assets to Github' - inputs: - gitHubConnection: 'github.com_MJCramp' - repositoryName: 'arup-group/GSA-Grasshopper' - action: 'edit' - target: '$(Build.SourceVersion)' - tag: '$(dotSeparatedTag)' - title: 'GsaGH version $(dotSeparatedTag)' - releaseNotesSource: 'inline' - releaseNotesInline: | - Created from commit https://github.com/arup-group/GSA-Grasshopper/commit/$(Build.SourceVersion) - assets: | - $(System.DefaultWorkingDirectory)/**/*.yak - $(System.DefaultWorkingDirectory)/**/*.nupkg - $(System.DefaultWorkingDirectory)/**/*.snupkg - $(System.DefaultWorkingDirectory)/**/$(dotSeparatedTag)-docs.zip - assetUploadMode: 'replace' - isDraft: true - isPreRelease: false - addChangeLog: false - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) - - - powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink - displayName: 'Delete orphan .ghlink files' - condition: always() - - - powershell: | - $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) - Write-output "Installer Path: ${installerPath}" - $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait - $app.WaitForExit() - Write-Output "Exit code: $($app.ExitCode)" - Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" - ### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED - ### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes - if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { - Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" - rm $installerPath - exit(0) - } else { - Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" - exit(1) - } - condition: always() - displayName: 'Uninstall Application' +# # https://aka.ms/yaml +# +# trigger: +# branches: +# exclude: +# - 'task/GSAGH-555-new-pipeline' +# +# variables: +# - group: s3PushInstallers +# - group: pipeline-tokens +# - name: configuration +# value: Release +# +# pool: 'rhino-compute' +# +# steps: +# - powershell: | +# Get-ChildItem *.msi -Recurse | Remove-Item +# aws s3 cp s3://oasys-installer-store/GSA/latest . --exclude "*" --include *Arup*.msi --recursive +# Get-ChildItem *.msi | Rename-Item -NewName gsa.msi +# displayName: 'Download GSA latest' +# failOnStderr: true +# +# - powershell: | +# $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) +# Write-output "Installer Path: ${installerPath}" +# Write-output "GSA Version:" +# if (!(Test-Path $installerPath.FullName)) { +# Write-output "File '{0}' does not exist" -f $installerPath.FullName +# } +# try { +# $WindowsInstaller = New-Object -com WindowsInstaller.Installer +# $Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0)) +# $Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'" +# $View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query)) +# $View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null +# $Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null ) +# $Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 ) +# Write-output $Version +# } catch { +# Write-output "Failed to get MSI file version: {0}." -f $_ +# } +# $app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait +# $app.WaitForExit() +# Write-Output "Exit code: $($app.ExitCode)" +# Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" +# if ($app.ExitCode -ne 0) { +# Write-Error "Application could not be installed. Error code $($app.ExitCode)" +# exit(1) +# } +# displayName: 'Install GSA' +# failOnStderr: true +# +# - powershell: | +# & 'C:\Program Files\Oasys\*\GSA.exe' /Register +# displayName: 'Register GSA COM' +# failOnStderr: false +# +# - powershell: | +# ./cleanRegistry.ps1 +# displayName: 'Run Registry Cleaner' +# failOnStderr: true +# +# - task: NuGetToolInstaller@1 +# +# - task: NuGetCommand@2 +# displayName: 'Restoring NuGet packages' +# inputs: +# command: 'restore' +# restoreSolution: 'GsaGH.sln' +# +# - task: VSBuild@1 +# displayName: 'Building project in $(configuration)' +# inputs: +# solution: 'GsaGH.sln' +# msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"' +# platform: 'x64' +# configuration: '$(configuration)' +# clean: true +# env: +# MSBUILDDISABLENODEREUSE: 1 +# +# - powershell: | +# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll +# dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll +# displayName: dotnet tests +# failOnStderr: true +# +# - powershell: | +# if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) { +# Write-Output "codecov.yml is invalid" +# Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post +# exit(1) +# } else { +# Write-Output "codecov.yml is valid" +# } +# displayName: Validate codecov.yml +# failOnStderr: true +# +# - powershell: | +# $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path +# echo $coverage_file_gsagh +# $coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path +# echo $coverage_file_integration +# Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml +# Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml +# $ProgressPreference = 'SilentlyContinue' +# Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe +# ls $(System.DefaultWorkingDirectory)\ +# cd $(System.DefaultWorkingDirectory)\ +# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh +# .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration +# env: +# CODECOV_TOKEN: $(CODECOV_TOKEN) +# displayName: Upload Code Coverage to codecovio +# failOnStderr: true +# +# - task: PublishCodeCoverageResults@1 +# displayName: Create Azure GsaGH CodeCoverage +# inputs: +# codeCoverageTool: 'cobertura' +# summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/gsagh/**/coverage.cobertura.xml' +# pathToSources: '$(System.DefaultWorkingDirectory)' +# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) +# +# - task: PublishCodeCoverageResults@1 +# displayName: Create Azure IntegrationTest CodeCoverage +# inputs: +# codeCoverageTool: 'cobertura' +# summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/integration/**/coverage.cobertura.xml' +# pathToSources: '$(System.DefaultWorkingDirectory)' +# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) +# +# - publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml +# displayName: Publish GsaGHTest xml to Azure +# artifact: GsaGHTestsCoverage +# continueOnError: true +# +# - publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml +# displayName: Publish IntegrationTest xml to Azure +# artifact: IntegrationTestsCoverage +# continueOnError: true +# +# - task: PowerShell@2 +# displayName: Check for existing tags +# inputs: +# targetType: 'inline' +# script: | +# $versionInfo = $(Get-Item .\GsaGH\bin\x64\Release\net48\GsaGH.dll).VersionInfo +# echo $versionInfo +# $fullVersion = [array]${versionInfo}.FileVersion.split('.') +# $currentTime = $(Get-Date -Format "dddd MM/dd/yyyy HH:mm") +# $majorVersion = [string]$fullVersion[0] +# $minorVersion = [string]$fullVersion[1] +# $spVersion = [string]$fullVersion[2] +# $buildNumber = [string]$fullVersion[3] +# +# $tag = [array]@($exeName,$majorVersion,$minorVersion,$spVersion,$buildNumber) +# $tagNumbersOnly = [array]@($majorVersion,$minorVersion,$spVersion,$buildNumber) +# +# $dotSeparatedTag = $majorVersion + "." + $minorVersion + "." + $spVersion +# $underscoreSeparatedTag = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber +# $tagNumbersOnlyUnderscore = $majorVersion + "_" + $minorVersion + "_" + $spVersion + "_" + $buildNumber +# $tagNumbersOnlydot = $majorVersion + "." + $minorVersion + "." + $spVersion + "." + $buildNumber +# +# Write-Host ("##vso[task.setvariable variable=dotSeparatedTag]$dotSeparatedTag") +# git rev-parse $dotSeparatedTag +# if($lastExitCode -eq 0){Write-Host ("##vso[task.setvariable variable=TAG_EXISTS]true")} +# if($lastExitCode -eq 0){ +# $tagExists = 'true' +# echo $tagExists +# } +# errorActionPreference: 'continue' +# workingDirectory: '$(System.DefaultWorkingDirectory)' +# ignoreLASTEXITCODE: true +# +# - powershell: | +# cd GsaGH\bin\x64\Release +# curl https://files.mcneel.com/yak/tools/latest/yak.exe -o yak.exe +# .\yak version +# cd net48 +# ..\yak spec +# Add-Content manifest.yml 'icon: GsaIcon.png' +# Add-Content manifest.yml 'keywords:' +# Add-Content manifest.yml '- oasys' +# Add-Content manifest.yml '- gsa' +# Add-Content manifest.yml '- gsagh' +# Add-Content manifest.yml '- fe' +# Add-Content manifest.yml '- fea' +# Add-Content manifest.yml '- fem' +# Add-Content manifest.yml '- structural' +# Add-Content manifest.yml '- structuralanalysis' +# ..\yak build --platform win +# $yakCurrentVersName = Get-ChildItem -Path . -Filter "*.yak" +# $yakRh7Name = $yakCurrentVersName -Replace "rh6_27", "rh7_0" +# Rename-Item -Path $yakCurrentVersName -NewName $yakRh7Name +# ..\yak build --platform win +# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) +# displayName: Package yak +# +# - powershell: | +# cd GsaGH +# & 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe' GsaGH.csproj /t:pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:DebugType=portable /property:Configuration=Debug +# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) +# displayName: Package NuGet +# +# - powershell: | +# .\DocsGeneration\bin\x64\Debug\net48\DocsGeneration.exe +# Compress-Archive -Path .\Output -DestinationPath .\results\$(dotSeparatedTag)-docs.zip -Force +# displayName: Generate docs site +# failOnStderr: true +# +# - publish: $(System.DefaultWorkingDirectory)\results\$(dotSeparatedTag)-docs.zip +# displayName: Publish Docs artifact +# artifact: Docs +# continueOnError: false +# +# - task: GitHubRelease@1 +# displayName: 'Publishing assets to Github' +# inputs: +# gitHubConnection: 'github.com_MJCramp' +# repositoryName: 'arup-group/GSA-Grasshopper' +# action: 'edit' +# target: '$(Build.SourceVersion)' +# tag: '$(dotSeparatedTag)' +# title: 'GsaGH version $(dotSeparatedTag)' +# releaseNotesSource: 'inline' +# releaseNotesInline: | +# Created from commit https://github.com/arup-group/GSA-Grasshopper/commit/$(Build.SourceVersion) +# assets: | +# $(System.DefaultWorkingDirectory)/**/*.yak +# $(System.DefaultWorkingDirectory)/**/*.nupkg +# $(System.DefaultWorkingDirectory)/**/*.snupkg +# $(System.DefaultWorkingDirectory)/**/$(dotSeparatedTag)-docs.zip +# assetUploadMode: 'replace' +# isDraft: true +# isPreRelease: false +# addChangeLog: false +# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables.TAG_EXISTS, 'true')) +# +# - powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink +# displayName: 'Delete orphan .ghlink files' +# condition: always() +# +# - powershell: | +# $installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi) +# Write-output "Installer Path: ${installerPath}" +# $app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait +# $app.WaitForExit() +# Write-Output "Exit code: $($app.ExitCode)" +# Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC" +# ### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED +# ### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes +# if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) { +# Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)" +# rm $installerPath +# exit(0) +# } else { +# Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)" +# exit(1) +# } +# condition: always() +# displayName: 'Uninstall Application' From 04f1d0609693b27cc8016ad0a619224bc21459bd Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 25 Oct 2024 22:41:44 +0100 Subject: [PATCH 69/80] feat: typo --- dotnet-tests-with-coverage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dotnet-tests-with-coverage.yml b/dotnet-tests-with-coverage.yml index c27cb0d85..7cdf0ba9e 100644 --- a/dotnet-tests-with-coverage.yml +++ b/dotnet-tests-with-coverage.yml @@ -8,7 +8,8 @@ parameters: steps: - powershell: | - $name = $ {{ parameters.dllName }} + $name = ${{ parameters.dllName }} + displayName: 'Simplify name' - powershell: | $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\$name\bin\**\${{ parameters.configuration }}\$name.dll").FullName displayName: 'Find dll file' From 205bfab11f6ecfdf8279798bd71dca90c3920650 Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 25 Oct 2024 23:04:46 +0100 Subject: [PATCH 70/80] ci: tryin to pass the variable --- dotnet-tests-with-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet-tests-with-coverage.yml b/dotnet-tests-with-coverage.yml index 7cdf0ba9e..b11b3322a 100644 --- a/dotnet-tests-with-coverage.yml +++ b/dotnet-tests-with-coverage.yml @@ -8,7 +8,7 @@ parameters: steps: - powershell: | - $name = ${{ parameters.dllName }} + $name = "${{ parameters.dllName }}" displayName: 'Simplify name' - powershell: | $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\$name\bin\**\${{ parameters.configuration }}\$name.dll").FullName From 291c307b655c69372db3e8eeae26f0a2edc154ec Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 25 Oct 2024 23:10:07 +0100 Subject: [PATCH 71/80] ci: fixing parameter --- dotnet-tests-with-coverage.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dotnet-tests-with-coverage.yml b/dotnet-tests-with-coverage.yml index b11b3322a..048a7634e 100644 --- a/dotnet-tests-with-coverage.yml +++ b/dotnet-tests-with-coverage.yml @@ -11,11 +11,11 @@ steps: $name = "${{ parameters.dllName }}" displayName: 'Simplify name' - powershell: | - $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\$name\bin\**\${{ parameters.configuration }}\$name.dll").FullName + $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\${name}\bin\**\${{ parameters.configuration }}\${name}.dll").FullName displayName: 'Find dll file' - powershell: | - dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\$name $dllFile --filter FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests + dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\${name} $dllFile --filter FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests displayName: dotnet tests failOnStderr: true @@ -33,26 +33,26 @@ steps: - powershell: | $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path echo $coverage_file_gsagh - Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_$name.xml + Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_${name}.xml $ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe ls $(System.DefaultWorkingDirectory)\ cd $(System.DefaultWorkingDirectory)\ - .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_$name.xml -F $name + .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_${name}.xml -F {name}$ env: CODECOV_TOKEN: $(CODECOV_TOKEN) displayName: Upload Code Coverage to codecovio failOnStderr: true - task: PublishCodeCoverageResults@1 - displayName: Create Azure $name CodeCoverage + displayName: Create Azure ${name} CodeCoverage inputs: codeCoverageTool: 'cobertura' - summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/$name/**/coverage.cobertura.xml' + summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/${name}/**/coverage.cobertura.xml' pathToSources: '$(System.DefaultWorkingDirectory)' condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) - - publish: $(System.DefaultWorkingDirectory)\results\coverage_$name.xml + - publish: $(System.DefaultWorkingDirectory)\results\coverage_${name}.xml displayName: Publish GsaGHTest xml to Azure artifact: $nameTestsCoverage continueOnError: true From 945fbb1a8cf992fea6639f9b0d2d1e916fcb0f29 Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 25 Oct 2024 23:15:31 +0100 Subject: [PATCH 72/80] ci: fixing parameter --- dotnet-tests-with-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet-tests-with-coverage.yml b/dotnet-tests-with-coverage.yml index 048a7634e..42f96aeea 100644 --- a/dotnet-tests-with-coverage.yml +++ b/dotnet-tests-with-coverage.yml @@ -11,7 +11,7 @@ steps: $name = "${{ parameters.dllName }}" displayName: 'Simplify name' - powershell: | - $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\${name}\bin\**\${{ parameters.configuration }}\${name}.dll").FullName + $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\${{ parameters.dllName }}\bin\**\${{ parameters.configuration }}\${{ parameters.dllName }}.dll").FullName displayName: 'Find dll file' - powershell: | From 4bd5f74796eb39830c7b9ffde5525db1fee39348 Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 25 Oct 2024 23:21:03 +0100 Subject: [PATCH 73/80] ci: fixing parameter --- dotnet-tests-with-coverage.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dotnet-tests-with-coverage.yml b/dotnet-tests-with-coverage.yml index 42f96aeea..239f7aa7a 100644 --- a/dotnet-tests-with-coverage.yml +++ b/dotnet-tests-with-coverage.yml @@ -12,10 +12,11 @@ steps: displayName: 'Simplify name' - powershell: | $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\${{ parameters.dllName }}\bin\**\${{ parameters.configuration }}\${{ parameters.dllName }}.dll").FullName + echo $dllFile displayName: 'Find dll file' - powershell: | - dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\${name} $dllFile --filter FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests + dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\${{ parameters.dllName }} $dllFile --filter FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests displayName: dotnet tests failOnStderr: true @@ -33,26 +34,26 @@ steps: - powershell: | $coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path echo $coverage_file_gsagh - Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_${name}.xml + Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_${{ parameters.dllName }}.xml $ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe ls $(System.DefaultWorkingDirectory)\ cd $(System.DefaultWorkingDirectory)\ - .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_${name}.xml -F {name}$ + .\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_${{ parameters.dllName }}.xml -F ${{ parameters.dllName }} env: CODECOV_TOKEN: $(CODECOV_TOKEN) displayName: Upload Code Coverage to codecovio failOnStderr: true - task: PublishCodeCoverageResults@1 - displayName: Create Azure ${name} CodeCoverage + displayName: Create Azure ${{ parameters.dllName }} CodeCoverage inputs: codeCoverageTool: 'cobertura' - summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/${name}/**/coverage.cobertura.xml' + summaryFileLocation: '$(System.DefaultWorkingDirectory)/results/${{ parameters.dllName }}/**/coverage.cobertura.xml' pathToSources: '$(System.DefaultWorkingDirectory)' condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) - - publish: $(System.DefaultWorkingDirectory)\results\coverage_${name}.xml + - publish: $(System.DefaultWorkingDirectory)\results\coverage_${{ parameters.dllName }}.xml displayName: Publish GsaGHTest xml to Azure artifact: $nameTestsCoverage continueOnError: true From 1056db78945b8a9f3021bbad6757e7e2d8073bb4 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Sat, 26 Oct 2024 00:02:10 +0100 Subject: [PATCH 74/80] Delete .runsettings --- .runsettings | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 .runsettings diff --git a/.runsettings b/.runsettings deleted file mode 100644 index 7f1fc06ff..000000000 --- a/.runsettings +++ /dev/null @@ -1,25 +0,0 @@ - - - 0 - 1000 - TestResults - - - - - - cobertura,opencover - .\CoverageOutput\ - file - true - - True - True - True - False - - - - - - From 8570980b0b01075361c1d4cb0da884ec6bc1cb72 Mon Sep 17 00:00:00 2001 From: Stamatios Psarras Date: Sat, 26 Oct 2024 00:05:19 +0100 Subject: [PATCH 75/80] Removed VSTest --- impact-testing.yml | 70 +++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/impact-testing.yml b/impact-testing.yml index 2c225bbac..1e59aa2a6 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -76,44 +76,44 @@ stages: solution: 'GsaGH.sln' configuration: 'Debug' - - task: VisualStudioTestPlatformInstaller@1 - displayName: 'Install Test Platform' - inputs: - packageFeedSelector: 'nugetOrg' - versionSelector: 'specificVersion' - testPlatformVersion: '16.11.0' - - - task: VSTest@2 - inputs: - testSelector: 'testAssemblies' # Enables Test Impact Analysis - testAssemblyVer2: | - GsaGHTests\bin\x64\Debug\net48\GsaGHTests.dll - searchFolder: '$(System.DefaultWorkingDirectory)' - runOnlyImpactedTests: true - runInParallel: true - failOnStderr: true - codeCoverageEnabled: true - testFiltercriteria: "FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests" - - - powershell: | - $coverage_file = (Resolve-Path $(Agent.TempDirectory)/TestResults/*.trx).Path - echo $coverage_file - displayName: 'Find TRX File' - - - task: PublishBuildArtifacts@1 - condition: always() - inputs: - PathtoPublish: '$(Agent.TempDirectory)\TestResults' - ArtifactName: 'Tests Results' - publishLocation: 'Container' + #- task: VisualStudioTestPlatformInstaller@1 + # displayName: 'Install Test Platform' + # inputs: + # packageFeedSelector: 'nugetOrg' + # versionSelector: 'specificVersion' + # testPlatformVersion: '16.11.0' + + #- task: VSTest@2 + # inputs: + # testSelector: 'testAssemblies' # Enables Test Impact Analysis + # testAssemblyVer2: | + # GsaGHTests\bin\x64\Debug\net48\GsaGHTests.dll + # searchFolder: '$(System.DefaultWorkingDirectory)' + # runOnlyImpactedTests: true + # runInParallel: true + # failOnStderr: true + # codeCoverageEnabled: true + # testFiltercriteria: "FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests" + + #- powershell: | + # $coverage_file = (Resolve-Path $(Agent.TempDirectory)/TestResults/*.trx).Path + # echo $coverage_file + # displayName: 'Find TRX File' + + #- task: PublishBuildArtifacts@1 + # condition: always() + # inputs: + # PathtoPublish: '$(Agent.TempDirectory)\TestResults' + # ArtifactName: 'Tests Results' + # publishLocation: 'Container' # Publish code coverage results v2 # Publish any of the code coverage results from a build. - - task: PublishCodeCoverageResults@2 - condition: always() - inputs: - codeCoverageTool: 'Cobertura' # 'JaCoCo' - summaryFileLocation: $coverage_file + # - task: PublishCodeCoverageResults@2 + # condition: always() + # inputs: + # codeCoverageTool: 'Cobertura' # 'JaCoCo' + # summaryFileLocation: $coverage_file #pathToSources: # string. Path to Source files. #failIfCoverageEmpty: false # boolean. Fail if code coverage results are missing. Default: false. From 3ab8f31594249cda2f27f6b85cd71d625693617c Mon Sep 17 00:00:00 2001 From: spsarras Date: Tue, 29 Oct 2024 12:09:12 +0000 Subject: [PATCH 76/80] ci: use targetBranch and not head --- impact-testing.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index 1e59aa2a6..6c4a20186 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -33,7 +33,8 @@ stages: git fetch origin git status - $gitChanges = git diff --name-only HEAD~1 HEAD + $targetBranch = $(System.PullRequest.TargetBranch) + $gitChanges = git diff --name-only $targetBranch HEAD $unitTestsChanged = $false $integrationTestsChanged = $false @@ -52,6 +53,8 @@ stages: Write-Output "Integration=$integrationTestsChanged" echo "##vso[task.setvariable variable=Integration]$integrationTestsChanged" displayName: 'Detect Changes in Repo' + - powershell: | + $files = git diff HEAD~1 --name-only | Where-Object { $_ -like "*.cs" -and $_ -notlike "*Tests.cs" } - stage: ImpactTestingUnit displayName: 'Impact Testing (Unit)' From 78771de73e7a047d9fc67ba2e986fec6f5406acf Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 29 Nov 2024 16:13:35 +0000 Subject: [PATCH 77/80] ci: added condition when both integration and units need to run --- impact-testing.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index 6c4a20186..52eaba4c8 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -34,17 +34,22 @@ stages: git status $targetBranch = $(System.PullRequest.TargetBranch) - $gitChanges = git diff --name-only $targetBranch HEAD + $gitChanges = git diff --name-only HEAD..$targetBranch $unitTestsChanged = $false $integrationTestsChanged = $false foreach ($file in $gitChanges) { + # both need to run if ($file -like 'GsaGH/*') { $unitTestsChanged = $true + $integrationTestsChanged = $true } if ($file -like 'IntegrationTests/*') { $integrationTestsChanged = $true } + if ($file -like 'GsaGHTests/*') { + $unitTestsChanged = $true + } } Write-Output "Setting pipeline variables based on changes detected..." From 278b575cffeabd3323b86304675722ca3262d9d2 Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 29 Nov 2024 16:33:50 +0000 Subject: [PATCH 78/80] ci: some logging --- dotnet-tests-with-coverage.yml | 4 ++-- impact-testing.yml | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dotnet-tests-with-coverage.yml b/dotnet-tests-with-coverage.yml index 239f7aa7a..b754d07ef 100644 --- a/dotnet-tests-with-coverage.yml +++ b/dotnet-tests-with-coverage.yml @@ -12,11 +12,11 @@ steps: displayName: 'Simplify name' - powershell: | $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\${{ parameters.dllName }}\bin\**\${{ parameters.configuration }}\${{ parameters.dllName }}.dll").FullName - echo $dllFile + Write-Output $dllFile displayName: 'Find dll file' - powershell: | - dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\${{ parameters.dllName }} $dllFile --filter FullyQualifiedName~GsaGHTests.Components.Analysis.CreateAnalysisTaskTests + dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\${{ parameters.dllName }} $dllFile displayName: dotnet tests failOnStderr: true diff --git a/impact-testing.yml b/impact-testing.yml index 52eaba4c8..c6eecd90e 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -39,6 +39,7 @@ stages: $integrationTestsChanged = $false foreach ($file in $gitChanges) { + Write-Output "Checking file: $file" # both need to run if ($file -like 'GsaGH/*') { $unitTestsChanged = $true @@ -58,8 +59,6 @@ stages: Write-Output "Integration=$integrationTestsChanged" echo "##vso[task.setvariable variable=Integration]$integrationTestsChanged" displayName: 'Detect Changes in Repo' - - powershell: | - $files = git diff HEAD~1 --name-only | Where-Object { $_ -like "*.cs" -and $_ -notlike "*Tests.cs" } - stage: ImpactTestingUnit displayName: 'Impact Testing (Unit)' From eca4d28b07b75a9e2e0b88cb198daff6e72c4e67 Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 29 Nov 2024 16:46:13 +0000 Subject: [PATCH 79/80] ci: build and test for debug --- dotnet-tests-with-coverage.yml | 6 +++--- impact-testing.yml | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dotnet-tests-with-coverage.yml b/dotnet-tests-with-coverage.yml index b754d07ef..0a5348bd1 100644 --- a/dotnet-tests-with-coverage.yml +++ b/dotnet-tests-with-coverage.yml @@ -12,12 +12,12 @@ steps: displayName: 'Simplify name' - powershell: | $dllFile = (ls -r "$(System.DefaultWorkingDirectory)\${{ parameters.dllName }}\bin\**\${{ parameters.configuration }}\${{ parameters.dllName }}.dll").FullName - Write-Output $dllFile + Write-Output This is the file $dllFile displayName: 'Find dll file' - powershell: | dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\${{ parameters.dllName }} $dllFile - displayName: dotnet tests + displayName: 'dotnet tests' failOnStderr: true - powershell: | @@ -28,7 +28,7 @@ steps: } else { Write-Output "codecov.yml is valid" } - displayName: Validate codecov.yml + displayName: 'Validate codecov.yml' failOnStderr: true - powershell: | diff --git a/impact-testing.yml b/impact-testing.yml index c6eecd90e..aa881d66b 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -125,6 +125,7 @@ stages: #failIfCoverageEmpty: false # boolean. Fail if code coverage results are missing. Default: false. - template: dotnet-tests-with-coverage.yml + configuration: 'Debug' - template: uninstall-gsa.yml From c77438fc619919376d68c7de629d07f5c8e8c66a Mon Sep 17 00:00:00 2001 From: spsarras Date: Fri, 29 Nov 2024 16:47:48 +0000 Subject: [PATCH 80/80] ci: parameter typo --- impact-testing.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/impact-testing.yml b/impact-testing.yml index aa881d66b..a05fc919e 100644 --- a/impact-testing.yml +++ b/impact-testing.yml @@ -125,7 +125,8 @@ stages: #failIfCoverageEmpty: false # boolean. Fail if code coverage results are missing. Default: false. - template: dotnet-tests-with-coverage.yml - configuration: 'Debug' + parameters: + configuration: 'Debug' - template: uninstall-gsa.yml