-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathazure-pipelines.yml
69 lines (61 loc) · 2.61 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
pool:
vmImage: 'windows-2022'
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- task: DotNetCoreCLI@2
displayName: 'DotNet Restore'
inputs:
command: restore
projects: '$(Parameters.solution)'
- task: VSBuild@1
displayName: 'Build Solution'
inputs:
solution: '$(Parameters.solution)'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: VSTest@2
displayName: 'Unit Tests'
inputs:
testAssemblyVer2: |
**\$(BuildConfiguration)\**\*Tests.dll
!**\obj\**
codeCoverageEnabled: true
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- powershell: |
$coverageFilePath = (Resolve-Path -path "$($Env:CoveragePath)\TestResults\*\*.coverage").Path
Invoke-Expression '& "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:coverage.coveragexml "$($coverageFilePath)"'
Invoke-Expression '& dotnet tool install coveralls.net --version 1.0.0 --tool-path coveralls.net'
$commitAuthor = git log --format=%an HEAD~1..HEAD
$commitAuthorEmail = git log --format=%ae HEAD~1..HEAD
Invoke-Expression '& coveralls.net\csmacnz.Coveralls --dynamiccodecoverage -i coverage.coveragexml --commitId $Env:REPO_COMMIT --commitBranch $Env:REPO_BRANCH --commitAuthor "$($commitAuthor)" --commitEmail $commitAuthorEmail --commitMessage "$($Env:REPO_COMMIT_MESSAGE)" --jobId $env:JOB_ID --useRelativePaths -o cov.json'
displayName: 'Publish to Coveralls.io'
env:
CoveragePath: '$(Agent.TempDirectory)'
COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN)
REPO_COMMIT: $(Build.SourceVersion)
REPO_BRANCH: master
JOB_ID: $(Build.BuildId)
REPO_COMMIT_MESSAGE: $(Build.SourceVersionMessage)
workingDirectory: $(Build.Repository.LocalPath)
condition: and(eq('skip','true'), succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- task: CopyFiles@2
displayName: 'Preparing NuGet packages'
inputs:
contents: '**\XrmEntitySerializer*.nupkg'
targetFolder: $(Build.ArtifactStagingDirectory)
flattenFolders: true
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- task: PublishBuildArtifacts@1
displayName: 'Publishing NuGet packages to pipeline'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'NuGet Package'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))