-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipeline.yml
142 lines (128 loc) · 4 KB
/
azure-pipeline.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# 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
trigger:
- master
- main
- develop
- release/*
- feature/*
- hotfix/*
- bugfix/*
- support
variables:
- group: rsql4net.vars
- name: disable.coverage.autogenerate
value: 'true'
- name: codecoveragehistory.directory
value: '$(Build.ArtifactStagingDirectory)\history'
- name: codecoveragehistory.feedName
value: '$(Build.Repository.Name)-$(Build.SourceBranchName)'
pool:
vmImage: ubuntu-latest
steps:
- task: gitversion/setup@0
displayName: 'GitVersion install tools'
inputs:
versionSpec: '$(GitVersion)'
- task: gitversion/execute@0
displayName: 'Execute GitVersion'
inputs:
useConfigFile: true
configFilePath: 'GitVersion.yml'
- task: Bash@3
displayName: 'Dotnet tools install components'
inputs:
targetType: 'inline'
script: |-
dotnet tool install --global coverlet.console --version 3.2.0 && \
dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.1.10
- task: JavaToolInstaller@0
displayName: 'Java JDK install'
inputs:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
- task: Bash@3
displayName: 'Generate C# Antlr4 Parser & Visitor'
inputs:
targetType: 'inline'
script: |-
java \
-jar $(Build.SourcesDirectory)/grammar/antlr4-4.9.3-complete.jar \
$(Build.SourcesDirectory)/grammar/RSqlQuery.g \
-o $(Build.SourcesDirectory)/src/RSql4net/Models/Queries \
-Dlanguage=CSharp \
-listener \
-encoding UTF-8 \
-visitor \
-package RSql4Net.Models.Queries
- task: Cake@2
displayName: 'Cake execute script'
inputs:
script: build.cake
target: Package
verbosity: Verbose
env:
SONAR_CLOUD_LOGIN: $(SonarCloud.Login)
- task: reportgenerator@5
displayName: 'Generate code coverage report'
inputs:
reports: '$(Build.SourcesDirectory)/coverage-results/coverage.xml'
targetdir: '$(Build.SourcesDirectory)/codecoverage'
sourcedirs: '$(System.DefaultWorkingDirectory)/src'
verbosity: 'Verbose'
historydir: '$(codecoveragehistory.directory)'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage report'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/codecoverage/Cobertura.xml'
reportDirectory: '$(Build.SourcesDirectory)/codecoverage'
- task: NuGetCommand@2
displayName: 'Publish package'
inputs:
command: 'push'
packagesToPush: '$(System.DefaultWorkingDirectory)/**/RSql4Net*.nupkg;!$(System.DefaultWorkingDirectory)/**/RSql4Net*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'gwendallg-nuget'
condition: |-
and(
succeeded(),
or(
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
eq(variables['Build.SourceBranch'], 'refs/heads/develop')
)
)
- task: Docker@2
displayName: Docker Build and Publish
inputs:
containerRegistry: 'gwendallg-docker'
repository: 'gwendallg/rsql4net-sample'
command: 'buildAndPush'
Dockerfile: 'Dockerfile'
tags: |-
$(GitVersion.LegacySemVer)
condition: |-
and(
succeeded(),
or(
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
eq(variables['Build.SourceBranch'], 'refs/heads/develop')
)
)
- task: Docker@2
displayName: Docker Build and Publish ( latest )
inputs:
containerRegistry: 'gwendallg-docker'
repository: 'gwendallg/rsql4net-sample'
command: 'buildAndPush'
Dockerfile: 'Dockerfile'
tags: |-
latest
condition: |-
and(
succeeded(),
eq(variables['Build.SourceBranch'], 'refs/heads/master')
)