Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/sf-10
Browse files Browse the repository at this point in the history
  • Loading branch information
neilr81 authored Oct 23, 2023
2 parents 21ff7d2 + 7376325 commit 2f5a438
Show file tree
Hide file tree
Showing 15 changed files with 489 additions and 10 deletions.
20 changes: 20 additions & 0 deletions .github/pipelines/dotnet-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# .NET Build

parameters:
- name: BuildConfiguration
type: string
default: $(BuildConfiguration)
- name: BuildParameters
type: string
- name: BuildPlatform
type: string
steps:
- template: /.github/pipelines/dotnet-initialize.yml@self
parameters:
BuildConfiguration: ${{parameters.BuildConfiguration}}
BuildParameters: Platform="${{parameters.BuildPlatform}}"
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
projects: "**\\*.sln"
arguments: -c ${{parameters.BuildConfiguration}} -p:${{parameters.BuildParameters}} --no-restore
26 changes: 26 additions & 0 deletions .github/pipelines/dotnet-buildandtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .NET Build and Tests

parameters:
- name: BuildConfiguration
type: string
default: $(BuildConfiguration)
- name: BuildParameters
type: string
default: Platform="$(BuildPlatform)"
- name: BuildPlatform
type: string
- name: TestFilter
type: string
default: FullyQualifiedName!~CloudTests
steps:
- template: /.github/pipelines/dotnet-build.yml@self
parameters:
BuildConfiguration: ${{parameters.BuildConfiguration}}
BuildParameters: ${{parameters.BuildParameters}}
BuildPlatform: ${{parameters.BuildPlatform}}
- template: /.github/pipelines/dotnet-tests.yml@self
parameters:
BuildConfiguration: ${{parameters.BuildConfiguration}}
BuildParameters: ${{parameters.BuildParameters}}
BuildPlatform: ${{parameters.BuildPlatform}}
TestFilter: ${{parameters.TestFilter}}
24 changes: 24 additions & 0 deletions .github/pipelines/dotnet-initialize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# .Net Initialization

parameters:
- name: BuildConfiguration
type: string
default: $(BuildConfiguration)
- name: BuildParameters
type: string
default: Platform="$(BuildPlatform)"
steps:
- task: NuGetAuthenticate@1
displayName: NuGet Authenticate
- task: UseDotNet@2
displayName: Use .NET SDK from global.json
inputs:
useGlobalJson: true
- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: restore
projects: "**\\*.sln"
restoreArguments: /p:Configuration="${{parameters.BuildConfiguration}}" -p:${{parameters.BuildParameters}}
feedRestore: Office
includeNuGetOrg: false
61 changes: 61 additions & 0 deletions .github/pipelines/dotnet-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# .NET UnitTests

parameters:
- name: BuildConfiguration
type: string
default: $(BuildConfiguration)
- name: BuildParameters
type: string
- name: BuildPlatform
type: string
default: $(BuildPlatform)
- name: TestFilter
type: string
default: FullyQualifiedName!~CloudTests
steps:
- task: PowerShell@2
displayName: run dotnet test (workaround azure-pipelines-tasks/issues/18731)
inputs:
targetType: inline
script: |+
$buildDirectory = "$(Agent.BuildDirectory)\s\"
Write-Host "Searching for solution file in build directory: $buildDirectory"
# Identify solution file to target
$slnFile = (Get-ChildItem -Path $buildDirectory -Filter "*.sln").Name
Write-Host "Running dotnet test with code coverage enabled"
# Merge all streams into stdout
$result = C:\hostedtoolcache\windows\dotnet\dotnet.exe test $slnFile --collect "Code coverage" --logger trx --results-directory D:\a\_work\_temp -c Release -p:Platform=x64 --no-build --no-restore --filter FullyQualifiedName!~CloudTests --verbosity Detailed *>&1
# Write output
$output = $result -join [System.Environment]::NewLine
Write-Host $output
if($LASTEXITCODE -eq 0)
{
# Success
}
else
{
$LASTEXITCODE = 0
Write-Warning "Running dotnet test with code coverage enabled failed. Retrying with code coverage collection disabled."
$result = C:\hostedtoolcache\windows\dotnet\dotnet.exe test $slnFile --logger trx --results-directory D:\a\_work\_temp -c Release -p:Platform=x64 --no-build --no-restore --filter FullyQualifiedName!~CloudTests --verbosity Detailed *>&1
# Write output
$output = $result -join [System.Environment]::NewLine
Write-Host $output
}
- task: PublishTestResults@2
displayName: Publish Test Results $(Agent.TempDirectory)\**\*.trx
condition: succeededOrFailed()
inputs:
testRunner: VSTest
testResultsFiles: $(Agent.TempDirectory)\**\*.trx
searchFolder: $(Common.TestResultsDirectory)
mergeTestResults: true
platform: ${{parameters.BuildPlatform}}
configuration: ${{parameters.BuildConfiguration}}
Loading

0 comments on commit 2f5a438

Please sign in to comment.