From e0448a7b7be4fcad775f9dd0292f49845c84836c Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 24 Jan 2024 21:12:16 +0530 Subject: [PATCH] Feat: Calculate package size change on PRs --- .github/workflows/e2e.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index cf2d872aa7..84eff7c517 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -103,10 +103,21 @@ jobs: runTests: false - name: Build - if: ${{ github.event_name == 'pull_request' }} + id: size + if: ${{ github.event_name == 'pull_request' && matrix.containers == 1 }} run: | pnpm run build:viz mv stats cypress/snapshots/stats/head + echo "size_diff=$(npx tsx scripts/size.ts)" >> $GITHUB_OUTPUT + + # Size diff only needs to be posted from one job, on PRs. + - name: Comment PR size difference + if: ${{ github.event_name == 'pull_request' && matrix.containers == 1 }} + uses: thollander/actions-comment-pull-request@v2 + with: + message: | + ${{ steps.size.outputs.size_diff }} + comment_tag: size-diff # Install NPM dependencies, cache them correctly # and run all Cypress tests @@ -164,19 +175,6 @@ jobs: pattern: snapshots-* merge-multiple: true - - name: Calculate Size difference - id: size - if: ${{ github.event_name == 'pull_request' }} - run: echo "::set-output name=size_diff::$(npx tsx scripts/size.ts)" - - - name: Comment PR size difference - if: ${{ github.event_name == 'pull_request' }} - uses: thollander/actions-comment-pull-request@v2 - with: - message: | - ${{ steps.size.outputs.size_diff }} - comment_tag: size-diff - # For successful push events, we save the snapshots cache - name: Save snapshots cache id: cache-upload