Skip to content

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

Warn on PRs that grow the main app's initial bundle (#78652)

Romeo Van Snick24354fd2f466
diff --git a/.github/actions/sdk-bundle-size-check/action.yml b/.github/actions/bundle-size-check/action.yml
similarity index 66%
rename from .github/actions/sdk-bundle-size-check/action.yml
rename to .github/actions/bundle-size-check/action.yml
index f96b12886be..3a9e301af8c 100644
--- a/.github/actions/sdk-bundle-size-check/action.yml
+++ b/.github/actions/bundle-size-check/action.yml
@@ -1,10 +1,11 @@
-name: Embedding SDK Bundle Size Check
+name: Bundle Size Check
description: |
Measures app + embedding SDK bundle sizes from the current and base-ref
uberjars (reusing the builds that already ran) plus their bundle-stats
- artifacts, and flags changes to the chunked SDK's reachable, gzipped size
- beyond the threshold. Skips when the base-ref artifacts aren't available
- rather than rebuilding from source (which would compare across pipelines).
+ artifacts, and flags gzipped size changes beyond the threshold for the main
+ app's initial bundle and the chunked SDK's reachable total. Skips when the
+ base-ref artifacts aren't available rather than rebuilding from source (which
+ would compare across pipelines).
inputs:
edition:
@@ -18,12 +19,18 @@ inputs:
required: true
outputs:
- status:
- description: "Bundle size status: increased, decreased, or stable"
- value: ${{ steps.compare.outputs.status }}
- size_change_percent:
- description: "size change percent (positive = increase, negative = decrease)"
- value: ${{ steps.compare.outputs.size_change_percent }}
+ app_status:
+ description: "App initial bundle status: increased, decreased, or stable"
+ value: ${{ steps.compare.outputs.app_initial_status }}
+ app_size_change_percent:
+ description: "App initial bundle size change percent (positive = increase, negative = decrease)"
+ value: ${{ steps.compare.outputs.app_initial_size_change_percent }}
+ sdk_status:
+ description: "Chunked SDK bundle status: increased, decreased, or stable"
+ value: ${{ steps.compare.outputs.embedding_sdk_chunked_total_status }}
+ sdk_size_change_percent:
+ description: "Chunked SDK bundle size change percent (positive = increase, negative = decrease)"
+ value: ${{ steps.compare.outputs.embedding_sdk_chunked_total_size_change_percent }}
runs:
using: "composite"
@@ -52,13 +59,20 @@ runs:
BASE_SHA: ${{ inputs.base-ref-commit }}
THRESHOLD: ${{ inputs.threshold-percent }}
MEASURE_BUNDLES: app,embedding-sdk-legacy,embedding-sdk-chunked
+ # The gated bundles, as "<bundle>/<kind>". Each one's step outputs are
+ # named after its key (see outputPrefix in compare.js), which is what the
+ # action outputs above read.
+ GATES: app/initial,embedding-sdk-chunked/total
run: |
set -uo pipefail
skip() {
- echo "::notice::Embedding SDK bundle-size check skipped: $1"
- echo "status=stable" >> "$GITHUB_OUTPUT"
- echo "size_change_percent=0" >> "$GITHUB_OUTPUT"
+ echo "::notice::Bundle-size check skipped: $1"
+ for gate in ${GATES//,/ }; do
+ prefix=$(printf '%s' "$gate" | tr -c 'a-zA-Z0-9' '_')
+ echo "${prefix}_status=stable" >> "$GITHUB_OUTPUT"
+ echo "${prefix}_size_change_percent=0" >> "$GITHUB_OUTPUT"
+ done
exit 0
}
@@ -97,4 +111,4 @@ runs:
MEASURE_ROOT=temp/base node ./.github/scripts/measure-bundle-sizes.js > temp/base-sizes.json \
|| { echo "::error::Failed to measure base bundle sizes"; exit 1; }
- node ./.github/actions/sdk-bundle-size-check/compare.js temp/current-sizes.json temp/base-sizes.json
+ node ./.github/actions/bundle-size-check/compare.js temp/current-sizes.json temp/base-sizes.json
diff --git a/.github/actions/sdk-bundle-size-check/compare.js b/.github/actions/bundle-size-check/compare.js
similarity index 53%
rename from .github/actions/sdk-bundle-size-check/compare.js
rename to .github/actions/bundle-size-check/compare.js
index 902dd6b6438..f245d1830a8 100644
--- a/.github/actions/sdk-bundle-size-check/compare.js
+++ b/.github/actions/bundle-size-check/compare.js
@@ -2,8 +2,11 @@
// Diffs the bundle sizes produced by measure-bundle-sizes.js for the current
// build and the base ref. Every (bundle, kind) is compared strictly against the
// same (bundle, kind) — never one bundle type against another — using gzipped
-// (served) bytes. The gate is driven by the chunked SDK's reachable total, which
-// is what the SDK actually delivers.
+// (served) bytes.
+//
+// The report covers every measured bundle; the gates are the subset that drives
+// PR comments, named as "<bundle>/<kind>" (e.g. "app/initial",
+// "embedding-sdk-chunked/total").
//
// compareBundles is pure (data in, data out) so it can be unit-tested; main()
// is the thin I/O wrapper that reads the size files, prints the report and sets
@@ -16,46 +19,33 @@ const mb = bytes => (bytes / 1024 / 1024).toFixed(2);
const percentOf = (currentBytes, baseBytes) =>
baseBytes ? Math.trunc(((currentBytes - baseBytes) * 100) / baseBytes) : 0;
+// Output names are derived from the gate key, so the workflow reads
+// `app_initial_status`, `embedding_sdk_chunked_total_status`, and so on.
+const outputPrefix = gateKey => gateKey.replace(/[^a-zA-Z0-9]+/g, "_");
+
/**
- * Compare two measurement sets and decide the gate. Returns a human-readable
- * `report` (always), and exactly one of:
- * - `gate` { status, percent }: the chunked SDK total moved by `percent`.
- * - `skip` reason: the gate is non-actionable (report stable, no comment).
+ * Evaluate one gate. Returns the key plus exactly one of:
+ * - `status` / `percent`: the bundle moved by `percent`.
+ * - `skip` reason: the gate is non-actionable (reported stable, no comment).
* - `error` reason: the gate inputs are missing (hard failure).
*/
-function compareBundles({ current, base, threshold }) {
- const report = ["=== Bundle sizes (gzipped, current vs base) ==="];
- const keys = [...new Set([...current, ...base].map(keyOf))].sort();
- for (const key of keys) {
- const [bundle, kind] = key.split("/");
- const currentRow = pick(current, bundle, kind);
- const baseRow = pick(base, bundle, kind);
- if (!currentRow || !baseRow) {
- report.push(`${key}: present only in ${currentRow ? "current" : "base"} build`);
- continue;
- }
- const diff = currentRow.gzipBytes - baseRow.gzipBytes;
- const percent = percentOf(currentRow.gzipBytes, baseRow.gzipBytes);
- report.push(`${key}: ${mb(currentRow.gzipBytes)}MB vs ${mb(baseRow.gzipBytes)}MB (${percent}%, ${diff} bytes)`);
- }
-
- // Gate on the chunked SDK's reachable total (gzipped) — what the SDK ships.
- const gateCurrent = pick(current, "embedding-sdk-chunked", "total");
- const gateBase = pick(base, "embedding-sdk-chunked", "total");
+function evaluateGate({ current, base, threshold, gateKey }) {
+ const [bundle, kind] = gateKey.split("/");
+ const gateCurrent = pick(current, bundle, kind);
+ const gateBase = pick(base, bundle, kind);
if (!gateCurrent || !gateBase || !gateBase.gzipBytes) {
- return { report, error: "Could not find embedding-sdk-chunked total (gzip) in both builds" };
+ return { gateKey, error: `Could not find ${bundle} ${kind} (gzip) in both builds` };
}
- // Both sides must measure "total" the same way. A base ref built before the
+ // Both sides must measure the bundle the same way. A base ref built before the
// reachableAssets enrichment collapses its total to the initial set, so
// comparing it against the current reachable total reports a phantom jump
- // (~30%). Skip until the base ref also carries reachable stats (i.e. once
- // this change is on the base).
+ // (~30%). Skip until the base ref also carries reachable stats.
if (Boolean(gateCurrent.reachable) !== Boolean(gateBase.reachable)) {
return {
- report,
+ gateKey,
skip:
- `chunked "total" measured differently on each side ` +
+ `"${gateKey}" measured differently on each side ` +
`(current reachable=${Boolean(gateCurrent.reachable)}, base reachable=${Boolean(gateBase.reachable)}); ` +
`the base ref predates the reachable-chunk stats. Resolves once this change is on the base ref.`,
};
@@ -63,10 +53,33 @@ function compareBundles({ current, base, threshold }) {
const percent = percentOf(gateCurrent.gzipBytes, gateBase.gzipBytes);
const status = percent > threshold ? "increased" : percent < -threshold ? "decreased" : "stable";
- return { report, gate: { status, percent } };
+ return { gateKey, status, percent };
}
-module.exports = { compareBundles };
+/**
+ * Compare two measurement sets and evaluate every gate. Returns a
+ * human-readable `report` over all measured bundles plus one entry per gate.
+ */
+function compareBundles({ current, base, threshold, gateKeys }) {
+ const report = ["=== Bundle sizes (gzipped, current vs base) ==="];
+ const keys = [...new Set([...current, ...base].map(keyOf))].sort();
+ for (const key of keys) {
+ const [bundle, kind] = key.split("/");
+ const currentRow = pick(current, bundle, kind);
+ const baseRow = pick(base, bundle, kind);
+ if (!currentRow || !baseRow) {
+ report.push(`${key}: present only in ${currentRow ? "current" : "base"} build`);
+ continue;
+ }
+ const diff = currentRow.gzipBytes - baseRow.gzipBytes;
+ const percent = percentOf(currentRow.gzipBytes, baseRow.gzipBytes);
+ report.push(`${key}: ${mb(currentRow.gzipBytes)}MB vs ${mb(baseRow.gzipBytes)}MB (${percent}%, ${diff} bytes)`);
+ }
+
+ return { report, gates: gateKeys.map(gateKey => evaluateGate({ current, base, threshold, gateKey })) };
+}
+
+module.exports = { compareBundles, outputPrefix };
const setOutput = (name, value) => {
if (process.env.GITHUB_OUTPUT) {
@@ -77,32 +90,42 @@ const setOutput = (name, value) => {
function main() {
const [, , currentPath, basePath] = process.argv;
const threshold = Number(process.env.THRESHOLD ?? 2);
+ const gateKeys = (process.env.GATES ?? "embedding-sdk-chunked/total").split(",").map(key => key.trim());
const current = JSON.parse(fs.readFileSync(currentPath, "utf8"));
const base = JSON.parse(fs.readFileSync(basePath, "utf8"));
- const { report, gate, skip, error } = compareBundles({ current, base, threshold });
+ const { report, gates } = compareBundles({ current, base, threshold, gateKeys });
console.log(report.join("\n"));
+ console.log("");
- if (error) {
- console.error(`::error::${error}`);
- process.exit(1);
- }
+ for (const gate of gates) {
+ const prefix = outputPrefix(gate.gateKey);
- if (skip) {
- // Treat the gate as non-actionable: report stable so no regression comment
- // is posted, mirroring the shell skip() for missing artifacts.
- console.log(`::notice::Embedding SDK bundle-size gate skipped: ${skip}`);
- setOutput("status", "stable");
- setOutput("size_change_percent", "0");
- process.exit(0);
- }
+ if (gate.error) {
+ // One broken gate must not hide the others, so report them all and fail
+ // the step at the end.
+ console.error(`::error::${gate.error}`);
+ continue;
+ }
- console.log("");
- console.log(`Gate: embedding-sdk-chunked total ${gate.percent}% (threshold ${threshold}%) → ${gate.status}`);
+ if (gate.skip) {
+ // Treat the gate as non-actionable: report stable so no regression comment
+ // is posted, mirroring the shell skip() for missing artifacts.
+ console.log(`::notice::Bundle-size gate skipped: ${gate.skip}`);
+ setOutput(`${prefix}_status`, "stable");
+ setOutput(`${prefix}_size_change_percent`, "0");
+ continue;
+ }
+
+ console.log(`Gate: ${gate.gateKey} ${gate.percent}% (threshold ${threshold}%) → ${gate.status}`);
+ setOutput(`${prefix}_status`, gate.status);
+ setOutput(`${prefix}_size_change_percent`, gate.percent);
+ }
- setOutput("status", gate.status);
- setOutput("size_change_percent", gate.percent);
+ if (gates.some(gate => gate.error)) {
+ process.exit(1);
+ }
}
if (require.main === module) {
diff --git a/.github/actions/bundle-size-check/compare.unit.spec.js b/.github/actions/bundle-size-check/compare.unit.spec.js
new file mode 100644
index 00000000000..79868cefc33
--- /dev/null
+++ b/.github/actions/bundle-size-check/compare.unit.spec.js
@@ -0,0 +1,84 @@
+const { compareBundles, outputPrefix } = require("./compare");
+
+const SDK_GATE = "embedding-sdk-chunked/total";
+const APP_GATE = "app/initial";
+
+const total = (gzipBytes, over = {}) => ({
+ bundle: "embedding-sdk-chunked",
+ kind: "total",
+ gzipBytes,
+ reachable: true,
+ ...over,
+});
+
+const appInitial = gzipBytes => ({ bundle: "app", kind: "initial", gzipBytes });
+
+const compare = ({ current, base, threshold = 2, gateKeys = [SDK_GATE] }) =>
+ compareBundles({ current, base, threshold, gateKeys });
+
+describe("outputPrefix", () => {
+ it("turns a gate key into a step-output prefix", () => {
+ expect(outputPrefix(APP_GATE)).toBe("app_initial");
+ expect(outputPrefix(SDK_GATE)).toBe("embedding_sdk_chunked_total");
+ });
+});
+
+describe("compareBundles", () => {
+ it("gates on the chunked SDK total and flags an increase past the threshold", () => {
+ const { gates, report } = compare({ current: [total(110)], base: [total(100)] });
+
+ expect(gates).toEqual([{ gateKey: SDK_GATE, status: "increased", percent: 10 }]);
+ expect(report[0]).toContain("current vs base");
+ });
+
+ it("flags a decrease and stays stable within the threshold", () => {
+ expect(compare({ current: [total(90)], base: [total(100)] }).gates[0]).toMatchObject({
+ status: "decreased",
+ percent: -10,
+ });
+ expect(compare({ current: [total(101)], base: [total(100)] }).gates[0]).toMatchObject({
+ status: "stable",
+ percent: 1,
+ });
+ });
+
+ it("evaluates each gate against its own bundle", () => {
+ const { gates } = compare({
+ current: [total(100), appInitial(110)],
+ base: [total(100), appInitial(100)],
+ gateKeys: [APP_GATE, SDK_GATE],
+ });
+
+ expect(gates).toEqual([
+ { gateKey: APP_GATE, status: "increased", percent: 10 },
+ { gateKey: SDK_GATE, status: "stable", percent: 0 },
+ ]);
+ });
+
+ it("skips when the two sides measured a gate differently (reachable mismatch)", () => {
+ const { gates } = compare({
+ current: [total(130, { reachable: true })],
+ base: [total(100, { reachable: false })],
+ });
+
+ expect(gates[0].status).toBeUndefined();
+ expect(gates[0].skip).toContain("predates the reachable-chunk stats");
+ });
+
+ it("errors when a gate bundle is missing on either side, without hiding the others", () => {
+ const { gates } = compare({
+ current: [appInitial(100)],
+ base: [appInitial(100)],
+ gateKeys: [APP_GATE, SDK_GATE],
+ });
+
+ expect(gates[0]).toEqual({ gateKey: APP_GATE, status: "stable", percent: 0 });
+ expect(gates[1].error).toContain("embedding-sdk-chunked total");
+ });
+
+ it("reports a bundle/kind present on only one side without erroring", () => {
+ const { report } = compare({ current: [total(100), appInitial(50)], base: [total(100)] });
+
+ expect(report.some(line => line.includes("present only in current build"))).toBe(true);
+ });
+});
diff --git a/.github/actions/notify-pull-request/action.yml b/.github/actions/notify-pull-request/action.yml
index 69d056a5da6..f03ff3d975a 100644
--- a/.github/actions/notify-pull-request/action.yml
+++ b/.github/actions/notify-pull-request/action.yml
@@ -1,12 +1,11 @@
name: Notify Pull Request
+description: Post a comment on the pull request, optionally replacing the previous one with the same message.
inputs:
remove-previous-comment:
required: false
- type: boolean
default: false
add-new-comment:
required: false
- type: boolean
default: true
message:
required: true
diff --git a/.github/actions/sdk-bundle-size-check/compare.unit.spec.js b/.github/actions/sdk-bundle-size-check/compare.unit.spec.js
deleted file mode 100644
index fd5499d0a94..00000000000
--- a/.github/actions/sdk-bundle-size-check/compare.unit.spec.js
+++ /dev/null
@@ -1,65 +0,0 @@
-const { compareBundles } = require("./compare");
-
-const total = (gzipBytes, over = {}) => ({
- bundle: "embedding-sdk-chunked",
- kind: "total",
- gzipBytes,
- reachable: true,
- ...over,
-});
-
-describe("compareBundles", () => {
- it("gates on the chunked SDK total and flags an increase past the threshold", () => {
- const { gate, report } = compareBundles({
- current: [total(110)],
- base: [total(100)],
- threshold: 2,
- });
-
- expect(gate).toEqual({ status: "increased", percent: 10 });
- expect(report[0]).toContain("current vs base");
- });
-
- it("flags a decrease and stays stable within the threshold", () => {
- expect(compareBundles({ current: [total(90)], base: [total(100)], threshold: 2 }).gate).toEqual({
- status: "decreased",
- percent: -10,
- });
- expect(compareBundles({ current: [total(101)], base: [total(100)], threshold: 2 }).gate).toEqual({
- status: "stable",
- percent: 1,
- });
- });
-
- it("skips when the two sides measured total differently (reachable mismatch)", () => {
- const result = compareBundles({
- current: [total(130, { reachable: true })],
- base: [total(100, { reachable: false })],
- threshold: 2,
- });
-
- expect(result.gate).toBeUndefined();
- expect(result.skip).toContain("predates the reachable-chunk stats");
- });
-
- it("errors when the gate bundle is missing on either side", () => {
- const result = compareBundles({
- current: [{ bundle: "app", kind: "total", gzipBytes: 1 }],
- base: [total(100)],
- threshold: 2,
- });
-
- expect(result.gate).toBeUndefined();
- expect(result.error).toContain("embedding-sdk-chunked total");
- });
-
- it("reports a bundle/kind present on only one side without erroring", () => {
- const { report } = compareBundles({
- current: [total(100), { bundle: "app", kind: "total", gzipBytes: 50 }],
- base: [total(100)],
- threshold: 2,
- });
-
- expect(report.some(line => line.includes("present only in current build"))).toBe(true);
- });
-});
diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml
new file mode 100644
index 00000000000..840cff93923
--- /dev/null
+++ b/.github/workflows/bundle-size.yml
@@ -0,0 +1,88 @@
+name: Bundle Size
+
+# Warns on PRs that move a shipped bundle's gzipped size past the threshold,
+# comparing the PR's uberjar against the base ref's. Both gates are measured in
+# a single job: downloading and extracting two uberjars is the expensive part,
+# so adding a bundle costs a comment step, not another job.
+
+on:
+ workflow_call:
+ inputs:
+ skip:
+ description: Whether to skip the check (e.g. no front-end sources changed, or the uberjar failed to build).
+ required: true
+ type: boolean
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
+ cancel-in-progress: true
+
+jobs:
+ bundle-size-check:
+ name: "Bundle size check"
+ if: ${{ !inputs.skip }}
+ continue-on-error: true
+ runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
+ timeout-minutes: 20
+ env:
+ BUNDLE_SIZE_THRESHOLD_PERCENT: 2
+ steps:
+ - uses: actions/checkout@v6
+ - uses: ./.github/actions/bundle-size-check
+ id: compare
+ with:
+ edition: ee
+ base-ref-commit: ${{ github.event.pull_request.base.sha }}
+ threshold-percent: ${{ env.BUNDLE_SIZE_THRESHOLD_PERCENT }}
+
+ - name: Comment on PR if app bundle size has increased
+ uses: ./.github/actions/notify-pull-request
+ if: success() && steps.compare.outputs.app_status == 'increased'
+ with:
+ remove-previous-comment: true
+ add-new-comment: true
+ message: "⚠️ Main app initial bundle size (gzipped) increased by ${{ steps.compare.outputs.app_size_change_percent }}% compared to the ${{ github.base_ref }} branch (threshold: ${{ env.BUNDLE_SIZE_THRESHOLD_PERCENT }}%). This is the JavaScript every user downloads before the app renders, so check whether the new code can be loaded lazily instead."
+ include-log: false
+
+ - name: Comment on PR if app bundle size has decreased
+ uses: ./.github/actions/notify-pull-request
+ if: success() && steps.compare.outputs.app_status == 'decreased'
+ with:
+ remove-previous-comment: true
+ add-new-comment: true
+ message: "🎉 Main app initial bundle size (gzipped) decreased by ${{ steps.compare.outputs.app_size_change_percent }}% compared to the ${{ github.base_ref }} branch. Nice work!"
+ include-log: false
+
+ - name: Comment on PR if SDK bundle size has increased
+ uses: ./.github/actions/notify-pull-request
+ if: success() && steps.compare.outputs.sdk_status == 'increased'
+ with:
+ remove-previous-comment: true
+ add-new-comment: true
+ message: "⚠️ Embedding SDK chunked bundle size (gzipped) increased by ${{ steps.compare.outputs.sdk_size_change_percent }}% compared to the ${{ github.base_ref }} branch (threshold: ${{ env.BUNDLE_SIZE_THRESHOLD_PERCENT }}%). Please contact Embedding team."
+ include-log: false
+
+ - name: Send notification to Slack via Zapier
+ if: success() && steps.compare.outputs.sdk_status == 'increased'
+ shell: bash
+ env:
+ ZAPIER_WEBHOOK_URL: ${{ secrets.EMBEDDING_ZAPIER_WEBHOOK_URL }}
+ SIZE_CHANGE_PERCENT: ${{ steps.compare.outputs.sdk_size_change_percent }}
+ BUNDLE_SIZE_THRESHOLD_PERCENT: ${{ env.BUNDLE_SIZE_THRESHOLD_PERCENT }}
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ PR_TITLE: ${{ github.event.pull_request.title }}
+ PR_URL: ${{ github.event.pull_request.html_url }}
+ run: |
+ curl -s -X POST "$ZAPIER_WEBHOOK_URL" \
+ -d "⚠️ Embedding SDK chunked bundle size (gzipped) increased by ${SIZE_CHANGE_PERCENT}% (threshold: ${BUNDLE_SIZE_THRESHOLD_PERCENT}%)
+
+ PR #${PR_NUMBER} ${PR_TITLE} (${PR_URL})"
+
+ - name: Comment on PR if SDK bundle size has decreased
+ uses: ./.github/actions/notify-pull-request
+ if: success() && steps.compare.outputs.sdk_status == 'decreased'
+ with:
+ remove-previous-comment: true
+ add-new-comment: true
+ message: "🎉 Embedding SDK chunked bundle size (gzipped) decreased by ${{ steps.compare.outputs.sdk_size_change_percent }}% compared to the ${{ github.base_ref }} branch. Nice work!"
+ include-log: false
diff --git a/.github/workflows/embedding-sdk.yml b/.github/workflows/embedding-sdk.yml
index ab84f0ca223..61a37c889ef 100644
--- a/.github/workflows/embedding-sdk.yml
+++ b/.github/workflows/embedding-sdk.yml
@@ -23,10 +23,6 @@ on:
description: "Whether to run host and sample apps compatibility tests."
required: true
type: boolean
- bundle-size-check:
- description: "Whether to run bundle size check."
- required: true
- type: boolean
skip:
description: Whether to skip running tests due to one of the artifacts failing to build.
required: true
@@ -90,13 +86,15 @@ jobs:
shell: bash
run: |
set -o pipefail
+ # SC2016: the '$a' and '$aEOF' are sed commands, not shell variables.
+ # shellcheck disable=SC2016
bun run embedding-sdk:docs:generate:pure --emit none 2>&1 \
| tee /dev/stdout \
| tee >( tail -n 10 \
| sed '1s/^/output<<EOF\n/' \
| sed '$aEOF' \
>> "$GITHUB_OUTPUT" )
- exit ${PIPESTATUS[0]}
+ exit "${PIPESTATUS[0]}"
- name: Comment on PR if 'not included in the documentation' error happens
uses: ./.github/actions/notify-pull-request
with:
@@ -128,59 +126,8 @@ jobs:
uses: ./.github/workflows/embedding-sdk-host-sample-apps-tests.yml
secrets: inherit
- embedding-sdk-bundle-size-check:
- if: inputs.bundle-size-check
- continue-on-error: true
- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
- timeout-minutes: 20
- env:
- BUNDLE_SIZE_THRESHOLD_PERCENT: 2
- steps:
- - uses: actions/checkout@v6
- - uses: ./.github/actions/sdk-bundle-size-check
- id: compare
- with:
- edition: ee
- base-ref-commit: ${{ github.event.pull_request.base.sha }}
- threshold-percent: ${{ env.BUNDLE_SIZE_THRESHOLD_PERCENT }}
-
- - name: Comment on PR if bundle size has increased
- uses: ./.github/actions/notify-pull-request
- if: success() && steps.compare.outputs.status == 'increased'
- with:
- remove-previous-comment: true
- add-new-comment: true
- message: "⚠️ Embedding SDK chunked bundle size (gzipped) increased by ${{ steps.compare.outputs.size_change_percent }}% compared to the ${{ github.base_ref }} branch (threshold: ${{ env.BUNDLE_SIZE_THRESHOLD_PERCENT }}%). Please contact Embedding team."
- include-log: false
-
- - name: Send notification to Slack via Zapier
- if: success() && steps.compare.outputs.status == 'increased'
- shell: bash
- env:
- ZAPIER_WEBHOOK_URL: ${{ secrets.EMBEDDING_ZAPIER_WEBHOOK_URL }}
- SIZE_CHANGE_PERCENT: ${{ steps.compare.outputs.size_change_percent }}
- BUNDLE_SIZE_THRESHOLD_PERCENT: ${{ env.BUNDLE_SIZE_THRESHOLD_PERCENT }}
- PR_NUMBER: ${{ github.event.pull_request.number }}
- PR_TITLE: ${{ github.event.pull_request.title }}
- PR_URL: ${{ github.event.pull_request.html_url }}
- run: |
- curl -s -X POST "$ZAPIER_WEBHOOK_URL" \
- -d "⚠️ Embedding SDK chunked bundle size (gzipped) increased by ${SIZE_CHANGE_PERCENT}% (threshold: ${BUNDLE_SIZE_THRESHOLD_PERCENT}%)
-
- PR #${PR_NUMBER} ${PR_TITLE} (${PR_URL})"
-
- - name: Comment on PR if bundle size has decreased
- uses: ./.github/actions/notify-pull-request
- if: success() && steps.compare.outputs.status == 'decreased'
- with:
- remove-previous-comment: true
- add-new-comment: true
- message: "🎉 Embedding SDK chunked bundle size (gzipped) decreased by ${{ steps.compare.outputs.size_change_percent }}% compared to the ${{ github.base_ref }} branch. Nice work!"
- include-log: false
-
embedding-sdk-tests-result:
needs:
- - embedding-sdk-bundle-size-check
- embedding-sdk-cli-snippets-type-check
- embedding-sdk-docs-snippets-type-check
- embedding-sdk-api-documentation-generation-validation
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index 6de7ea6a878..2ff9731f8cd 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -228,7 +228,6 @@ jobs:
uses: ./.github/workflows/embedding-sdk.yml
secrets: inherit
with:
- bundle-size-check: ${{ github.event_name == 'pull_request' && needs.uberjar.result == 'success' && needs.create-test-plan.outputs.frontend_sources == 'true' }}
cli-snippets-type-check: ${{ needs.create-test-plan.outputs.frontend_sources == 'true' }}
docs-snippets-type-check: ${{ needs.create-test-plan.outputs.embedding_documentation == 'true' }}
documentation-validation: ${{ needs.create-test-plan.outputs.frontend_sources == 'true' }}
@@ -236,6 +235,14 @@ jobs:
host-sample-apps-tests: ${{ needs.create-test-plan.outputs.embedding_sdk_host_sample_apps == 'true' }}
skip: ${{ needs.embedding-sdk-package.result != 'success' || needs.uberjar.result != 'success' }}
+ bundle-size:
+ needs: [uberjar, create-test-plan]
+ if: always() && !cancelled()
+ uses: ./.github/workflows/bundle-size.yml
+ secrets: inherit
+ with:
+ skip: ${{ github.event_name != 'pull_request' || needs.uberjar.result != 'success' || needs.create-test-plan.outputs.frontend_sources != 'true' }}
+
pr-env:
needs: [uberjar]
if: |