-
Notifications
You must be signed in to change notification settings - Fork 8
/
azure-pipelines.bundlesize.yml
72 lines (60 loc) · 2.01 KB
/
azure-pipelines.bundlesize.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
pr:
- main
trigger:
- main
variables:
${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/heads/')) }}:
isPR: true
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/') }}:
isPR: false
jobs:
- job: Bundle_Size
workspace:
clean: all
pool: '1ES-Host-Ubuntu'
steps:
- task: NodeTool@0
inputs:
versionSpec: '18.16.0'
checkLatest: false
displayName: 'Install Node.js'
- script: |
npm ci
displayName: Install dependencies
- script: |
npm run bundle-size
displayName: Measure bundle size
#
# Steps for PRs
#
- script: |
npx monosize compare-reports --branch=$(System.PullRequest.TargetBranch) --output=markdown --quiet > ./monosize.md --report-files-glob="dist/bundle-size/monosize.json"
displayName: Compare bundle-size with base (PR Only)
condition: eq(variables.isPR, true)
- task: GithubPRComment@0
displayName: Post results to PR (PR only)
condition: eq(variables.isPR, true)
inputs:
githubOwner: microsoft
githubRepo: 'keyborg'
blobFilePath: 'monosize.md'
status: 'success'
uniqueId: 'bundleSizeComment6497'
#
# Steps for "main" branch
#
- task: AzureCLI@2
displayName: Upload results (CI Only)
condition: eq(variables.isPR, false)
env:
BUNDLESIZE_ACCOUNT_NAME: $(StorageAccount)
AZURE_TENANT_ID: $(AzureTenantId)
AZURE_CLIENT_ID: $(AzureClientId)
AZURE_SERVICE_CONNECTION_ID: $(AzureServiceConnectionId)
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs:
azureSubscription: 'Bundlesize Testing'
scriptType: bash
scriptLocation: 'inlineScript'
inlineScript: |
npx monosize upload-report --branch=$(Build.SourceBranchName) --commit-sha $(Build.SourceVersion) --report-files-glob="dist/bundle-size/monosize.json"