Skip to content

Commit

Permalink
test: Добавлен плагин
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniysemin committed Nov 24, 2023
1 parent 6ad181f commit 1a5814e
Show file tree
Hide file tree
Showing 6 changed files with 835 additions and 27 deletions.
96 changes: 78 additions & 18 deletions .github/workflows/bundle-size.yml
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:
Expand All @@ -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 }}
27 changes: 27 additions & 0 deletions .size-snapshot.json
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
}
}
Loading

0 comments on commit 1a5814e

Please sign in to comment.