diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b3891e2..4c9b8eb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,11 +5,11 @@ trigger: - master -- branch +- feature/* variables: # Azure Resource Manager connection created during pipeline creation - devazureSubscription: 'f27beff6-c5b7-41a5-bd50-2b9fce4760ca' + devazureSubscription: 'AzureFunction' # Function app name devFunctionAppName: 'fcd-dev-web-app' @@ -19,6 +19,7 @@ variables: # Working Directory workingDirectory: '$(System.DefaultWorkingDirectory)/source/src/SampleAzureFunctionCode' + testsDirectory: '$(System.DefaultWorkingDirectory)/source/tests/SampleAzureFunctionCode.Tests' stages: - stage: Build @@ -31,6 +32,13 @@ stages: vmImage: $(vmImageName) steps: + - task: DotNetCoreCLI@2 + displayName: 'Install dotnetsay' + inputs: + command: custom + custom: tool + arguments: 'install -g dotnetsay' + - task: DotNetCoreCLI@2 displayName: Build inputs: @@ -39,6 +47,7 @@ stages: $(workingDirectory)/*.csproj arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration Release + - task: ArchiveFiles@2 displayName: 'Archive files' inputs: @@ -51,9 +60,35 @@ stages: - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip artifact: drop +- stage: Start_Run_Test + displayName: Run Test Cases + dependsOn: Build + condition: succeeded() + + jobs: + - job: Start_Run_Test + displayName: Test Builder + pool: + vmImage: $(vmImageName) + + steps: + - task: DotNetCoreCLI@2 + displayName: 'Install dotnetsay' + inputs: + command: custom + custom: tool + arguments: 'install -g dotnetsay' + + - script: dotnet test $(System.DefaultWorkingDirectory)/source/tests/SampleAzureFunctionCode.Tests/SampleAzureFunctionCode.Tests.csproj --logger trx --collect "Code coverage" + - task: PublishTestResults@2 + inputs: + testRunner: VSTest + testResultsFiles: '**/*.trx' + + - stage: Dev_Deployment displayName: Dev Deployment stage - dependsOn: Build + dependsOn: Start_Run_Test condition: succeeded() jobs: