From c024988fd15cf2cd7df4910f7822ec0fd246cdc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alaksiej=20Miale=C5=A1ka?= Date: Thu, 12 Sep 2019 12:42:03 +0200 Subject: [PATCH 1/5] Add Sonar settings to Azure Pipeline --- azure-pipelines.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e194d71..a1a707c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,16 +16,31 @@ pool: vmImage: 'windows-latest' steps: -- task: PowerShell@2 - displayName: install calculator + +- task: SonarCloudPrepare@1 + displayName: 'Prepare SonarCloud analysis' inputs: - targetType: 'inline' - script: 'Get-AppxPackage -allusers *windowscalculator* | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}' + SonarCloud: 'SonarCloud' + organization: 'aqualityautomation' + projectKey: 'aquality-automation_aquality-selenium-core-dotnet' + projectName: 'aquality-selenium-core-dotnet' + projectVersion: '$(Build.BuildNumber)' + extraProperties: | + sonar.coverage.exclusions=**/** - script: dotnet build Aquality.Selenium.Core/Aquality.Selenium.Core.sln -c $(buildConfiguration) displayName: 'Build solution - $(buildConfiguration)' + +- task: SonarCloudAnalyze@1 + displayName: 'Run SonarCloud code analysis' + continueOnError: true + +- task: SonarCloudPublish@1 + displayName: 'Publish SonarCloud quality gate results' + continueOnError: true + - task: Windows Application Driver@0 - displayName: start WinAppDriver + displayName: 'Start WinAppDriver' inputs: OperationType: 'Start' - task: DotNetCoreCLI@2 From 28bdc12cd5d14804e8f1187aaddbcfd3eb594c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alaksiej=20Miale=C5=A1ka?= Date: Thu, 12 Sep 2019 13:04:59 +0200 Subject: [PATCH 2/5] Update azure-pipelines.yml for Azure Pipelines remove sonar.coverage.exclusions, move analysis after tests execution --- azure-pipelines.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a1a707c..a21efb9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,19 +25,9 @@ steps: projectKey: 'aquality-automation_aquality-selenium-core-dotnet' projectName: 'aquality-selenium-core-dotnet' projectVersion: '$(Build.BuildNumber)' - extraProperties: | - sonar.coverage.exclusions=**/** - script: dotnet build Aquality.Selenium.Core/Aquality.Selenium.Core.sln -c $(buildConfiguration) displayName: 'Build solution - $(buildConfiguration)' - -- task: SonarCloudAnalyze@1 - displayName: 'Run SonarCloud code analysis' - continueOnError: true - -- task: SonarCloudPublish@1 - displayName: 'Publish SonarCloud quality gate results' - continueOnError: true - task: Windows Application Driver@0 displayName: 'Start WinAppDriver' @@ -53,4 +43,12 @@ steps: - task: Windows Application Driver@0 displayName: stop WinAppDriver inputs: - OperationType: 'Stop' \ No newline at end of file + OperationType: 'Stop' + +- task: SonarCloudAnalyze@1 + displayName: 'Run SonarCloud code analysis' + continueOnError: true + +- task: SonarCloudPublish@1 + displayName: 'Publish SonarCloud quality gate results' + continueOnError: true \ No newline at end of file From e458e3c7ec8ef5b5e6724f8c7691836915b18bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alaksiej=20Miale=C5=A1ka?= Date: Thu, 12 Sep 2019 16:14:00 +0200 Subject: [PATCH 3/5] Add nuget publish steps to pipeline --- azure-pipelines.yml | 47 +++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a21efb9..2d97897 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,9 +1,3 @@ -# 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 - variables: buildConfiguration: 'Release' webDriverVersion: '75.0.3770.140' @@ -16,6 +10,10 @@ pool: vmImage: 'windows-latest' steps: +- task: GitVersion@5 + displayName: 'Run GitVersion' + inputs: + runtime: 'core' - task: SonarCloudPrepare@1 displayName: 'Prepare SonarCloud analysis' @@ -25,9 +23,18 @@ steps: projectKey: 'aquality-automation_aquality-selenium-core-dotnet' projectName: 'aquality-selenium-core-dotnet' projectVersion: '$(Build.BuildNumber)' + extraProperties: | + sonar.coverage.exclusions=**/** - script: dotnet build Aquality.Selenium.Core/Aquality.Selenium.Core.sln -c $(buildConfiguration) displayName: 'Build solution - $(buildConfiguration)' +- task: SonarCloudAnalyze@1 + displayName: 'Run SonarCloud code analysis' + continueOnError: true + +- task: SonarCloudPublish@1 + displayName: 'Publish SonarCloud quality gate results' + continueOnError: true - task: Windows Application Driver@0 displayName: 'Start WinAppDriver' @@ -44,11 +51,27 @@ steps: displayName: stop WinAppDriver inputs: OperationType: 'Stop' + +- script: dotnet pack Aquality.Selenium.Core\src\Aquality.Selenium.Core\Aquality.Selenium.Core.csproj -c $(buildConfiguration) --no-build -p:Version=$(GitVersion.NuGetVersion) -o $(Build.ArtifactStagingDirectory) + displayName: 'Create NuGet package' + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) -- task: SonarCloudAnalyze@1 - displayName: 'Run SonarCloud code analysis' - continueOnError: true +- task: NuGetCommand@2 + displayName: 'Push NuGet package' + inputs: + command: 'push' + packagesToPush: '$(Build.ArtifactStagingDirectory)/**/Aquality.Selenium.Core*.nupkg;!$(Build.ArtifactStagingDirectory)/**/Aquality.Selenium.Core*.symbols.nupkg' + nuGetFeedType: 'external' + publishFeedCredentials: 'NuGet' + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) -- task: SonarCloudPublish@1 - displayName: 'Publish SonarCloud quality gate results' - continueOnError: true \ No newline at end of file +- task: GitHubRelease@0 + displayName: 'Create tag on GitHub' + inputs: + gitHubConnection: 'GitHub' + repositoryName: 'aquality-automation/aquality-selenium-core-dotnet' + action: 'create' + tag: 'v$(GitVersion.NuGetVersion)' + tagSource: 'manual' + isPreRelease: contains(variables['GitVersion.NuGetVersion'], '-') + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) \ No newline at end of file From aa4a81883090192ce5731af3f2b0a52d92a9444a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alaksiej=20Miale=C5=A1ka?= Date: Thu, 12 Sep 2019 17:18:16 +0300 Subject: [PATCH 4/5] add GitVersion.yml --- GitVersion.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 GitVersion.yml diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..c58bd66 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,6 @@ +next-version: 1.0 +mode: Mainline +increment: Inherit +branches: {} +ignore: + sha: [] \ No newline at end of file From 567d0c0d9be7254e36368e6ed98109b4de22b754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alaksiej=20Miale=C5=A1ka?= Date: Thu, 12 Sep 2019 18:26:19 +0300 Subject: [PATCH 5/5] fix RepositoryUrl and removed redundant usings --- .../src/Aquality.Selenium.Core/Aquality.Selenium.Core.csproj | 2 +- .../src/Aquality.Selenium.Core/Elements/ElementFactory.cs | 1 - .../Applications/ApplicationManagerTests.cs | 2 +- .../Applications/WindowsApp/Elements/Button.cs | 3 +-- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Aquality.Selenium.Core/src/Aquality.Selenium.Core/Aquality.Selenium.Core.csproj b/Aquality.Selenium.Core/src/Aquality.Selenium.Core/Aquality.Selenium.Core.csproj index c215101..d573712 100644 --- a/Aquality.Selenium.Core/src/Aquality.Selenium.Core/Aquality.Selenium.Core.csproj +++ b/Aquality.Selenium.Core/src/Aquality.Selenium.Core/Aquality.Selenium.Core.csproj @@ -10,7 +10,7 @@ Core functions for Selenium-based libraries for .NET Core functions for Selenium-based libraries for .NET - https://github.com/aquality-automation/aquality-selenium-dotnet + https://github.com/aquality-automation/aquality-selenium-core-dotnet git selenium webdriver automation LICENSE diff --git a/Aquality.Selenium.Core/src/Aquality.Selenium.Core/Elements/ElementFactory.cs b/Aquality.Selenium.Core/src/Aquality.Selenium.Core/Elements/ElementFactory.cs index 15489df..7194b91 100644 --- a/Aquality.Selenium.Core/src/Aquality.Selenium.Core/Elements/ElementFactory.cs +++ b/Aquality.Selenium.Core/src/Aquality.Selenium.Core/Elements/ElementFactory.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Contracts; using System.Linq; using System.Reflection; using Aquality.Selenium.Core.Elements.Interfaces; diff --git a/Aquality.Selenium.Core/tests/Aquality.Selenium.Core.Tests/Applications/ApplicationManagerTests.cs b/Aquality.Selenium.Core/tests/Aquality.Selenium.Core.Tests/Applications/ApplicationManagerTests.cs index 44a143c..8609086 100644 --- a/Aquality.Selenium.Core/tests/Aquality.Selenium.Core.Tests/Applications/ApplicationManagerTests.cs +++ b/Aquality.Selenium.Core/tests/Aquality.Selenium.Core.Tests/Applications/ApplicationManagerTests.cs @@ -45,7 +45,7 @@ private static IServiceCollection RegisterServices(Func(new CustomTimeoutConfiguration(settingsFile)); return services; } diff --git a/Aquality.Selenium.Core/tests/Aquality.Selenium.Core.Tests/Applications/WindowsApp/Elements/Button.cs b/Aquality.Selenium.Core/tests/Aquality.Selenium.Core.Tests/Applications/WindowsApp/Elements/Button.cs index bb1e8ae..f7db254 100644 --- a/Aquality.Selenium.Core/tests/Aquality.Selenium.Core.Tests/Applications/WindowsApp/Elements/Button.cs +++ b/Aquality.Selenium.Core/tests/Aquality.Selenium.Core.Tests/Applications/WindowsApp/Elements/Button.cs @@ -1,5 +1,4 @@ -using Aquality.Selenium.Core.Elements; -using OpenQA.Selenium; +using OpenQA.Selenium; namespace Aquality.Selenium.Core.Tests.Applications.WindowsApp.Elements {