Development #3776
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
name: Build Size Analyzer | |
on: | |
pull_request: | |
types: [ opened, synchronize, ready_for_review ] | |
jobs: | |
build-base: | |
name: Build base | |
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source files | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Configure Composer cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install composer deps | |
run: composer install --no-dev --prefer-dist --no-progress --no-suggest | |
- name: Install npm deps | |
run: npm ci | |
- name: Build files | |
run: npm run analyzer | |
- name: Upload base stats.json | |
uses: actions/upload-artifact@v4 | |
with: | |
name: base | |
path: ./build/**/stats.json | |
retention-days: 1 | |
build-pr: | |
name: Build PR | |
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source files | |
uses: actions/checkout@v2 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Configure Composer cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install composer deps | |
run: composer install --no-dev --prefer-dist --no-progress --no-suggest | |
- name: Install npm deps | |
run: npm ci | |
- name: Build files | |
run: npm run analyzer | |
- name: Upload base stats.json | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr | |
path: ./build/**/stats.json | |
retention-days: 1 | |
report: | |
name: Generate report | |
runs-on: ubuntu-latest | |
needs: [ build-base, build-pr ] | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@v2 | |
- name: Download base stats | |
uses: actions/download-artifact@v4 | |
with: | |
name: base | |
path: base | |
- name: Download PR stats | |
uses: actions/download-artifact@v4 | |
with: | |
name: pr | |
path: pr | |
- name: Get Animation diff | |
id: get-animation-diff | |
uses: NejcZdovc/bundle-size-diff@v1 | |
with: | |
base_path: './base/animation/stats.json' | |
pr_path: './pr/animation/stats.json' | |
- name: Get Blocks diff | |
id: get-blocks-diff | |
uses: NejcZdovc/bundle-size-diff@v1 | |
with: | |
base_path: './base/blocks/stats.json' | |
pr_path: './pr/blocks/stats.json' | |
- name: Get CSS diff | |
id: get-css-diff | |
uses: NejcZdovc/bundle-size-diff@v1 | |
with: | |
base_path: './base/css/stats.json' | |
pr_path: './pr/css/stats.json' | |
- name: Get Dashboard diff | |
id: get-dashboard-diff | |
uses: NejcZdovc/bundle-size-diff@v1 | |
with: | |
base_path: './base/dashboard/stats.json' | |
pr_path: './pr/dashboard/stats.json' | |
- name: Get Onboarding diff | |
id: get-onboarding-diff | |
uses: NejcZdovc/bundle-size-diff@v1 | |
with: | |
base_path: './base/onboarding/stats.json' | |
pr_path: './pr/onboarding/stats.json' | |
- name: Get Export Import diff | |
id: get-export-import-diff | |
uses: NejcZdovc/bundle-size-diff@v1 | |
with: | |
base_path: './base/export-import/stats.json' | |
pr_path: './pr/export-import/stats.json' | |
- name: Get Pro diff | |
id: get-pro-diff | |
uses: NejcZdovc/bundle-size-diff@v1 | |
with: | |
base_path: './base/pro/stats.json' | |
pr_path: './pr/pro/stats.json' | |
- name: Comment | |
uses: NejcZdovc/comment-pr@v1 | |
with: | |
file: 'comment.md' | |
identifier: "GITHUB_BUILD_SIZE" | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
OLD_ANIMATION: ${{ steps.get-animation-diff.outputs.base_file_string }} | |
NEW_ANIMATION: ${{ steps.get-animation-diff.outputs.pr_file_string }} | |
DIFF_ANIMATION: ${{ steps.get-animation-diff.outputs.diff_file_string }} | |
DIFF_PERCENT_ANIMATION: ${{ steps.get-animation-diff.outputs.percent }} | |
OLD_BLOCKS: ${{ steps.get-blocks-diff.outputs.base_file_string }} | |
NEW_BLOCKS: ${{ steps.get-blocks-diff.outputs.pr_file_string }} | |
DIFF_BLOCKS: ${{ steps.get-blocks-diff.outputs.diff_file_string }} | |
DIFF_PERCENT_BLOCKS: ${{ steps.get-blocks-diff.outputs.percent }} | |
OLD_CSS: ${{ steps.get-css-diff.outputs.base_file_string }} | |
NEW_CSS: ${{ steps.get-css-diff.outputs.pr_file_string }} | |
DIFF_CSS: ${{ steps.get-css-diff.outputs.diff_file_string }} | |
DIFF_PERCENT_CSS: ${{ steps.get-css-diff.outputs.percent }} | |
OLD_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.base_file_string }} | |
NEW_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.pr_file_string }} | |
DIFF_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.diff_file_string }} | |
DIFF_PERCENT_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.percent }} | |
OLD_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.base_file_string }} | |
NEW_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.pr_file_string }} | |
DIFF_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.diff_file_string }} | |
DIFF_PERCENT_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.percent }} | |
OLD_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.base_file_string }} | |
NEW_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.pr_file_string }} | |
DIFF_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.diff_file_string }} | |
DIFF_PERCENT_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.percent }} | |
OLD_PRO: ${{ steps.get-pro-diff.outputs.base_file_string }} | |
NEW_PRO: ${{ steps.get-pro-diff.outputs.pr_file_string }} | |
DIFF_PRO: ${{ steps.get-pro-diff.outputs.diff_file_string }} | |
DIFF_PERCENT_PRO: ${{ steps.get-pro-diff.outputs.percent }} |