-
Notifications
You must be signed in to change notification settings - Fork 2.8k
130 lines (109 loc) · 4.54 KB
/
bundle-size.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
name: Bundle size
on:
push:
branches:
- main
pull_request:
concurrency:
# see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NX_PARALLEL: 6 # ubuntu-latest = 4-core CPU / 16 GB of RAM | macos-14-xlarge (arm) = 6-core CPU / 14 GB of RAM
NX_PREFER_TS_NODE: true
NX_VERBOSE_LOGGING: true
BROWSERSLIST_IGNORE_OLD_DATA: true
# Deploy host and URL
# DEPLOY_BASE_PATH: ''
DEPLOY_HOST: fluentuipr.z22.web.core.windows.net
DEPLOY_URL: https://fluentuipr.z22.web.core.windows.net/${{ github.event.pull_request.number || github.ref_name }}
# DEPLOYHOST: fluentuipr.z22.web.core.windows.net
# DEPLOYURL: https://${{ env.DEPLOYHOST }}/
# GitHub Secrets for Azure access
# This service principal ("subscription" is a misleading name) only has access to the fluentuipr storage account
AZURE_SUBSCRIPTION: Azure PR deploy - NEW
AZURE_STORAGE: fluentuipr
IS_PR: ${{ github.event_name == 'pull_request' }}
TARGET_BRANCH: ${{ github.event.pull_request.base.ref || '' }}
DEPLOY_BASE_PATH: pull/${{github.event.pull_request.number}}
# DEPLOY_BASE_PATH: ${{ github.event.pull_request.number ? 'pull/' + github.event.pull_request.number : 'heads/' + github.ref_name }}
# SKIP_COMPONENT_GOVERNANCE_DETECTION: true
jobs:
bundle-size:
runs-on: ubuntu-latest
# runs-on: macos-14-xlarge
permissions:
contents: 'read'
actions: 'read'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: 'master'
- uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version: '20'
- run: echo number of CPUs "$(getconf _NPROCESSORS_ONLN)"
- run: yarn install --frozen-lockfile
- name: Build packages & create reports (PR only)
if: github.event_name == 'pull_request'
run: yarn nx affected -t bundle-size --nxBail
- name: Compare bundle size with base (PR only)
if: github.event_name == 'pull_request'
run: npx monosize compare-reports --branch=${{ github.event.pull_request.base.ref }} --output=markdown --quiet > ./monosize-report.md
- name: Save PR number
run: echo ${{ github.event.number }} > pr.txt
- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' }}
with:
name: monosize-report
if-no-files-found: error
path: |
monosize-report.md
pr.txt
# - name: Read the monosize report
# id: read_report
# if: ${{ github.event_name == 'pull_request' }}
# run: |
# if [ -f monosize-report.md ]; then
# report=$(cat monosize-report.md)
# echo "report<<EOF" >> $GITHUB_ENV
# echo "$report" >> $GITHUB_ENV
# echo "EOF" >> $GITHUB_ENV
# else
# echo "No report found"
# fi
# - name: Post results to PR (PR only)
# if: github.event_name == 'pull_request'
# uses: actions/github-script@v7
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }} # Use a GitHub token (this is automatically provided)
# script: |
# const run = require('./.github/bundle-size-comment');
# await run({github,context,core});
# - name: Post results to PR (PR only)
# if: github.event_name == 'pull_request'
# uses: marocchino/sticky-pull-request-comment@v2
# with:
# path: monosize-report.md
- name: Build all packages & create reports (non-PR)
if: github.event_name != 'pull_request'
run: yarn nx run-many -t bundle-size --nxBail
- name: Upload a report (base only)
continue-on-error: true
if: github.event_name != 'pull_request'
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
yarn monosize upload-report --branch=${{ github.ref }} --commit-sha ${{ github.sha }}
env:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_SERVICE_CONNECTION_ID: ${{ secrets.AZURE_SERVICE_CONNECTION_ID }}
BUNDLESIZE_ACCOUNT_NAME: ${{ secrets.BUNDLESIZE_ACCOUNT_NAME }}
SYSTEM_ACCESSTOKEN: ${{ secrets.GITHUB_TOKEN }}