forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
154 lines (135 loc) · 4.89 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
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)/'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
node scripts/use-react-dist-tag.js $(REACT_DIST_TAG)
yarn install
displayName: 'install dependencies'
- task: Cache@2
inputs:
key: 'node-modules-cache | yarn.lock'
path: node_modules/.cache
displayName: Cache node_modules/.cache
- 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 @material-ui/icons --parallel --scope "@material-ui/*" build
displayName: 'build @material-ui packages'
- script: |
cd packages/material-ui/build
npm version 0.0.0-canary.$(Build.SourceVersion) --no-git-tag-version
npm pack
mv material-ui-core-0.0.0-canary.$(Build.SourceVersion).tgz ../../../material-ui-core.tgz
displayName: 'create @material-ui/core 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: 'material-ui-core.tgz'
- task: Cache@2
inputs:
key: 'nextjs-build | yarn.lock'
path: $(DOCS_NEXT_CACHE_FOLDER)
displayName: Cache nextjs build
- script: |
mkdir -p scripts/sizeSnapshot/build
yarn docs:build | tee scripts/sizeSnapshot/build/docs.next
displayName: 'build docs for size snapshot'
env:
NODE_OPTIONS: '--max_old_space_size=4096'
- 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)