From 430e9c68d7dbf3214c08fc64c09a56cef5a82180 Mon Sep 17 00:00:00 2001 From: mkorwel Date: Wed, 22 Oct 2025 00:54:20 -0700 Subject: [PATCH] refactor(ci): Move bundle size check to a parallel job Creates a new reusable workflow, 'bundle-size.yml', to handle the bundle size check. This check is now run in a separate job in the main 'orchestrator.yml' workflow, parallel to the 'e2e' job. This optimizes the CI pipeline by allowing the E2E tests to start as soon as the bundle is published, without waiting for the size check to complete. --- .github/workflows/build-and-publish.yml | 10 ------ .github/workflows/bundle-size.yml | 47 +++++++++++++++++++++++++ .github/workflows/orchestrator.yml | 7 ++++ 3 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/bundle-size.yml diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 572022e4c8..f87650f0fe 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -41,16 +41,6 @@ jobs: - name: 'Bundle' run: 'npm run bundle' - - name: 'Check Bundle Size' - if: "${{github.event_name == 'pull_request'}}" - uses: 'preactjs/compressed-size-action@946a292cd35bd1088e0d7eb92b69d1a8d5b5d76a' - with: - repo-token: '${{ secrets.GITHUB_TOKEN }}' - pattern: './bundle/**/*.{js,sb}' - minimum-change-threshold: '1000' - compression: 'none' - clean-script: 'clean' - - name: 'Prepare for GitHub release' run: 'node scripts/prepare-github-release.js' diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml new file mode 100644 index 0000000000..4f7f6ea256 --- /dev/null +++ b/.github/workflows/bundle-size.yml @@ -0,0 +1,47 @@ +# .github/workflows/bundle-size.yml +name: 'Bundle Size Check' + +on: + workflow_call: + inputs: + version: + description: 'The version of the published package' + required: true + type: 'string' + +permissions: + contents: 'read' + pull-requests: 'write' + +jobs: + bundle-size: + name: 'Check Bundle Size' + runs-on: 'ubuntu-latest' + steps: + - name: 'Checkout' + uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' # ratchet:actions/checkout@v5 + with: + ref: '${{ github.event.inputs.branch_ref || github.ref }}' + + - name: 'Set up Node.js' + uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: 'Configure npm for GitHub Packages' + run: | + echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc + echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc + + - name: 'Install dependencies' + run: 'npm install @google-gemini/gemini-cli@${{ inputs.version }}' + + - name: 'Check Bundle Size' + uses: 'preactjs/compressed-size-action@946a292cd35bd1088e0d7eb92b69d1a8d5b5d76a' + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' + pattern: './bundle/**/*.{js,sb}' + minimum-change-threshold: '1000' + compression: 'none' + clean-script: 'clean' diff --git a/.github/workflows/orchestrator.yml b/.github/workflows/orchestrator.yml index 013685f316..ec9c87668a 100644 --- a/.github/workflows/orchestrator.yml +++ b/.github/workflows/orchestrator.yml @@ -45,3 +45,10 @@ jobs: uses: './.github/workflows/e2e.yml' with: version: '${{ needs.build-and-publish.outputs.version }}' + + bundle-size: + name: 'Bundle Size Check' + needs: 'build-and-publish' + uses: './.github/workflows/bundle-size.yml' + with: + version: '${{ needs.build-and-publish.outputs.version }}'