Skip to content

Commit

Permalink
Add the GitHub action to check bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
eason9487 committed Oct 6, 2021
1 parent c411065 commit 56ee88b
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Bundle Size

on:
pull_request:

jobs:
BundleSize:
name: Bundle size
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
coverage: none

- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: "12.21.0"
cache: "npm"

- name: Log debug information
run: |
php --version
composer --version
node --version
npm --version
- name: Get Composer cache directory
id: composer-cache-config
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Set up Composer caching
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache-config.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Node dependencies
run: npm ci

- name: Build production bundle
run: |
echo "::group::Build log"
npm run build
echo "::endgroup::"
- name: Run BundleWatch
env:
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
# Workaround of https://github.com/bundlewatch/bundlewatch/issues/423
CI_BRANCH_BASE: ${{ github.base_ref }}
# Workaround of https://github.com/bundlewatch/bundlewatch/issues/220
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
run: node ./node_modules/bundlewatch/lib/bin/index.js

0 comments on commit 56ee88b

Please sign in to comment.