diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml index d8ab26254f31..cfe5447fa7d3 100644 --- a/.github/workflows/compatibility.yml +++ b/.github/workflows/compatibility.yml @@ -152,8 +152,8 @@ jobs: - name: Test `@langchain/anthropic` with lowest deps run: docker compose -f dependency_range_tests/docker-compose.yml run anthropic-lowest-deps - # VertexAI - vertexai-latest-deps: + # Google VertexAI + google-vertexai-latest-deps: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -162,10 +162,14 @@ jobs: with: node-version: ${{ env.NODE_VERSION }} cache: "yarn" + - name: Install dependencies + run: yarn install --immutable + - name: Build `@langchain/standard-tests` + run: yarn build --filter=@langchain/standard-tests - name: Test `@langchain/google-vertexai` with latest deps - run: docker compose -f dependency_range_tests/docker-compose.yml run vertexai-latest-deps + run: docker compose -f dependency_range_tests/docker-compose.yml run google-vertexai-latest-deps - vertexai-lowest-deps: + google-vertexai-lowest-deps: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -174,5 +178,9 @@ jobs: with: node-version: ${{ env.NODE_VERSION }} cache: "yarn" + - name: Install dependencies + run: yarn install --immutable + - name: Build `@langchain/standard-tests` + run: yarn build --filter=@langchain/standard-tests - name: Test `@langchain/google-vertexai` with lowest deps - run: docker compose -f dependency_range_tests/docker-compose.yml run vertexai-lowest-deps + run: docker compose -f dependency_range_tests/docker-compose.yml run google-vertexai-lowest-deps \ No newline at end of file diff --git a/dependency_range_tests/docker-compose.yml b/dependency_range_tests/docker-compose.yml index 9c2f4ebdbc28..fbc7315d19fa 100644 --- a/dependency_range_tests/docker-compose.yml +++ b/dependency_range_tests/docker-compose.yml @@ -114,25 +114,32 @@ services: - ./scripts:/scripts command: bash /scripts/with_standard_tests/anthropic/test-with-lowest-deps.sh - # VertexAI - vertexai-latest-deps: + # Google VertexAI + google-vertexai-latest-deps: image: node:18 environment: PUPPETEER_SKIP_DOWNLOAD: "true" PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true" + COHERE_API_KEY: ${COHERE_API_KEY} working_dir: /app volumes: + - ../turbo.json:/turbo.json + - ../package.json:/package.json + - ../libs/langchain-standard-tests:/libs/langchain-standard-tests - ../libs/langchain-google-vertexai:/libs/langchain-google-vertexai - ./scripts:/scripts - command: bash /scripts/vertexai/test-with-latest-deps.sh - vertexai-lowest-deps: + command: bash /scripts/with_standard_tests/google-vertexai/test-with-latest-deps.sh + google-vertexai-lowest-deps: image: node:18 environment: PUPPETEER_SKIP_DOWNLOAD: "true" PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true" + COHERE_API_KEY: ${COHERE_API_KEY} working_dir: /app volumes: + - ../turbo.json:/turbo.json + - ../package.json:/package.json + - ../libs/langchain-standard-tests:/libs/langchain-standard-tests - ../libs/langchain-google-vertexai:/libs/langchain-google-vertexai - ./scripts:/scripts - command: bash /scripts/vertexai/test-with-lowest-deps.sh - \ No newline at end of file + command: bash /scripts/with_standard_tests/google-vertexai/test-with-lowest-deps.sh \ No newline at end of file diff --git a/dependency_range_tests/scripts/vertexai/test-with-latest-deps.sh b/dependency_range_tests/scripts/vertexai/test-with-latest-deps.sh deleted file mode 100644 index e5eb224b71e1..000000000000 --- a/dependency_range_tests/scripts/vertexai/test-with-latest-deps.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -set -euxo pipefail - -export CI=true - -# enable extended globbing for omitting build artifacts -shopt -s extglob - -# avoid copying build artifacts from the host -cp -r ../libs/langchain-google-vertexai/!(node_modules|dist|dist-cjs|dist-esm|build|.next|.turbo) ./ - -yarn - -# Check the test command completes successfully -NODE_OPTIONS=--experimental-vm-modules yarn run jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50% diff --git a/dependency_range_tests/scripts/vertexai/test-with-lowest-deps.sh b/dependency_range_tests/scripts/vertexai/test-with-lowest-deps.sh deleted file mode 100644 index 9a95587c845c..000000000000 --- a/dependency_range_tests/scripts/vertexai/test-with-lowest-deps.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -set -euxo pipefail - -export CI=true - -# enable extended globbing for omitting build artifacts -shopt -s extglob - -# avoid copying build artifacts from the host -cp -r ../libs/langchain-google-vertexai/!(node_modules|dist|dist-cjs|dist-esm|build|.next|.turbo) ./ - -mkdir -p /updater_script -cp -r /scripts/vertexai/node/!(node_modules|dist|dist-cjs|dist-esm|build|.next|.turbo) /updater_script/ - -cd /updater_script - -yarn - -cd /app - -node /updater_script/update_resolutions_lowest.js - -yarn - -# Check the test command completes successfully -NODE_OPTIONS=--experimental-vm-modules yarn run jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50% diff --git a/dependency_range_tests/scripts/vertexai/node/package.json b/dependency_range_tests/scripts/with_standard_tests/google-vertexai/node/package.json similarity index 100% rename from dependency_range_tests/scripts/vertexai/node/package.json rename to dependency_range_tests/scripts/with_standard_tests/google-vertexai/node/package.json diff --git a/dependency_range_tests/scripts/vertexai/node/update_resolutions_lowest.js b/dependency_range_tests/scripts/with_standard_tests/google-vertexai/node/update_resolutions_lowest.js similarity index 92% rename from dependency_range_tests/scripts/vertexai/node/update_resolutions_lowest.js rename to dependency_range_tests/scripts/with_standard_tests/google-vertexai/node/update_resolutions_lowest.js index b8768d8a7156..a600da592199 100644 --- a/dependency_range_tests/scripts/vertexai/node/update_resolutions_lowest.js +++ b/dependency_range_tests/scripts/with_standard_tests/google-vertexai/node/update_resolutions_lowest.js @@ -1,7 +1,7 @@ const fs = require("fs"); const semver = require("semver"); -const communityPackageJsonPath = "package.json"; +const communityPackageJsonPath = "/app/monorepo/libs/langchain-google-vertexai/package.json"; const currentPackageJson = JSON.parse(fs.readFileSync(communityPackageJsonPath)); diff --git a/dependency_range_tests/scripts/vertexai/node/yarn.lock b/dependency_range_tests/scripts/with_standard_tests/google-vertexai/node/yarn.lock similarity index 100% rename from dependency_range_tests/scripts/vertexai/node/yarn.lock rename to dependency_range_tests/scripts/with_standard_tests/google-vertexai/node/yarn.lock diff --git a/dependency_range_tests/scripts/with_standard_tests/google-vertexai/test-with-latest-deps.sh b/dependency_range_tests/scripts/with_standard_tests/google-vertexai/test-with-latest-deps.sh new file mode 100644 index 000000000000..3d43d870e321 --- /dev/null +++ b/dependency_range_tests/scripts/with_standard_tests/google-vertexai/test-with-latest-deps.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +export CI=true + +# New monorepo directory paths +monorepo_dir="/app/monorepo" +monorepo_openai_dir="/app/monorepo/libs/langchain-google-vertexai" + +# Run the shared script to copy all necessary folders/files +bash /scripts/with_standard_tests/shared.sh google-vertexai + +# Navigate back to monorepo root and install dependencies +cd "$monorepo_dir" +yarn + +# Navigate into `@langchain/google-vertexai` to build and run tests +# We need to run inside the google-vertexai directory so turbo repo does +# not try to build the package/its workspace dependencies. +cd "$monorepo_openai_dir" +yarn test diff --git a/dependency_range_tests/scripts/with_standard_tests/google-vertexai/test-with-lowest-deps.sh b/dependency_range_tests/scripts/with_standard_tests/google-vertexai/test-with-lowest-deps.sh new file mode 100644 index 000000000000..a8de92d9b983 --- /dev/null +++ b/dependency_range_tests/scripts/with_standard_tests/google-vertexai/test-with-lowest-deps.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +export CI=true + +monorepo_dir="/app/monorepo" +monorepo_openai_dir="/app/monorepo/libs/langchain-google-vertexai" +updater_script_dir="/app/updater_script" +updater_script_dir="/app/updater_script" +original_updater_script_dir="/scripts/with_standard_tests/google-vertexai/node" + +# Run the shared script to copy all necessary folders/files +bash /scripts/with_standard_tests/shared.sh google-vertexai + +# Copy the updater script to the monorepo +mkdir -p "$updater_script_dir" +cp "$original_updater_script_dir"/* "$updater_script_dir/" + +# Install deps (e.g semver) for the updater script +cd "$updater_script_dir" +yarn +# Run the updater script +node "update_resolutions_lowest.js" + + +# Navigate back to monorepo root and install dependencies +cd "$monorepo_dir" +yarn + +# Navigate into `@langchain/package` to build and run tests +# We need to run inside the package directory so turbo repo does +# not try to build the package/its workspace dependencies. +cd "$monorepo_openai_dir" +yarn test