• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

samsmithnz / AzurePipelinesToGitHubActionsConverterWeb / 6019812351

30 Aug 2023 02:22AM UTC coverage: 67.66%. Remained the same
6019812351

push

github

web-flow
Adding dependabot groups (#236)

* Updated packages

* Added dependabot file to solution

* increased minor version

* updated github release and tag version

* Updated dependabot file to process groups

0 of 62 branches covered (0.0%)

Branch coverage included in aggregate %.

454 of 609 relevant lines covered (74.55%)

0.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/PipelinesToActions/PipelinesToActions/Models/Examples.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Threading.Tasks;
5

6
namespace PipelinesToActionsWeb.Models
7
{
8
    public class Examples
9
    {
10
        public static string CIExample()
11
        {
1✔
12
            string yaml = @"
1✔
13
trigger:
1✔
14
- main
1✔
15

1✔
16
variables:
1✔
17
  buildConfiguration: 'Release'
1✔
18
  buildPlatform: 'Any CPU'
1✔
19

1✔
20
jobs:
1✔
21
- job: Build
1✔
22
  displayName: 'Build job'
1✔
23
  pool:
1✔
24
    vmImage: windows-latest
1✔
25
  steps:
1✔
26
  - task: DotNetCoreCLI@2
1✔
27
    displayName: 'Test dotnet code projects'
1✔
28
    inputs:
1✔
29
      command: test
1✔
30
      projects: |
1✔
31
       MyProject/MyProject.Tests/MyProject.Tests.csproj
1✔
32
      arguments: --configuration $(buildConfiguration) 
1✔
33
  - task: DotNetCoreCLI@2
1✔
34
    displayName: 'Publish dotnet core projects'
1✔
35
    inputs:
1✔
36
      command: publish
1✔
37
      publishWebProjects: false
1✔
38
      projects: |
1✔
39
        MyProject/MyProject.Web/MyProject.Web.csproj
1✔
40
      arguments: --configuration $(buildConfiguration) --output $(build.artifactstagingdirectory) 
1✔
41
      zipAfterPublish: true
1✔
42
  - task: PublishBuildArtifacts@1
1✔
43
    displayName: 'Publish Artifact'
1✔
44
    inputs:
1✔
45
      PathtoPublish: '$(build.artifactstagingdirectory)'
1✔
46
";
1✔
47
            return yaml;
1✔
48
        }
1✔
49

50
        public static string CDExample()
51
        {
1✔
52
            string yaml = @"
1✔
53
trigger:
1✔
54
- main
1✔
55

1✔
56
variables:
1✔
57
  buildConfiguration: 'Release'
1✔
58
  buildPlatform: 'Any CPU'
1✔
59

1✔
60
jobs:
1✔
61
- job: Deploy
1✔
62
  displayName: ""Deploy job""
1✔
63
  pool:
1✔
64
    vmImage: ubuntu-latest
1✔
65
  condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
1✔
66
  variables:
1✔
67
    AppSettings.Environment: 'data'
1✔
68
    ArmTemplateResourceGroupLocation: 'eu'
1✔
69
    ResourceGroupName: 'MyProjectRG'
1✔
70
    WebsiteName: 'myproject-web'
1✔
71
  steps:
1✔
72
  - task: DownloadBuildArtifacts@0
1✔
73
    displayName: 'Download the build artifacts'
1✔
74
    inputs:
1✔
75
      buildType: 'current'
1✔
76
      downloadType: 'single'
1✔
77
      artifactName: 'drop'
1✔
78
      downloadPath: '$(build.artifactstagingdirectory)'
1✔
79
  - task: AzureRmWebAppDeployment@3
1✔
80
    displayName: 'Azure App Service Deploy: web site'
1✔
81
    inputs:
1✔
82
      azureSubscription: 'connection to Azure Portal'
1✔
83
      WebAppName: $(WebsiteName)
1✔
84
      DeployToSlotFlag: true
1✔
85
      ResourceGroupName: $(ResourceGroupName)
1✔
86
      SlotName: 'staging'
1✔
87
      Package: '$(build.artifactstagingdirectory)/drop/MyProject.Web.zip'
1✔
88
      TakeAppOfflineFlag: true
1✔
89
      JSONFiles: '**/appsettings.json'        
1✔
90
  - task: AzureAppServiceManage@0
1✔
91
    displayName: 'Swap Slots: website'
1✔
92
    inputs:
1✔
93
      azureSubscription: 'connection to Azure Portal'
1✔
94
      WebAppName: $(WebsiteName)
1✔
95
      ResourceGroupName: $(ResourceGroupName)
1✔
96
      SourceSlot: 'staging'
1✔
97
";
1✔
98
            return yaml;
1✔
99
        }
1✔
100

101
        public static string CICDExample()
102
        {
1✔
103
            string yaml = @"
1✔
104
trigger:
1✔
105
- main
1✔
106
pr:
1✔
107
  branches:
1✔
108
    include:
1✔
109
    - '*'  # must quote since ""*"" is a YAML reserved character; we want a string
1✔
110

1✔
111
variables:
1✔
112
  buildConfiguration: 'Release'
1✔
113
  buildPlatform: 'Any CPU'
1✔
114

1✔
115
stages:
1✔
116
- stage: Build
1✔
117
  displayName: 'Build/Test Stage'
1✔
118
  jobs:
1✔
119
  - job: Build
1✔
120
    displayName: 'Build job'
1✔
121
    pool:
1✔
122
      vmImage: windows-latest
1✔
123
    steps:
1✔
124

1✔
125
    - task: CopyFiles@2
1✔
126
      displayName: 'Copy environment ARM template files to: $(build.artifactstagingdirectory)'
1✔
127
      inputs:
1✔
128
        SourceFolder: '$(system.defaultworkingdirectory)\MyProject\MyProject.ARMTemplates'
1✔
129
        Contents: '**\*' # **\* = Copy all files and all files in sub directories
1✔
130
        TargetFolder: '$(build.artifactstagingdirectory)\ARMTemplates'
1✔
131

1✔
132
    - task: DotNetCoreCLI@2
1✔
133
      displayName: 'Test dotnet code projects'
1✔
134
      inputs:
1✔
135
        command: test
1✔
136
        projects: |
1✔
137
         MyProject/MyProject.Tests/MyProject.Tests.csproj
1✔
138
        arguments: --configuration $(buildConfiguration) 
1✔
139

1✔
140
    - task: DotNetCoreCLI@2
1✔
141
      displayName: 'Publish dotnet core projects'
1✔
142
      inputs:
1✔
143
        command: publish
1✔
144
        publishWebProjects: false
1✔
145
        projects: |
1✔
146
         MyProject/MyProject.Web/MyProject.Web.csproj
1✔
147
        arguments: --configuration $(buildConfiguration) --output $(build.artifactstagingdirectory) 
1✔
148
        zipAfterPublish: true
1✔
149

1✔
150
    - task: DotNetCoreCLI@2
1✔
151
      displayName: 'Publish dotnet core functional tests project'
1✔
152
      inputs:
1✔
153
        command: publish
1✔
154
        publishWebProjects: false
1✔
155
        projects: |
1✔
156
         MyProject/MyProject.FunctionalTests/MyProject.FunctionalTests.csproj
1✔
157
        arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)/FunctionalTests'
1✔
158
        zipAfterPublish: false
1✔
159

1✔
160
    - task: CopyFiles@2
1✔
161
      displayName: 'Copy Selenium Files to: $(build.artifactstagingdirectory)/FunctionalTests/MyProject.FunctionalTests'
1✔
162
      inputs:
1✔
163
        SourceFolder: 'MyProject/MyProject.FunctionalTests/bin/$(buildConfiguration)/netcoreapp3.0'
1✔
164
        Contents: '*chromedriver.exe*'
1✔
165
        TargetFolder: '$(build.artifactstagingdirectory)/FunctionalTests/MyProject.FunctionalTests'
1✔
166

1✔
167
    # Publish the artifacts
1✔
168
    - task: PublishBuildArtifacts@1
1✔
169
      displayName: 'Publish Artifact'
1✔
170
      inputs:
1✔
171
        PathtoPublish: '$(build.artifactstagingdirectory)'
1✔
172

1✔
173
- stage: Deploy
1✔
174
  displayName: 'Deploy Prod'
1✔
175
  condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
1✔
176
  jobs:
1✔
177
  - job: Deploy
1✔
178
    displayName: ""Deploy job""
1✔
179
    pool:
1✔
180
      vmImage: ubuntu-latest  
1✔
181
    variables:
1✔
182
      AppSettings.Environment: 'data'
1✔
183
      ArmTemplateResourceGroupLocation: 'eu'
1✔
184
      ResourceGroupName: 'MyProjectRG'
1✔
185
      WebsiteName: 'myproject-web'
1✔
186
    steps:
1✔
187
    - task: DownloadBuildArtifacts@0
1✔
188
      displayName: 'Download the build artifacts'
1✔
189
      inputs:
1✔
190
        buildType: 'current'
1✔
191
        downloadType: 'single'
1✔
192
        artifactName: 'drop'
1✔
193
        downloadPath: '$(build.artifactstagingdirectory)'
1✔
194
    - task: AzureResourceGroupDeployment@2
1✔
195
      displayName: 'Deploy ARM Template to resource group'
1✔
196
      inputs:
1✔
197
        azureSubscription: 'connection to Azure Portal'
1✔
198
        resourceGroupName: $(ResourceGroupName)
1✔
199
        location: '[resourceGroup().location]'
1✔
200
        csmFile: '$(build.artifactstagingdirectory)/drop/ARMTemplates/azuredeploy.json'
1✔
201
        csmParametersFile: '$(build.artifactstagingdirectory)/drop/ARMTemplates/azuredeploy.parameters.json'
1✔
202
        overrideParameters: '-environment $(AppSettings.Environment) -locationShort $(ArmTemplateResourceGroupLocation)'
1✔
203
    - task: AzureRmWebAppDeployment@3
1✔
204
      displayName: 'Azure App Service Deploy: web site'
1✔
205
      inputs:
1✔
206
        azureSubscription: 'connection to Azure Portal'
1✔
207
        WebAppName: $(WebsiteName)
1✔
208
        DeployToSlotFlag: true
1✔
209
        ResourceGroupName: $(ResourceGroupName)
1✔
210
        SlotName: 'staging'
1✔
211
        Package: '$(build.artifactstagingdirectory)/drop/MyProject.Web.zip'
1✔
212
        TakeAppOfflineFlag: true
1✔
213
        JSONFiles: '**/appsettings.json'        
1✔
214
    - task: VSTest@2
1✔
215
      displayName: 'Run functional smoke tests on website'
1✔
216
      inputs:
1✔
217
        searchFolder: '$(build.artifactstagingdirectory)'
1✔
218
        testAssemblyVer2: |
1✔
219
          **\MyProject.FunctionalTests\MyProject.FunctionalTests.dll
1✔
220
        uiTests: true
1✔
221
        runSettingsFile: '$(build.artifactstagingdirectory)/drop/FunctionalTests/MyProject.FunctionalTests/test.runsettings'
1✔
222
    - task: AzureAppServiceManage@0
1✔
223
      displayName: 'Swap Slots: website'
1✔
224
      inputs:
1✔
225
        azureSubscription: 'connection to Azure Portal'
1✔
226
        WebAppName: $(WebsiteName)
1✔
227
        ResourceGroupName: $(ResourceGroupName)
1✔
228
        SourceSlot: 'staging'
1✔
229
";
1✔
230
            return yaml;
1✔
231
        }
1✔
232

233
        public static string DockerExample()
234
        {
1✔
235
            string yaml = @"
1✔
236
trigger:
1✔
237
- main
1✔
238

1✔
239
resources:
1✔
240
- repo: self
1✔
241

1✔
242
variables:
1✔
243
  # Container registry service connection established during pipeline creation
1✔
244
  dockerRegistryServiceConnection: '{{ containerRegistryConnection.Id }}'
1✔
245
  imageRepository: '{{#toAlphaNumericString imageRepository 50}}{{/toAlphaNumericString}}'
1✔
246
  containerRegistry: '{{ containerRegistryConnection.Authorization.Parameters.loginServer }}'
1✔
247
  dockerfilePath: '{{ dockerfilePath }}'
1✔
248
  tag: '$(Build.BuildId)'
1✔
249

1✔
250
jobs:
1✔
251
- job: BuildJob
1✔
252
  displayName: Build and push
1✔
253
  pool:
1✔
254
    vmImage: ubuntu-latest
1✔
255
  steps:
1✔
256
  - task: Docker@2
1✔
257
    displayName: Build and push an image to container registry
1✔
258
    inputs:
1✔
259
      command: buildAndPush
1✔
260
      repository: $(imageRepository)
1✔
261
      dockerfile: $(dockerfilePath)
1✔
262
      containerRegistry: $(dockerRegistryServiceConnection)
1✔
263
      tags: |
1✔
264
        $(tag)
1✔
265
";
1✔
266
            return yaml;
1✔
267
        }
1✔
268

269
        //https://github.com/microsoft/azure-pipelines-yaml/blob/master/templates/.net-desktop.yml
270
        public static string DotNetFrameworkDesktopExample()
271
        {
1✔
272
            string yaml = @"
1✔
273
# .NET Desktop
1✔
274
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
1✔
275
# Add steps that publish symbols, save build artifacts, and more:
1✔
276
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
1✔
277

1✔
278
trigger:
1✔
279
- main
1✔
280

1✔
281
pool:
1✔
282
  vmImage: 'windows-latest'
1✔
283

1✔
284
variables:
1✔
285
  solution: '**/MyProject.sln'
1✔
286
  buildPlatform: 'Any CPU'
1✔
287
  buildConfiguration: 'Release'
1✔
288

1✔
289
steps:
1✔
290
- task: NuGetToolInstaller@1
1✔
291

1✔
292
- task: NuGetCommand@2
1✔
293
  inputs:
1✔
294
    restoreSolution: '$(solution)'
1✔
295

1✔
296
- task: VSBuild@1
1✔
297
  inputs:
1✔
298
    solution: '$(solution)'
1✔
299
    platform: '$(buildPlatform)'
1✔
300
    configuration: '$(buildConfiguration)'
1✔
301
";
1✔
302
            return yaml;
1✔
303
        }
1✔
304

305
        //https://github.com/microsoft/azure-pipelines-yaml/blob/master/templates/android.yml
306
        public static string GradleExample()
307
        {
1✔
308
            string yaml = @"
1✔
309
# Android
1✔
310
# Build your Android project with Gradle.
1✔
311
# Add steps that test, sign, and distribute the APK, save build artifacts, and more:
1✔
312
# https://docs.microsoft.com/azure/devops/pipelines/languages/android
1✔
313

1✔
314
trigger:
1✔
315
- main
1✔
316

1✔
317
pool:
1✔
318
  vmImage: 'macos-latest'
1✔
319

1✔
320
steps:
1✔
321
- task: Gradle@2
1✔
322
  inputs:
1✔
323
    workingDirectory: ''
1✔
324
    gradleWrapperFile: 'gradlew'
1✔
325
    gradleOptions: '-Xmx3072m'
1✔
326
    publishJUnitResults: false
1✔
327
    testResultsFiles: '**/TEST-*.xml'
1✔
328
    tasks: 'assembleDebug'
1✔
329
";
1✔
330
            return yaml;
1✔
331
        }
1✔
332

333
        //https://github.com/microsoft/azure-pipelines-yaml/blob/master/templates/asp.net-core.yml
334
        public static string ASPDotNetCoreSimpleExample()
335
        {
1✔
336
            string yaml = @"
1✔
337
# ASP.NET Core
1✔
338
# Build and test ASP.NET Core projects targeting .NET Core.
1✔
339
# Add steps that run tests, create a NuGet package, deploy, and more:
1✔
340
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
1✔
341

1✔
342
trigger:
1✔
343
- main
1✔
344

1✔
345
pool:
1✔
346
  vmImage: 'ubuntu-latest'
1✔
347

1✔
348
variables:
1✔
349
  buildConfiguration: 'Release'
1✔
350

1✔
351
steps:
1✔
352
- script: dotnet build --configuration $(buildConfiguration)
1✔
353
  displayName: 'dotnet build $(buildConfiguration)'
1✔
354
";
1✔
355
            return yaml;
1✔
356
        }
1✔
357

358
        //https://github.com/microsoft/azure-pipelines-yaml/blob/master/templates/ant.yml
359
        public static string AntExample()
360
        {
1✔
361
            string yaml = @"
1✔
362
# Ant
1✔
363
# Build your Java projects and run tests with Apache Ant.
1✔
364
# Add steps that save build artifacts and more:
1✔
365
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
1✔
366

1✔
367
trigger:
1✔
368
- main
1✔
369

1✔
370
pool:
1✔
371
  vmImage: 'ubuntu-latest'
1✔
372

1✔
373
steps:
1✔
374
- task: Ant@1
1✔
375
  inputs:
1✔
376
    workingDirectory: ''
1✔
377
    buildFile: 'build.xml'
1✔
378
    javaHomeOption: 'JDKVersion'
1✔
379
    jdkVersionOption: '1.8'
1✔
380
    jdkArchitectureOption: 'x64'
1✔
381
";
1✔
382
            return yaml;
1✔
383
        }
1✔
384

385
        public static string ASPDotNetFrameworkExample()
386
        {
1✔
387
            string yaml = @"
1✔
388
ASPDotNetFrameworkExample Coming soon
1✔
389
";
1✔
390
            return yaml;
1✔
391
        }
1✔
392

393
        public static string NodeExample()
394
        {
1✔
395
            string yaml = @"
1✔
396
trigger:
1✔
397
- main
1✔
398

1✔
399
pool:
1✔
400
  vmImage: 'ubuntu-latest'
1✔
401

1✔
402
steps:
1✔
403
- task: NodeTool@0
1✔
404
  inputs:
1✔
405
    versionSpec: '10.x'
1✔
406
  displayName: 'Install Node.js'
1✔
407

1✔
408
- script: |
1✔
409
    npm install
1✔
410
    npm start
1✔
411
  displayName: 'npm install and start'
1✔
412
";
1✔
413
            return yaml;
1✔
414
        }
1✔
415

416
        public static string MavenExample()
417
        {
1✔
418
            string yaml = @"
1✔
419
trigger:
1✔
420
- main
1✔
421

1✔
422
pool:
1✔
423
  vmImage: 'ubuntu-latest'
1✔
424

1✔
425
steps:
1✔
426
- task: Maven@3
1✔
427
  inputs:
1✔
428
    mavenPomFile: 'pom.xml'
1✔
429
    mavenOptions: '-Xmx3072m'
1✔
430
    javaHomeOption: 'JDKVersion'
1✔
431
    jdkVersionOption: '1.8'
1✔
432
    jdkArchitectureOption: 'x64'
1✔
433
    publishJUnitResults: true
1✔
434
    testResultsFiles: '**/surefire-reports/TEST-*.xml'
1✔
435
    goals: 'package'
1✔
436
";
1✔
437
            return yaml;
1✔
438
        }
1✔
439

440
        public static string PythonExample()
441
        {
1✔
442
            string yaml = @"
1✔
443
trigger:
1✔
444
- main
1✔
445

1✔
446
pool:
1✔
447
  vmImage: 'ubuntu-latest'
1✔
448
strategy:
1✔
449
  matrix:
1✔
450
    Python35:
1✔
451
      PYTHON_VERSION: '3.5'
1✔
452
    Python36:
1✔
453
      PYTHON_VERSION: '3.6'
1✔
454
    Python37:
1✔
455
      PYTHON_VERSION: '3.7'
1✔
456
  maxParallel: 3
1✔
457

1✔
458
steps:
1✔
459
- task: UsePythonVersion@0
1✔
460
  inputs:
1✔
461
    versionSpec: '$(PYTHON_VERSION)'
1✔
462
    addToPath: true
1✔
463
    architecture: 'x64'
1✔
464
- task: PythonScript@0
1✔
465
  inputs:
1✔
466
    scriptSource: 'filePath'
1✔
467
    scriptPath: 'Hello.py'
1✔
468
";
1✔
469
            return yaml;
1✔
470
        }
1✔
471

472
        public static string RubyExample()
473
        {
1✔
474
            string yaml = @"
1✔
475
trigger:
1✔
476
- main
1✔
477

1✔
478
pool:
1✔
479
  vmImage: 'ubuntu-latest'
1✔
480

1✔
481
steps:
1✔
482
- task: UseRubyVersion@0
1✔
483
  inputs:
1✔
484
    versionSpec: '>= 2.5'
1✔
485
- script: ruby HelloWorld.rb
1✔
486
";
1✔
487
            return yaml;
1✔
488
        }
1✔
489

490
    }
491
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc