-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ad181f
commit 1a5814e
Showing
6 changed files
with
835 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,39 @@ | ||
name: Bundle_Size | ||
# name: Bundle_Size | ||
|
||
# on: | ||
# push: | ||
# branches: | ||
# - '*' | ||
# - '!master' | ||
|
||
# jobs: | ||
# bundle-size: | ||
# name: Bundle_Size | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Use Node.js 18.x | ||
# uses: actions/setup-node@v1 | ||
# with: | ||
# node-version: 18.x | ||
|
||
# - name: Checkout current | ||
# uses: actions/checkout@v3 | ||
|
||
# - name: Clone master | ||
# uses: actions/checkout@v3 | ||
# with: | ||
# ref: 'master' # branch to compare to | ||
# path: br-base # required | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# - name: Bundle size report | ||
# id: bundleSize | ||
# uses: nejcm/[email protected] | ||
# with: | ||
# paths: '/esm/*.js' | ||
# onlyDiff: 'true' | ||
|
||
name: 'Bundle size reporter' | ||
|
||
on: | ||
push: | ||
|
@@ -7,28 +42,53 @@ on: | |
- '!master' | ||
|
||
jobs: | ||
bundle-size: | ||
name: Bundle_Size | ||
composite: | ||
name: 'composite' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 18.x | ||
|
||
- name: Checkout current | ||
uses: actions/checkout@v3 | ||
|
||
- name: Clone master | ||
# Checkout branch to compare to [required] | ||
- name: Checkout base branch | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: 'master' # branch to compare to | ||
path: br-base # required | ||
ref: 'bundle-size-showing-file' | ||
path: br-base | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Bundle size report | ||
# Generate the bundle size difference report [required] | ||
- name: Generate report | ||
id: bundleSize | ||
uses: nejcm/[email protected] | ||
uses: nejcm/[email protected] | ||
with: | ||
paths: '.size-snapshot.json' | ||
onlyDiff: 'false' | ||
|
||
# Post github action summary | ||
- name: Post summary | ||
if: ${{ steps.bundleSize.outputs.hasDifferences == 'true' }} # post only in case of changes | ||
run: | | ||
echo '${{ steps.bundleSize.outputs.summary }}' >> $GITHUB_STEP_SUMMARY | ||
shell: bash | ||
|
||
- name: Get pull request number | ||
uses: actions/github-script@v7 | ||
id: pr_number | ||
with: | ||
script: | | ||
const data = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | ||
commit_sha: context.sha, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
return data.data[0].number.toString(); | ||
result-encoding: string | ||
|
||
# Post github action comment | ||
- name: Post comment | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
if: ${{ steps.bundleSize.outputs.hasDifferences == 'true' }} # post only in case of changes | ||
with: | ||
paths: '/esm/*.js' | ||
onlyDiff: 'true' | ||
number: ${{ steps.pr_number.outputs.result }} | ||
header: 'Bundle size report' | ||
message: '${{ steps.bundleSize.outputs.summary }}' | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"index.js": { | ||
"bundled": 68391, | ||
"minified": 18748, | ||
"gzipped": 6091 | ||
}, | ||
"assistant-!~{001}~.js": { | ||
"bundled": 414989, | ||
"minified": 110354, | ||
"gzipped": 27055 | ||
}, | ||
"createAssistantDevOrigin.js": { | ||
"bundled": 100683, | ||
"minified": 90454, | ||
"gzipped": 50063 | ||
}, | ||
"assistant.development.min.js": { | ||
"bundled": 210132, | ||
"minified": 210047, | ||
"gzipped": 90494 | ||
}, | ||
"assistant.production.min.js": { | ||
"bundled": 12127, | ||
"minified": 12107, | ||
"gzipped": 4351 | ||
} | ||
} |
Oops, something went wrong.