74 lines
2.0 KiB
YAML
74 lines
2.0 KiB
YAML
name: Compare JS bundle size
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'app/javascript/**'
|
|
- 'vite.config.mts'
|
|
- 'package.json'
|
|
- 'yarn.lock'
|
|
- .github/workflows/bundlesize-compare.yml
|
|
|
|
jobs:
|
|
build-head:
|
|
name: 'Build head'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
env:
|
|
ANALYZE_BUNDLE_SIZE: '1'
|
|
steps:
|
|
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
|
|
|
|
- name: Set up Javascript environment
|
|
uses: ./.github/actions/setup-javascript
|
|
|
|
- name: Build
|
|
run: yarn run build:production
|
|
|
|
- name: Upload stats.json
|
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
|
|
with:
|
|
name: head-stats
|
|
path: ./stats.json
|
|
if-no-files-found: error
|
|
|
|
build-base:
|
|
name: 'Build base'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
env:
|
|
ANALYZE_BUNDLE_SIZE: '1'
|
|
steps:
|
|
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
|
|
with:
|
|
ref: ${{ github.base_ref }}
|
|
|
|
- name: Set up Javascript environment
|
|
uses: ./.github/actions/setup-javascript
|
|
|
|
- name: Build
|
|
run: yarn run build:production
|
|
|
|
- name: Upload stats.json
|
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
|
|
with:
|
|
name: base-stats
|
|
path: ./stats.json
|
|
if-no-files-found: error
|
|
|
|
compare:
|
|
name: 'Compare base & head bundle sizes'
|
|
runs-on: ubuntu-latest
|
|
needs: [build-base, build-head]
|
|
permissions:
|
|
pull-requests: write
|
|
steps:
|
|
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
|
|
|
|
- uses: twk3/rollup-size-compare-action@5d3e409fcfe15d8ebb0edfe87e772c04b287f660 # v1.0.0
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
current-stats-json-path: ./head-stats/stats.json
|
|
base-stats-json-path: ./base-stats/stats.json
|