Display bundle size changes in comments on opened PRs (#1205)

This commit is contained in:
Jed Fox
2023-06-27 12:46:27 -04:00
committed by GitHub
parent aa503d6a74
commit 081c9d068f
14 changed files with 220 additions and 31 deletions

View File

@@ -12,7 +12,6 @@ on:
branches:
- master
pull_request:
branches: '*'
jobs:
api:
@@ -60,27 +59,63 @@ jobs:
with:
name: actual-web
path: packages/desktop-client/build
electron:
# As electron builds take longer, we only run them in master.
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up environment
uses: ./.github/actions/setup
- name: Build Electron
run: ./bin/package-electron
- name: Upload Build
- name: Upload Build Stats
uses: actions/upload-artifact@v3
with:
name: actual-electron-${{ matrix.os }}
path: |
packages/desktop-electron/dist/*.dmg
packages/desktop-electron/dist/*.exe
packages/desktop-electron/dist/*.AppImage
name: build-stats
path: packages/desktop-client/build-stats
size-compare:
runs-on: ubuntu-latest
needs: [web]
if: github.event_name == 'pull_request'
permissions:
pull-requests: write
steps:
- name: Wait for ${{github.base_ref}} build to succeed
uses: fountainhead/action-wait-for-check@v1.1.0
id: master-build
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: web
ref: ${{github.base_ref}}
- name: Report build failure
if: steps.master-build.outputs.conclusion == 'failure'
run: |
echo "Build failed on ${{github.base_ref}}"
exit 1
- name: Download build artifact from ${{github.base_ref}}
uses: dawidd6/action-download-artifact@v2
id: pr-build
with:
branch: ${{github.base_ref}}
workflow: build.yml
name: build-stats
path: base
- name: Download build artifact from PR
uses: actions/download-artifact@v2
with:
name: build-stats
path: head
- name: Strip content hashes from stats files
run: |
sed -i -E 's/\.[0-9a-f]{8,}\././g' ./head/*.json
sed -i -E 's/\.[0-9a-f]{8,}\././g' ./base/*.json
- uses: github/webpack-bundlesize-compare-action@v1.8.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
current-stats-json-path: ./head/desktop-client-stats.json
base-stats-json-path: ./base/desktop-client-stats.json
title: desktop-client
- uses: github/webpack-bundlesize-compare-action@v1.8.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
current-stats-json-path: ./head/loot-core-stats.json
base-stats-json-path: ./base/loot-core-stats.json
title: loot-core