-
Notifications
You must be signed in to change notification settings - Fork 64
/
azure-pipelines.yml
108 lines (99 loc) · 4.85 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# This file defines an Azure Pipelines build, which you can configure on https://dev.azure.com
# to run automatically with each Pull Request update and/or each commit to your repository.
# In this example, we do not change the default "trigger" behavior, so this build gets run
# for all commits/PRs to all branches of the axe-pipelines-samples repository.
#
# If you already have an Azure Pipelines build for your project, we recommend integrating
# your new accessibility tests into it, rather than creating a separate pipeline. Pipelines
# builds are usually defined in files like this one named "azure-pipelines.yml" or "build.yaml",
# but some projects use different file names.
#
# If you are using an Azure Pipelines build with tasks configured using the GUI on https://dev.azure.com,
# instead of a checked in YAML file, you can add the same tasks listed below from the GUI. However, we
# strongly recommend switching to using a checked in YAML file.
#
# Most C# projects with an Azure Pipelines build will already have most of the steps shown below
#
# If you *don't* already have an Azure Pipelines build, we recommend following Azure Pipelines'
# documentation at https://docs.microsoft.com/en-us/azure/devops/pipelines/create-first-pipeline
# (using this sample as your starter code).
#
# For more information, see:
# * https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started
# * https://docs.microsoft.com/en-us/azure/devops/pipelines/customize-pipeline
# The browser automation tool we're using, Selenium, works with many different browsers. Here, we show
# an example of using the same test code with different combinations of browsers and OSes.
#
# For more information, see:
# * https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started-multiplatform# Copyright (c) Microsoft Corporation. All rights reserved.
parameters:
- name: strategy
type: object
default:
- name: win_chrome
imageName: windows-2022-secure
browser: chrome
os: windows
- name: linux_firefox
imageName: ubuntu-20.04
browser: firefox
os: linux
# The `resources` specify the location and version of the 1ES PT.
resources:
repositories:
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Unofficial.PipelineTemplate.yml@1esPipelines
parameters:
settings:
skipBuildTagsForGitHubPullRequests: true
pool:
name: $(a11yInsightsPool) # Name of your hosted pool
image: windows-2022-secure # Name of the image in your pool. If not specified, first image of the pool is used
os: windows
stages:
- stage: Stage
jobs:
- ${{ each item in parameters.strategy }}:
- job: Job_${{ item.name }}
pool:
name: $(a11yInsightsPool)
image: ${{ item.imageName }}
os: ${{ item.os }}
variables:
# This will be sent to the build agent as an environment variable which our test code will be able to see.
# We'll use this environment variable in WebDriverFactory.cs to determine which browser the tests will use.
SELENIUM_BROWSER: ${{ item.browser }}
# This skips unnecessary steps during dotnet restore and saves ~30-60s
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: '1'
steps:
# This task makes sure .NET Core SDK is installed on the build agent.
#
# It is a good idea to test against a specific, known version of .NET SDK; this makes it easier for other users
# to reproduce your build results.
- task: UseDotNet@2
displayName: install .NET 6.0.415
inputs:
version: '6.0.415'
- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: restore
projects: $(Build.SourcesDirectory)/csharp-selenium-webdriver-sample/**/*.csproj
# Using DotNetCoreCLI rather than a "script" step that runs "dotnet test" makes it easier to publish the test results
# to see along with the rest of the build details in the Azure Pipelines web UI.
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: $(Build.SourcesDirectory)/csharp-selenium-webdriver-sample/**/*.csproj
publishTestResults: true
testRunTitle: "dotnet test (${{ item.imageName }} ${{ item.browser }})"
# We use this EXTRA_DOTNET_TEST_ARGUMENTS variable in the sample's CI/PR builds so the "success" examples can --filter
# out the tests that intentionally fail for example purposes. You probably don't need this in a real project.
arguments: $(EXTRA_DOTNET_TEST_ARGUMENTS)