Skip to content

chore: adds snapshot tests to main test utils wrappers #7126

chore: adds snapshot tests to main test utils wrappers

chore: adds snapshot tests to main test utils wrappers #7126

Workflow file for this run

name: Measure bundle size
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
statuses: write
jobs:
measure:
runs-on: ubuntu-latest
steps:
# ------- Setup -----------------------------------------------------
- name: Checkout the PR branch
uses: actions/checkout@v4
with:
path: 'components'
- name: Setup the bundle measurement project
run: |
cp -r components/.github/workflows/bundle-size bundle-size
cd bundle-size
npm i --force
- uses: actions/github-script@v7
name: Create a pending status on the commit
with:
script: |
const { statusReportStart } = await import(process.cwd() + '/bundle-size/status-report.js');
await statusReportStart({ context, github });
# ------- Base branch size measurement ------------------------------
- name: Checkout the base branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
path: 'components'
- name: Measure the bundle size of the base branch
run: |
cd components
npm i --force
npm run quick-build
cd ../bundle-size
npm run build
mv output.json output-basebranch.json
cat output-basebranch.json
# ------- Pull request size measurement -----------------------------
- name: Checkout the PR branch
uses: actions/checkout@v4
with:
path: 'components'
- name: Measure the bundle size of this PR
id: measure
run: |
cd components
npm i --force
npm run quick-build
cd ../bundle-size
npm run build
cat output.json
- name: Upload size report artifact
uses: actions/upload-artifact@v4
with:
name: size-report
path: bundle-size/output.json
- name: Update the commit status with calculated results
uses: actions/github-script@v7
with:
script: |
const { statusReportSuccess } = await import(process.cwd() + '/bundle-size/status-report.js');
await statusReportSuccess({ context, github });
# ------- Error reporting -------------------------------------------
- name: Report failure
if: failure()
uses: actions/github-script@v7
with:
script: |
const { statusReportFailure } = await import(process.cwd() + '/bundle-size/status-report.js');
await statusReportFailure({ context, github });