Skip to content

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

test(sdk): Adjust SDK backward compatibility tests (#62346)

Timofey Kachalov49fe303eff59
diff --git a/.github/workflows/e2e-component-tests-embedding-sdk-cross-version.yml b/.github/workflows/e2e-component-tests-embedding-sdk-backward-compatibility.yml
similarity index 58%
rename from .github/workflows/e2e-component-tests-embedding-sdk-cross-version.yml
rename to .github/workflows/e2e-component-tests-embedding-sdk-backward-compatibility.yml
index 2d83449377a..0acdc5a12d8 100644
--- a/.github/workflows/e2e-component-tests-embedding-sdk-cross-version.yml
+++ b/.github/workflows/e2e-component-tests-embedding-sdk-backward-compatibility.yml
@@ -1,15 +1,22 @@
-name: E2E Cross-version Component Tests for Embedding SDK
+# Thi workflow does the backward compatibility tests
+# between the Embedding SDK package of version N and Embedding SDK Bundle of version N - 1
+# N - 1 is a target of a PR
+name: Embedding SDK backward-compatibility E2E Component Tests
on:
workflow_call:
+ inputs:
+ cached-embedding-sdk-dist-artifact-name:
+ required: true
+ type: string
jobs:
files-changed:
- name: "SDK cross-version E2E > Check which files changed"
+ name: "SDK backward-compatibility E2E > Check which files changed"
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
- e2e_all: ${{ steps.changes.outputs.e2e_all }}
+ e2e_embedding_sdk: ${{ steps.changes.outputs.e2e_embedding_sdk }}
steps:
- uses: actions/checkout@v4
- name: Test which files changed
@@ -19,11 +26,31 @@ jobs:
token: ${{ github.token }}
filters: .github/file-paths.yaml
+ decide-target-ref:
+ runs-on: ubuntu-latest
+ outputs:
+ target-ref: ${{ steps.get-target-ref.outputs.value }}
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 2
+
+ - name: Decide ref to checkout
+ id: get-target-ref
+ run: |
+ if [[ "${{ github.event_name }}" == "pull_request" ]]; then
+ echo "value=${{ github.base_ref }}" >> "$GITHUB_OUTPUT"
+ else
+ echo "value=$(git rev-parse HEAD^1)" >> "$GITHUB_OUTPUT"
+ fi
+
# if this is a test on a release branch, we need to check the build requirements
get-build-requirements:
- name: "SDK cross-version E2E > [Backport only] Get build requirements"
+ name: "SDK backward-compatibility E2E > [Backport only] Get build requirements"
+ needs: [decide-target-ref]
if: |
- !cancelled()
+ !cancelled() &&
+ contains(github.base_ref || github.ref, 'release-x')
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
@@ -32,6 +59,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
+ ref: ${{ needs.decide-target-ref.outputs.target-ref }}
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
@@ -54,76 +82,12 @@ jobs:
node_version: requirements.node,
};
- build:
- name: "SDK cross-version E2E > Build uberjar"
- needs: [files-changed, get-build-requirements]
- if: |
- !cancelled()
- runs-on: ubuntu-22.04
- timeout-minutes: 25
- env:
- MB_EDITION: ee
- INTERACTIVE: false
- # make sure that builds on release branches get licenses, because we use them for releases
- SKIP_LICENSES: ${{ github.event_name == 'pull_request' }}
- steps:
- - uses: actions/checkout@v4
- - name: Prepare front-end environment
- uses: ./.github/actions/prepare-frontend
- with:
- node-version: "${{ needs.get-build-requirements.outputs.node_version }}"
- - name: Prepare back-end environment
- uses: ./.github/actions/prepare-backend
- with:
- m2-cache-key: uberjar
- java-version: "${{ needs.get-build-requirements.outputs.java_version || 11 }}"
-
- - name: Build uberjar with ./bin/build.sh
- run: ./bin/build.sh
-
- - name: Prepare uberjar artifact
- uses: ./.github/actions/prepare-uberjar-artifact
- with:
- name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar-cross-version
-
- resolve-sdk-version:
- name: "SDK cross-version E2E > Resolve SDK version"
- if: |
- !cancelled()
- runs-on: ubuntu-22.04
- timeout-minutes: 10
- outputs:
- sdk_version: ${{ fromJson(steps.dependencies.outputs.result).sdk_version }}
- steps:
- - uses: actions/checkout@v4
- with:
- sparse-checkout: release
- - name: Prepare build scripts
- run: cd ${{ github.workspace }}/release && yarn && yarn build
- - name: Get latest SDK release for this branch
- uses: actions/github-script@v7
- id: dependencies
- with:
- script: | # js
- const { getSdkVersionFromReleaseBranchName } = require('${{ github.workspace }}/release/dist/index.cjs');
- const branchName = '${{ github.base_ref || github.ref }}';
-
- const sdk_version = await getSdkVersionFromReleaseBranchName({
- github,
- owner: context.repo.owner,
- repo: context.repo.repo,
- branchName,
- });
-
- return {
- sdk_version,
- };
-
e2e-tests:
- name: "SDK cross-version E2E > Run e2e tests"
- needs: [get-build-requirements, build, resolve-sdk-version]
+ name: "SDK backward-compatibility E2E > Run e2e tests"
+ needs: [files-changed, decide-target-ref, get-build-requirements]
if: |
- !cancelled() && needs.build.result == 'success'
+ !cancelled() &&
+ needs.files-changed.outputs.e2e_embedding_sdk == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 45
env:
@@ -142,45 +106,33 @@ jobs:
steps:
- uses: actions/checkout@v4
-
- # Needed to omit newly added tests for functionality that is not yet released
- - name: Sparse checkout tests from SDK release commit
- uses: actions/checkout@v4
with:
- ref: embedding-sdk-${{ needs.resolve-sdk-version.outputs.sdk_version }}
- path: sdk-release-e2e
- sparse-checkout: e2e
-
- - name: Move tests from the release commit into the repo
- run: |
- rm -rf ./e2e/support/*
- mv ./sdk-release-e2e/e2e/support/* ./e2e/support
-
- rm -rf ./e2e/test-component/*
- mv ./sdk-release-e2e/e2e/test-component/* ./e2e/test-component
- shell: bash
+ ref: ${{ needs.decide-target-ref.outputs.target-ref }}
- - name: Retrieve uberjar artifact for ee
- uses: actions/download-artifact@v4
+ - name: Prepare back-end environment
+ uses: ./.github/actions/prepare-backend
with:
- name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar-cross-version
+ m2-cache-key: uberjar
+ java-version: "${{ needs.get-build-requirements.outputs.java_version || 21 }}"
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
+ with:
+ node-version: "${{ needs.get-build-requirements.outputs.node_version }}"
- - name: Prepare JDK ${{ needs.get-build-requirements.outputs.java_version || 11 }}
- uses: actions/setup-java@v4
+ - name: Build uberjar with ./bin/build.sh
+ run: ./bin/build.sh
+
+ - name: Retrieve Embedding SDK dist artifact
+ uses: actions/download-artifact@v4
with:
- java-version: ${{ needs.get-build-requirements.outputs.java_version || 11 }}
- distribution: "temurin"
+ name: ${{ inputs.cached-embedding-sdk-dist-artifact-name }}
+ path: ${{ github.workspace }}/resources/embedding-sdk
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- - name: Install Embedding SDK package v${{ needs.resolve-sdk-version.outputs.sdk_version }}
- run: yarn add @metabase/embedding-sdk-react@${{ needs.resolve-sdk-version.outputs.sdk_version }}
-
- name: Run Metabase
run: node e2e/runner/run_cypress_ci.js start
diff --git a/.github/workflows/e2e-cross-version-for-breaking-changes.yml b/.github/workflows/e2e-cross-version-for-breaking-changes.yml
deleted file mode 100644
index 19919d49164..00000000000
--- a/.github/workflows/e2e-cross-version-for-breaking-changes.yml
+++ /dev/null
@@ -1,162 +0,0 @@
-name: E2E cross-version for breaking changes
-
-# See `bin/backward-compatibility-test.js` for the documentation of this workflow.
-
-on:
- workflow_dispatch:
- inputs:
- fe-ref:
- description: "Frontend git ref to use"
- type: string
- required: true
- default: "master"
- be-ref:
- description: "Backend git ref to use"
- type: string
- required: true
- default: "master"
- total-shards:
- description: "Total number of parallel test shards"
- type: number
- required: false
- default: 4
- workflow_call:
- inputs:
- fe-ref:
- description: "Frontend git ref to use"
- type: string
- required: true
- be-ref:
- description: "Backend git ref to use"
- type: string
- required: true
- total-shards:
- description: "Total number of parallel test shards"
- type: number
- required: false
- default: 4
-
-jobs:
- generate-matrix:
- name: "Breaking changes E2E > Generate matrix"
- runs-on: ubuntu-latest
- outputs:
- matrix_json: ${{ steps.set_matrix.outputs.matrix_json }}
- shards_total: ${{ steps.set_matrix.outputs.shards_total }}
- steps:
- - name: Set up shard matrix
- id: set_matrix
- uses: actions/github-script@v7
- with:
- # generate an output like `{"matrixJson": "{\"shard\": [1, 2, 3, 4]}", "shardsTotal": 4}` to be used in the other jobs
- script: |
- const totalShards = parseInt(process.env.TOTAL_SHARDS_INPUT, 10);
-
- const matrix = { shard: Array.from({ length: totalShards }, (_, i) => i + 1) };
-
- console.log("Generated matrix JSON", matrix);
- console.log(`Total shards: ${totalShards}`);
-
- core.setOutput('matrix_json', JSON.stringify(matrix));
- core.setOutput('shards_total', totalShards);
- env:
- TOTAL_SHARDS_INPUT: ${{ inputs.total-shards }}
-
- build-jar:
- name: "Breaking changes E2E > Build jar"
- runs-on: ubuntu-22.04
- timeout-minutes: 45
-
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Prepare Node.js
- # We're not using `actions/prepare-frontend` because we don't want to install deps from the root repo
- # nor we want to touch the cache as we'll be potentially be installing different versions of packages
- uses: actions/setup-node@v4
- with:
- node-version-file: ".nvmrc"
-
- - name: Prepare back-end environment
- uses: ./.github/actions/prepare-backend
- with:
- m2-cache-key: cross-version-uberjar
-
- - name: Build jar with different frontend and backend version
- env:
- MB_EDITION: ee
- CYPRESS_CI: true
- run: |
- node bin/backward-compatibility-test.js \
- ${{ inputs.fe-ref }} ${{ inputs.be-ref }} \
- build
-
- - name: Upload Uberjar
- uses: actions/upload-artifact@v4
- with:
- name: metabase-jar-cross-version
- path: .tmp/metabase-be/target/uberjar/metabase.jar
- if-no-files-found: error
-
- run-breaking-changes-tests:
- name: "Breaking changes E2E > Run breaking changes tests"
- needs: [build-jar, generate-matrix]
- runs-on: ubuntu-22.04
- timeout-minutes: 45
- env:
- TOTAL_SHARDS: ${{ needs.generate-matrix.outputs.shards_total }}
- strategy:
- fail-fast: false
- matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix_json) }}
-
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Prepare Node.js
- uses: actions/setup-node@v4
- with:
- node-version-file: ".nvmrc"
-
- - name: Prepare back-end environment
- uses: ./.github/actions/prepare-backend
- with:
- m2-cache-key: cross-version-uberjar
-
- - name: Download Uberjar
- uses: actions/download-artifact@v4
- with:
- name: metabase-jar-cross-version
- path: .tmp/metabase-be/target/uberjar/
-
- - name: Download FE repo
- run: |
- git clone --depth 1 -b ${{ inputs.fe-ref }} https://github.com/metabase/metabase.git .tmp/metabase-fe
-
- - name: Install FE dependencies
- working-directory: .tmp/metabase-fe
- run: |
- yarn install
-
- - name: Prepare Cypress environment
- id: cypress-prep
- uses: ./.github/actions/prepare-cypress
- with:
- working-directory: .tmp/metabase-fe
-
- - name: Run the tests
- env:
- MB_EDITION: ee
- CYPRESS_MB_ALL_FEATURES_TOKEN: ${{ secrets.MB_ALL_FEATURES_TOKEN }}
- CYPRESS_MB_STARTER_CLOUD_TOKEN: ${{ secrets.MB_STARTER_CLOUD_TOKEN }}
- CYPRESS_MB_PRO_CLOUD_TOKEN: ${{ secrets.MB_PRO_CLOUD_TOKEN }}
- CYPRESS_MB_PRO_SELF_HOSTED_TOKEN: ${{ secrets.MB_PRO_SELF_HOSTED_TOKEN }}
- CYPRESS_CI: true
- run: |
- node bin/backward-compatibility-test.js \
- ${{ inputs.fe-ref }} ${{ inputs.be-ref }} \
- start > /dev/null & \
- node bin/backward-compatibility-test.js \
- ${{ inputs.fe-ref }} ${{ inputs.be-ref }} \
- test ${{ matrix.shard}}/${{ env.TOTAL_SHARDS }}
diff --git a/.github/workflows/embedding-sdk.yml b/.github/workflows/embedding-sdk.yml
index b4f52e83c6e..b3068515df5 100644
--- a/.github/workflows/embedding-sdk.yml
+++ b/.github/workflows/embedding-sdk.yml
@@ -146,24 +146,13 @@ jobs:
with:
cached-embedding-sdk-dist-artifact-name: embedding-sdk-${{ github.event.pull_request.head.sha || github.sha }}
- e2e-component-tests-embedding-sdk-cross-version:
- name: "[Backport only] SDK e2e cross version tests"
- # run on: every push on release branches, and every pr that targets a release branch
- if: ${{ startsWith(github.ref, 'refs/heads/release-x.') || (github.event_name == 'pull_request' && startsWith(github.base_ref, 'release-x.')) }}
- uses: ./.github/workflows/e2e-component-tests-embedding-sdk-cross-version.yml
+ e2e-component-tests-embedding-sdk-backward-compatibility:
+ name: "SDK e2e backward compatibility tests"
+ uses: ./.github/workflows/e2e-component-tests-embedding-sdk-backward-compatibility.yml
+ needs: [build]
secrets: inherit
-
- # Temporarily skipped because the cypress runner crashes
- # See `bin/backward-compatibility-test.js` for the documentation of this workflow.
- # cross-version-for-breaking-changes:
- # name: "[NOT REQUIRED - Experimental - Backport only] detect breaking changes with cross versions tests"
- # # run on: every pr that targets a release branch, it does NOT run for pr targeting master
- # if: ${{ github.event_name == 'pull_request' && startsWith(github.base_ref, 'release-x.') }}
- # uses: ./.github/workflows/e2e-cross-version-for-breaking-changes.yml
- # secrets: inherit
- # with:
- # fe-ref: ${{ github.base_ref }}
- # be-ref: ${{ github.head_ref }}
+ with:
+ cached-embedding-sdk-dist-artifact-name: embedding-sdk-${{ github.event.pull_request.head.sha || github.sha }}
embedding-sdk-tests-result:
needs:
@@ -171,7 +160,7 @@ jobs:
- embedding-sdk-docs-snippets-type-check
- embedding-sdk-api-documentation-generation-validation
- sdk-e2e-tests
- - e2e-component-tests-embedding-sdk-cross-version
+ # - e2e-component-tests-embedding-sdk-backward-compatibility
if: always() && !cancelled()
runs-on: ubuntu-latest
timeout-minutes: 5
diff --git a/bin/backward-compatibility-test.js b/bin/backward-compatibility-test.js
deleted file mode 100644
index b0cbce90e72..00000000000
--- a/bin/backward-compatibility-test.js
+++ /dev/null
@@ -1,279 +0,0 @@
-#!/usr/bin/env node
-/* eslint-disable no-console */
-/* global process */
-
-// This workflow is experimental POC, non-required, and is owned by team
-// Embedding. For the time being, unless you think you did a breaking change on
-// the backend, you can safely ignore this if it fails. If you're working on CI or
-// related work and can't get this to pass, please reach out to team Embedding.
-
-// This implements a POC of a way of testing for breaking changes explained in
-// https://www.notion.so/metabase/Tech-Run-e2e-with-different-versions-of-FE-and-BE-to-detect-breaking-changes-1b669354c9018068b55bc7f2ad4ca83a
-// It builds a uberjar with the frontend and a backend code from two different
-// commits, and runs the e2e tests from the frontend commit on the uberjar. The
-// goal is to try and detect breaking changes between the frontend and backend
-// code.
-
-const os = require("os");
-const fs = require("fs");
-const path = require("path");
-const { execSync } = require("child_process");
-
-const INSTRUCTIONS =
- "Usage: node bin/backward-compatibility-test.js <FE_GIT_REF> <BE_GIT_REF> <build|start|test> <?optional shard in format shard/total>";
-
-const args = process.argv.slice(2);
-if (args.length !== 3 && args.length !== 4) {
- console.log(INSTRUCTIONS);
- process.exit(1);
-}
-
-const FE_GIT_REF = args[0];
-const BE_GIT_REF = args[1];
-const COMMAND = args[2];
-const SHARD_ARG = args[3];
-
-const TMP_FOLDER = path.join(process.cwd(), ".tmp");
-const FE_FOLDER = path.join(TMP_FOLDER, "metabase-fe");
-const BE_FOLDER = path.join(TMP_FOLDER, "metabase-be");
-const JAR_PATH = path.join(BE_FOLDER, "target/uberjar/metabase.jar");
-
-const getTestFiles = () => {
- // This is not ideal as we're "hardcoding" the path to the files. The
- // alternative would have been to add a specific @tag to the tests we wanted
- // to run, but because we're running the test files from the frontend commit,
- // which is an "older" commit, that commit wouldn't have these tags. We went
- // with this in this POC, but we should revisit this if we graduate this to
- // "official" testing.
- const questionFiles = getFilesInsideFolder(
- path.join(FE_FOLDER, "e2e/test/scenarios/question"),
- ).map((file) => path.join("e2e/test/scenarios/question", file)); // make sure the path is how we expect, starting with "e2e/test..."
-
- return [
- "e2e/test/scenarios/dashboard/dashboard.cy.spec.js",
- ...questionFiles,
- ].filter((file) => !SKIPPED_FILES.includes(file));
-};
-
-// place to put files if we want to skip them
-const SKIPPED_FILES = [];
-
-console.log(`Using frontend (and test files and helpers) from ${FE_GIT_REF}`);
-console.log(`Using backend from ${BE_GIT_REF}`);
-console.log("---");
-console.log("To test locally run:");
-console.log(
- `node bin/backward-compatibility-test.js ${FE_GIT_REF} ${BE_GIT_REF} <build|start|test>`,
-);
-console.log("---");
-console.log(`TMP_FOLDER: ${TMP_FOLDER}`);
-console.log(`FE_FOLDER: ${FE_FOLDER}`);
-console.log(`BE_FOLDER: ${BE_FOLDER}`);
-console.log(`JAR_PATH: ${JAR_PATH}`);
-
-function printStep(message) {
- console.log("---");
- console.log(message);
- console.log("---");
-}
-
-function executeCommand(command, cwd, envOverrides = {}) {
- console.log(`Executing: ${command}${cwd ? " in " + cwd : ""}`);
- try {
- execSync(command, {
- stdio: "inherit",
- cwd: cwd,
- env: { ...process.env, ...envOverrides },
- });
- } catch (error) {
- console.error(`Failed to execute command: ${command}`);
- process.exit(1);
- }
-}
-
-function build() {
- printStep("Cleaning up tmp folder...");
- fs.rmSync(TMP_FOLDER, { recursive: true, force: true });
- fs.mkdirSync(TMP_FOLDER, { recursive: true });
- fs.writeFileSync(path.join(TMP_FOLDER, ".gitignore"), "*");
-
- printStep("Cloning frontend...");
- executeCommand(
- `git clone --depth 1 -b "${FE_GIT_REF}" https://github.com/metabase/metabase.git "${FE_FOLDER}"`,
- );
-
- printStep("Cloning backend...");
- executeCommand(
- `git clone --depth 1 -b "${BE_GIT_REF}" https://github.com/metabase/metabase.git "${BE_FOLDER}"`,
- );
-
- console.log("Building frontend...");
- executeCommand("yarn install", FE_FOLDER);
- executeCommand("yarn build-release", FE_FOLDER, {
- MB_EDITION: "ee",
- });
-
- printStep("Copying frontend build to backend...");
- const feResourcesClientPath = path.join(
- FE_FOLDER,
- "resources",
- "frontend_client",
- );
- const feResourcesSharedPath = path.join(
- FE_FOLDER,
- "resources",
- "frontend_shared",
- );
-
- const beResourcesPath = path.join(BE_FOLDER, "resources");
-
- const beTargetClientPath = path.join(beResourcesPath, "frontend_client");
- const beTargetSharedPath = path.join(beResourcesPath, "frontend_shared");
-
- fs.cpSync(feResourcesClientPath, beTargetClientPath, {
- recursive: true,
- force: true,
- });
- fs.cpSync(feResourcesSharedPath, beTargetSharedPath, {
- recursive: true,
- force: true,
- });
-
- printStep("Building uberjar...");
- const buildUberjarCommand =
- "clojure -X:drivers:build:build/all :steps '[:version :translations :drivers :uberjar]'";
- executeCommand(buildUberjarCommand, BE_FOLDER, { MB_EDITION: "ee" });
-}
-
-function start() {
- printStep("Starting the uberjar...");
-
- const dbFile = path.join(os.tmpdir(), `metabase-test-${process.pid}.db`);
-
- const cypressToken = process.env.CYPRESS_MB_ALL_FEATURES_TOKEN;
- if (typeof cypressToken === "undefined") {
- console.error(
- "Error: CYPRESS_MB_ALL_FEATURES_TOKEN environment variable is not set. This is required for the 'start' command.",
- );
- process.exit(1);
- }
-
- const javaEnv = {
- MB_DB_FILE: dbFile,
- MB_CONFIG_FILE_PATH: "",
- MB_DANGEROUS_UNSAFE_ENABLE_TESTING_H2_CONNECTIONS_DO_NOT_ENABLE: "true",
- MB_ENABLE_TEST_ENDPOINTS: "true",
- MB_PREMIUM_EMBEDDING_TOKEN: cypressToken,
- MB_JETTY_PORT: "4000",
- };
- executeCommand(`java -jar "${JAR_PATH}"`, process.cwd(), javaEnv);
-}
-
-async function checkBackendHealth() {
- try {
- const response = await fetch("http://localhost:4000/api/health");
- if (response.ok) {
- const data = await response.json();
- return data.status === "ok";
- }
- } catch (error) {
- return false;
- }
- return false;
-}
-
-async function waitForBackend() {
- printStep("Waiting for backend to be ready...");
- let attempts = 0;
- const maxAttempts = 120; // wait at most ~2 minutes
- while (attempts < maxAttempts) {
- if (await checkBackendHealth()) {
- printStep("Backend is ready");
- return;
- }
- attempts++;
- await new Promise((resolve) => setTimeout(resolve, 1000));
- }
- console.error("Backend did not become ready after 2 minutes.");
- process.exit(1);
-}
-
-async function test() {
- const { shard, totalShards, testForThisShard } = getTestShardInfo();
-
- console.log(
- `Shard ${shard} of ${totalShards} running tests:\n${testForThisShard.join(
- "\n",
- )}`,
- );
-
- await waitForBackend();
-
- printStep("Creating snapshot...");
- executeCommand("node e2e/runner/run_cypress_ci.js snapshot", FE_FOLDER);
-
- printStep("Running tests...");
- const testEnv = {
- BACKEND_PORT: "4000",
- TEST_SUITE: "e2e",
- // uncomment the line above to debug the tests with the ui
- // OPEN_UI: "true",
- };
-
- const cypressCommand = `node e2e/runner/run_cypress_ci.js e2e --env grepTags="--@flaky --@OSS --@external --@skip",grepOmitFiltered=true --spec "${testForThisShard.join(",")}"`;
- executeCommand(cypressCommand, FE_FOLDER, testEnv);
-}
-
-const getTestShardInfo = () => {
- const testFiles = getTestFiles();
-
- if (!SHARD_ARG) {
- return {
- shard: 1,
- totalShards: 1,
- testForThisShard: testFiles,
- };
- }
-
- const totalShards = SHARD_ARG.split("/")[1];
- const shard = SHARD_ARG.split("/")[0];
- const testForThisShard = testFiles.filter(
- (_test, i) => i % totalShards === shard - 1,
- );
-
- return {
- shard,
- totalShards,
- testForThisShard,
- };
-};
-
-function getFilesInsideFolder(folder) {
- return fs.readdirSync(folder); //.map((file) => path.join(folder, file));
-}
-
-// main logic
-(async () => {
- try {
- switch (COMMAND) {
- case "build":
- build();
- break;
- case "start":
- start();
- break;
- case "test":
- await test();
- break;
- default:
- console.log(INSTRUCTIONS);
- process.exit(1);
- }
- } catch (error) {
- console.error(
- "An unexpected error occurred during script execution:",
- error,
- );
- process.exit(1);
- }
-})();
diff --git a/release/src/version-helpers.ts b/release/src/version-helpers.ts
index 0a9a9ca66ec..1355ba3b446 100644
--- a/release/src/version-helpers.ts
+++ b/release/src/version-helpers.ts
@@ -118,60 +118,6 @@ export const getSdkVersionFromReleaseTagName = (tagName: string) => {
return match[1];
};
-export const getSdkVersionFromReleaseBranchName = async ({
- github,
- owner,
- repo,
- branchName,
-}: GithubProps & { branchName: string }) => {
- const majorVersion = getMajorVersionNumberFromReleaseBranch(branchName);
-
- let sdkVersion: string;
-
- console.log(
- `Resolved latest major release version - ${Number(majorVersion)}`,
- );
-
- console.log(
- `Looking for git tag - "embedding-sdk-0.${Number(majorVersion)}.*"`,
- );
-
- const latestSdkTagForMajorRelease = await getLastEmbeddingSdkReleaseTag({
- github,
- owner,
- repo,
- majorVersion,
- });
-
- console.log(
- `Resolved SDK latest release tag for v${majorVersion} - ${latestSdkTagForMajorRelease}`,
- );
-
- if (latestSdkTagForMajorRelease) {
- sdkVersion = getSdkVersionFromReleaseTagName(latestSdkTagForMajorRelease);
-
- console.log(
- `Resolved SDK latest release version for v${majorVersion} - ${sdkVersion}`,
- );
-
- return sdkVersion;
- }
-
- const latestSdkTag = await getLastEmbeddingSdkReleaseTag({
- github,
- owner,
- repo,
- });
-
- sdkVersion = getSdkVersionFromReleaseTagName(latestSdkTag);
-
- console.warn(
- `Failed to resolve latest SDK package version! Using latest SDK version available - ${sdkVersion}`,
- );
-
- return sdkVersion;
-};
-
export const getDotXs = (version: string, number: number) => {
const pieces = version.replace(/-.+/, "").split("."); // ignore any -suffixes
return pieces.slice(0, number + 1).join(".") + ".x";