Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Change the way of building the base_ref embedjs bundle (#69910)

Timofey Kachalova554da88bde9
diff --git a/.github/actions/sdk-bundle-size-check/action.yml b/.github/actions/sdk-bundle-size-check/action.yml
index 3bff3ef8d16..bddc758ad71 100644
--- a/.github/actions/sdk-bundle-size-check/action.yml
+++ b/.github/actions/sdk-bundle-size-check/action.yml
@@ -1,7 +1,7 @@
name: Embedding SDK Bundle Size Check
description: |
- Downloads the current branch's uberjar and the base ref's uberjar,
- extracts embedding-sdk.js from both, compares their sizes,
+ Downloads the current branch's uberjar and builds the base ref's
+ embedding-sdk.js from source, compares their sizes,
and sets output if the size change exceeds the threshold.
inputs:
@@ -26,6 +26,10 @@ outputs:
runs:
using: "composite"
steps:
+ - name: Prepare backend
+ uses: ./.github/actions/prepare-backend
+ - name: Prepare frontend
+ uses: ./.github/actions/prepare-frontend
- name: Download current uberjar
uses: actions/download-artifact@v4
with:
@@ -34,21 +38,23 @@ runs:
- name: Extract embedding-sdk.js from current uberjar
shell: bash
run: unzip -j temp/current-uberjar/target/uberjar/metabase.jar frontend_client/app/embedding-sdk.js -d temp/current-bundle
- - name: Download base-ref uberjar
- uses: ./.github/actions/fetch-artifact
+ - name: Checkout base ref
+ uses: actions/checkout@v4
with:
- commit: ${{ inputs.base-ref-commit }}
- edition: ${{ inputs.edition }}
- extract-path: temp/base-ref-uberjar
- - name: Extract embedding-sdk.js from base-ref uberjar
+ ref: ${{ inputs.base-ref-commit }}
+ path: temp/base-ref-src
+ - name: Build base-ref embedding-sdk.js
shell: bash
- run: unzip -j temp/base-ref-uberjar/metabase.jar frontend_client/app/embedding-sdk.js -d temp/base-ref-bundle
+ run: |
+ cd temp/base-ref-src
+ bun install
+ MB_EDITION=${{ inputs.edition }} bun run build-release
- name: Compare sizes and set output
id: compare
shell: bash
run: |
current_size=$(wc -c < temp/current-bundle/embedding-sdk.js) || { echo "::error::Failed to read current bundle"; exit 1; }
- base_ref_size=$(wc -c < temp/base-ref-bundle/embedding-sdk.js) || { echo "::error::Failed to read base-ref bundle"; exit 1; }
+ base_ref_size=$(wc -c < temp/base-ref-src/resources/frontend_client/app/embedding-sdk.js) || { echo "::error::Failed to read base-ref bundle"; exit 1; }
[ "$current_size" -gt 0 ] && [ "$base_ref_size" -gt 0 ] || { echo "::error::Bundle file is empty"; exit 1; }
diff=$((current_size - base_ref_size))
diff --git a/.github/workflows/embedding-sdk.yml b/.github/workflows/embedding-sdk.yml
index a85766e9546..73d3398b6bb 100644
--- a/.github/workflows/embedding-sdk.yml
+++ b/.github/workflows/embedding-sdk.yml
@@ -132,7 +132,7 @@ jobs:
if: inputs.bundle-size-check
continue-on-error: true
runs-on: ubuntu-22.04
- timeout-minutes: 5
+ timeout-minutes: 20
env:
BUNDLE_SIZE_THRESHOLD_PERCENT: 2
steps: