-
Notifications
You must be signed in to change notification settings - Fork 61
63 lines (51 loc) · 1.64 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
name: Bundle size
on:
push:
branches:
- main
pull_request:
jobs:
bundle-size:
runs-on: ubuntu-latest
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@v3
- uses: actions/setup-node@v4
with:
cache: yarn
node-version: '20'
- run: yarn install --immutable
#
# Steps for PRs
#
- name: Measure affected packages
if: ${{ github.event_name == 'pull_request' }}
run: yarn nx affected --target=bundle-size --parallel --max-parallel=2
- name: Compare results with "main" branch
if: ${{ github.event_name == 'pull_request' }}
run: |
npx monosize compare-reports --branch main --output markdown --quiet > monosize.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.md
pr.txt
#
# Steps for "main" branch
#
- name: Measure all packages
if: ${{ github.event_name != 'pull_request' }}
run: yarn nx run-many --all --target=bundle-size --parallel --max-parallel=2
- name: Upload results
if: ${{ github.event_name != 'pull_request' }}
run: yarn monosize upload-report --branch main --commit-sha $GITHUB_SHA
env:
UPSTASH_WRITE_TOKEN: ${{ secrets.UPSTASH_WRITE_TOKEN }}