-
Notifications
You must be signed in to change notification settings - Fork 64
/
azure-pipelines.yml
135 lines (127 loc) · 6.54 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
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
# 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 TypeScript projects with an Azure Pipelines build will already have most of the steps
# shown below, with the exception of the final "PublishBuildArtifact" task; you'll probably
# have to add that.
#
# 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, Playwright, 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
# * https://playwright.dev/docs/test-intro
parameters:
- name: strategy
type: object
default:
- name: win_chromium
imageName: windows-2022-secure
browser: chromium
os: windows
- name: linux_firefox
imageName: ubuntu-22.04-secure
browser: firefox
os: linux
- name: mac_webkit
imageName: macOS-13
browser: webkit
os: macOS
# 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
# Update the pool with your team's 1ES hosted pool.
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 # OS of the image. Allowed values: windows, linux, macOS
stages:
- stage: Stage
jobs:
- ${{ each item in parameters.strategy }}:
- job: Job_${{ item.name }}
pool:
image: ${{ item.imageName }}
os: ${{ item.os }}
${{ if or(eq(item.os,'linux'),eq(item.os, 'windows'))}} :
name: $(a11yInsightsPool)
${{ else }} :
name: Azure Pipelines
templateContext:
# If you are adding tests to an existing project that already uses Azure Pipelines, this is probably the only
# new task you'll need to add.
#
# This task is how the "Scans" tab in our Azure Pipelines build results page gets its data. It requires using
# PublishBuildArtifacts rather than the newer PublishPipelineArtifacts.
outputs:
- output: buildArtifacts
# The exact name "CodeAnalysisLogs" is required for the Sarif Results Viewer Extension for Azure Pipelines
# to find the .sarif files our accessibility test produces.
displayName: publish sarif results
# "test-results" is not a required convention; it just happens to be where our tests write .sarif files to.
PathtoPublish: $(Build.SourcesDirectory)/typescript-playwright-sample/test-results
ArtifactName: CodeAnalysisLogs
condition: succeededOrFailed()
# This task makes sure Node.js is installed on the build agent.
#
# It is a good idea to test against a specific, known version of Node; this makes it easier for other users
# to reproduce your build results.
steps:
- task: NodeTool@0
displayName: install node 20.8.1
inputs:
versionSpec: "20.8.1"
# This task installs dependencies specified in your package.json file.
#
# Our sample uses Yarn for this, but if your project uses NPM instead, that's also fine.
- script: yarn install --frozen-lockfile # or "npm install --ci"
displayName: yarn install
# workingDirectory should match where your package.json file is located. It defaults to the root of the repository.
workingDirectory: $(Build.SourcesDirectory)/typescript-playwright-sample
# This task runs the tests specified by playwright.config.js, including our example accessibility tests.
#
# If your project already uses npm instead of yarn, or if your project already runs "playwright test" directly here,
# those are both fine.
#
# We use the EXTRA_PLAYWRIGHT_TEST_ARGUMENTS variable in the sample's CI/PR builds to separate our passing and failing
# example builds using Playwright Test's --project argument. You probably don't need EXTRA_PLAYWRIGHT_TEST_ARGUMENTS in
# a real project.
- script: yarn test --browser=${{ item.browser }} $(EXTRA_PLAYWRIGHT_TEST_ARGUMENTS) # or "npm run test -- --browser=$(browser)"
displayName: yarn test
workingDirectory: $(Build.SourcesDirectory)/typescript-playwright-sample
# This task is how the "Tests" tab in our Azure Pipelines build results page gets its data
- task: PublishTestResults@2
displayName: publish test results
inputs:
testResultsFiles: $(Build.SourcesDirectory)/typescript-playwright-sample/test-results/junit.xml
testRunTitle: typescript-playwright-sample (${{ item.imageName }} ${{ item.browser }})
condition: succeededOrFailed()