From 9819024a2f6aa8484224cec3f4e440c63f32fe30 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Jan 2025 12:58:51 +0000 Subject: [PATCH] ci: run bundle size assertion outside of matrix (#30688) --- .github/workflows/ci.yml | 27 ++++++++++++++++++++++++++- test/bundle.test.ts | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a848c52ea0..070c301018 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -188,6 +188,31 @@ jobs: - name: Test (runtime unit) run: pnpm test:runtime + test-size: + runs-on: ubuntu-latest + needs: + - build + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - run: corepack enable + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: lts/* + cache: "pnpm" + + - name: Install dependencies + run: pnpm install + + - name: Restore dist cache + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: dist + path: packages + + - name: Check bundle size + run: pnpm vitest run bundle + test-fixtures: runs-on: ${{ matrix.os }} needs: @@ -253,7 +278,7 @@ jobs: TEST_MANIFEST: ${{ matrix.manifest }} TEST_CONTEXT: ${{ matrix.context }} TEST_PAYLOAD: ${{ matrix.payload }} - SKIP_BUNDLE_SIZE: ${{ github.event_name != 'push' || matrix.env == 'dev' || matrix.builder == 'webpack' || matrix.context == 'default' || matrix.payload == 'js' || runner.os == 'Windows' }} + SKIP_BUNDLE_SIZE: true - uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2 if: github.event_name != 'push' && matrix.env == 'built' && matrix.builder == 'vite' && matrix.context == 'default' && matrix.os == 'ubuntu-latest' && matrix.manifest == 'manifest-on' diff --git a/test/bundle.test.ts b/test/bundle.test.ts index 43bf31d6df..18b1aa3faa 100644 --- a/test/bundle.test.ts +++ b/test/bundle.test.ts @@ -127,7 +127,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM const serverDir = join(pagesRootDir, '.output/server') const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) - expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"302k"`) + expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"303k"`) const modules = await analyzeSizes(['node_modules/**/*'], serverDir) expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"1398k"`)