-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
86 lines (78 loc) · 3.07 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# pipeline for building Kenc.ACMELib.
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
variables:
major: 0
minor: 1
beta: true
solution: '**/*.sln'
buildConfiguration: 'Release'
stages:
# Versioning builds
- stage:
displayName: Build_Main_Version_Number
jobs:
- job: Build_Main_Version_Number
timeoutInMinutes: 1 # how long to run the job before automatically cancelling
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
variables:
patch: $[counter(variables['minor'], 0)]
steps:
- bash: |
echo "##vso[build.updatebuildnumber]$(major).$(minor).$(patch)"
echo "##vso[task.setvariable variable=assemblyVersionStr]$(major).$(minor).$(patch)"
condition: ne(variables['beta'], true)
name: SetMainBuildName
- bash: |
echo "##vso[build.updatebuildnumber]$(major).$(minor).$(patch)-beta"
echo "##vso[task.setvariable variable=assemblyVersionStr]$(major).$(minor).$(patch)"
condition: eq(variables['beta'], true)
name: SetMainBuildNameBeta
- job: Build_Branch_Version_Number
timeoutInMinutes: 1 # how long to run the job before automatically cancelling
condition: ne(variables['Build.SourceBranch'], 'refs/heads/main')
variables:
prpatch: $[counter(variables['system.pullrequest.pullrequestid'], 0)]
brpatch: $[counter(variables['build.sourcebranchname'], 0)]
steps:
- bash: |
echo "##vso[build.updatebuildnumber]$(major).$(minor)-PullRequest.$(prpatch)"
echo "##vso[task.setvariable variable=assemblyVersionStr]$(major).$(minor).$(prpatch)"
condition: eq(variables['Build.Reason'], 'PullRequest')
name: SetPRBuildName
- bash: |
echo "##vso[build.updatebuildnumber]$(major).$(minor)-$(Build.SourceBranchName).$(brpatch)"
echo "##vso[task.setvariable variable=assemblyVersionStr]$(major).$(minor).$(brpatch)"
condition: ne(variables['Build.Reason'], 'PullRequest')
name: SetBranchBuildName
# Stage for building application
- stage: Build_Steps
displayName: Build_Steps
condition: always()
jobs:
- job: Build_Steps
timeoutInMinutes: 10 # how long to run the job before automatically cancelling
displayName: Build_Steps
steps:
- script: dotnet restore $(solution)
name: dotnet_restore
- script: "dotnet build $(solution) -c $(BuildConfiguration) /p:version=$(Build.BuildNumber) /p:assemblyversion=$(assemblyVersionStr)"
name: dotnet_build
- script: "dotnet test $(solution) --filter TestCategory!=IntegrationTests --logger trx"
name: dotnet_test
- task: CopyFiles@2
inputs:
Contents: 'drops/$(BuildConfiguration)/**/**'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: 'src/**/*.trx'
failTaskOnFailedTests: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'