forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
169 lines (148 loc) · 6.24 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
trigger:
branches:
include:
- 'master'
- 'next'
schedules:
- cron: '0 0 * * *'
displayName: Run with React canary
branches:
include:
- master
- next
always: true
# https://developercommunity.visualstudio.com/comments/949241/view.html
pr:
branches:
include:
- '*'
pool:
vmImage: 'ubuntu-latest'
variables:
DOCS_NEXT_CACHE_FOLDER: $(Build.SourcesDirectory)/docs/.next/cache
# azure-pipelines don't support variables per trigger
# We assume that the only scheduled job we have is for react@next
${{ if eq( variables['Build.Reason'], 'Schedule' ) }}:
# npm dist tag for `react` (https://docs.npmjs.com/cli/dist-tag)
REACT_DIST_TAG: 'next'
# Path for artifacts uploaded to S3 that can be used as a permalink
S3_ARTIFACTS_PATH_PERMA: 'artifacts/$(Build.SourceBranchName)-react-$(REACT_DIST_TAG)/$(Build.SourceVersion)/'
${{ if ne( variables['Build.Reason'], 'Schedule' ) }}:
REACT_DIST_TAG: 'stable'
# Preserve this path structure since it is locked in various tooling
S3_ARTIFACTS_PATH_PERMA: 'artifacts/$(Build.SourceBranchName)/$(Build.SourceVersion)/'
jobs:
- job: sizeSnapshot
displayName: 'Bundle size monitoring'
condition: eq(variables['command'], 'sizeSnapshot')
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'
- script: |
node scripts/use-react-dist-tag.js $(REACT_DIST_TAG)
yarn install
displayName: 'install dependencies'
env:
# Don't use playwright in this job
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- script: |
yarn danger ci
displayName: 'prepare danger on PRs'
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
env:
AZURE_BUILD_ID: $(Build.BuildId)
DANGER_COMMAND: 'prepareBundleSizeReport'
DANGER_GITHUB_API_TOKEN: $(GITHUB_API_TOKEN)
- script: |
yarn lerna run --ignore @mui/icons-material --parallel --scope "@mui/*" build
displayName: 'build @mui packages'
- script: |
cd packages/mui-material/build
npm version 0.0.0-canary.$(Build.SourceVersion) --no-git-tag-version
npm pack
mv mui-material-0.0.0-canary.$(Build.SourceVersion).tgz ../../../mui-material.tgz
displayName: 'create @mui/material canary distributable'
- task: S3Upload@1
inputs:
regionName: 'eu-central-1'
bucketName: 'eps1lon-material-ui'
globExpressions: '*.tgz'
targetFolder: $(S3_ARTIFACTS_PATH_PERMA)
filesAcl: 'public-read'
displayName: 'Upload distributables to S3'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
- task: PublishPipelineArtifact@1
inputs:
artifactName: 'canaries'
targetPath: 'mui-material.tgz'
- script: |
yarn size:snapshot
displayName: 'create a size snapshot'
- task: PublishPipelineArtifact@1
displayName: 'persist size snapshot as pipeline artifact'
inputs:
artifactName: 'size-snapshot'
targetPath: 'size-snapshot.json'
- task: AmazonWebServices.aws-vsts-tools.S3Upload.S3Upload@1
displayName: 'persist size snapshot on S3'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
awsCredentials: 's3 artifacts'
regionName: 'eu-central-1'
bucketName: 'eps1lon-material-ui'
sourceFolder: '$(System.DefaultWorkingDirectory)'
globExpressions: 'size-snapshot.json'
targetFolder: $(S3_ARTIFACTS_PATH_PERMA)
filesAcl: 'public-read'
contentType: application/json
logRequest: true
logResponse: true
- task: AmazonWebServices.aws-vsts-tools.S3Upload.S3Upload@1
displayName: 'symlink size-snapshot to latest'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne(variables['Build.Reason'], 'Schedule'))
inputs:
awsCredentials: 's3 artifacts'
regionName: 'eu-central-1'
bucketName: 'eps1lon-material-ui'
sourceFolder: '$(System.DefaultWorkingDirectory)'
globExpressions: 'size-snapshot.json'
targetFolder: 'artifacts/$(Build.SourceBranchName)/latest/'
filesAcl: 'public-read'
contentType: application/json
logRequest: true
logResponse: true
- script: |
yarn danger ci
displayName: 'run danger on PRs'
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
env:
AZURE_BUILD_ID: $(Build.BuildId)
DANGER_COMMAND: 'reportBundleSize'
DANGER_GITHUB_API_TOKEN: $(GITHUB_API_TOKEN)
- job: benchmark
displayName: 'Performance monitoring'
condition: eq(variables['command'], 'benchmark')
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'
# From https://github.com/GoogleChrome/puppeteer/blob/811415bc8c47f7882375629b57b3fe186ad61ed4/docs/troubleshooting.md#chrome-headless-doesnt-launch
- script: |
sudo apt-get update
sudo apt-get install -y --force-yes gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
displayName: 'Install dependencies for Chrome Headless'
- script: yarn install
displayName: 'install dependencies'
- script: yarn benchmark:browser
displayName: 'yarn benchmark:browser'
- task: PublishPipelineArtifact@1
displayName: 'Publish benchmark results as a pipeline artifact.'
inputs:
artifactName: 'benchmarks'
targetPath: 'tmp/benchmarks'