Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra[minor]: Add vertexai to latest/lowest ci #5727

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 41 additions & 24 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ env:
# so that they run in parallel instead of overwhelming the default 2 CPU runner.
jobs:
# LangChain
test-langchain-with-latest-deps:
langchain-latest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -38,14 +38,10 @@ 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 with latest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-langchain-with-latest-deps
run: docker compose -f dependency_range_tests/docker-compose.yml run langchain-latest-deps

test-langchain-with-lowest-deps:
langchain-lowest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -54,15 +50,11 @@ 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 with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-langchain-with-lowest-deps
run: docker compose -f dependency_range_tests/docker-compose.yml run langchain-lowest-deps

# Community
test-community-with-latest-deps:
community-latest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -76,9 +68,9 @@ jobs:
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/community` with latest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-community-with-latest-deps
run: docker compose -f dependency_range_tests/docker-compose.yml run community-latest-deps

test-community-with-lowest-deps:
community-lowest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -92,10 +84,10 @@ jobs:
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/community` with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-community-with-lowest-deps
run: docker compose -f dependency_range_tests/docker-compose.yml run community-lowest-deps

# OpenAI
test-openai-with-latest-deps:
openai-latest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -109,9 +101,9 @@ jobs:
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/openai` with latest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-openai-with-latest-deps
run: docker compose -f dependency_range_tests/docker-compose.yml run openai-latest-deps

test-openai-with-lowest-deps:
openai-lowest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -125,10 +117,10 @@ jobs:
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/openai` with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-openai-with-lowest-deps
run: docker compose -f dependency_range_tests/docker-compose.yml run openai-lowest-deps

# Anthropic
test-anthropic-with-latest-deps:
anthropic-latest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -142,9 +134,9 @@ jobs:
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/anthropic` with latest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-anthropic-with-latest-deps
run: docker compose -f dependency_range_tests/docker-compose.yml run anthropic-latest-deps

test-anthropic-with-lowest-deps:
anthropic-lowest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -158,4 +150,29 @@ jobs:
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/anthropic` with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-anthropic-with-lowest-deps
run: docker compose -f dependency_range_tests/docker-compose.yml run anthropic-lowest-deps

# VertexAI
vertexai-latest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
- name: Test `@langchain/google-vertexai` with latest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run vertexai-latest-deps

vertexai-lowest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
- name: Test `@langchain/google-vertexai` with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run vertexai-lowest-deps
42 changes: 31 additions & 11 deletions dependency_range_tests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
# LangChain
test-langchain-with-latest-deps:
langchain-latest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
Expand All @@ -12,23 +12,20 @@ services:
- ../langchain:/langchain
- ./scripts:/scripts
command: bash /scripts/langchain/test-with-latest-deps.sh
test-langchain-with-lowest-deps:
langchain-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
- ../langchain:/langchain
- ./scripts:/scripts
command: bash /scripts/langchain/test-with-lowest-deps.sh

# Community
test-community-with-latest-deps:
community-latest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
Expand All @@ -42,7 +39,7 @@ services:
- ../libs/langchain-community:/libs/langchain-community
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/community/test-with-latest-deps.sh
test-community-with-lowest-deps:
community-lowest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
Expand All @@ -58,7 +55,7 @@ services:
command: bash /scripts/with_standard_tests/community/test-with-lowest-deps.sh

# OpenAI
test-openai-with-latest-deps:
openai-latest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
Expand All @@ -72,7 +69,7 @@ services:
- ../libs/langchain-openai:/libs/langchain-openai
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/openai/test-with-latest-deps.sh
test-openai-with-lowest-deps:
openai-lowest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
Expand All @@ -88,7 +85,7 @@ services:
command: bash /scripts/with_standard_tests/openai/test-with-lowest-deps.sh

# Anthropic
test-anthropic-with-latest-deps:
anthropic-latest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
Expand All @@ -102,7 +99,7 @@ services:
- ../libs/langchain-anthropic:/libs/langchain-anthropic
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/anthropic/test-with-latest-deps.sh
test-anthropic-with-lowest-deps:
anthropic-lowest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
Expand All @@ -116,3 +113,26 @@ services:
- ../libs/langchain-anthropic:/libs/langchain-anthropic
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/anthropic/test-with-lowest-deps.sh

# VertexAI
vertexai-latest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
working_dir: /app
volumes:
- ../libs/langchain-google-vertexai:/libs/langchain-google-vertexai
- ./scripts:/scripts
command: bash /scripts/vertexai/test-with-latest-deps.sh
vertexai-lowest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
working_dir: /app
volumes:
- ../libs/langchain-google-vertexai:/libs/langchain-google-vertexai
- ./scripts:/scripts
command: bash /scripts/vertexai/test-with-lowest-deps.sh

9 changes: 9 additions & 0 deletions dependency_range_tests/scripts/vertexai/node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there! 👋 I noticed that a new dependency for "semver" with a version range of "^7.5.4" has been added to the package.json file. This change is flagged for your review to ensure it aligns with the project's dependency management strategy. Keep up the great work! 🚀

"name": "dependency-range-tests",
"version": "0.0.0",
"private": true,
"description": "Tests dependency ranges for LangChain.",
"dependencies": {
"semver": "^7.5.4"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const fs = require("fs");
const semver = require("semver");

const communityPackageJsonPath = "package.json";

const currentPackageJson = JSON.parse(fs.readFileSync(communityPackageJsonPath));

if (currentPackageJson.dependencies["@langchain/core"] && !currentPackageJson.dependencies["@langchain/core"].includes("rc")) {
const minVersion = semver.minVersion(
currentPackageJson.dependencies["@langchain/core"]
).version;
currentPackageJson.overrides = {
...currentPackageJson.overrides,
"@langchain/core": minVersion,
};
currentPackageJson.dependencies = {
...currentPackageJson.dependencies,
"@langchain/core": minVersion,
};
}

if (currentPackageJson.dependencies["@langchain/google-gauth"] && !currentPackageJson.dependencies["@langchain/google-gauth"].includes("rc")) {
const minVersion = semver.minVersion(
currentPackageJson.dependencies["@langchain/google-gauth"]
).version;
currentPackageJson.overrides = {
...currentPackageJson.overrides,
"@langchain/google-gauth": minVersion,
};
currentPackageJson.dependencies = {
...currentPackageJson.dependencies,
"@langchain/google-gauth": minVersion,
};
}

fs.writeFileSync(communityPackageJsonPath, JSON.stringify(currentPackageJson, null, 2));
22 changes: 22 additions & 0 deletions dependency_range_tests/scripts/vertexai/node/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


lru-cache@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
dependencies:
yallist "^4.0.0"

semver@^7.5.4:
version "7.5.4"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
dependencies:
lru-cache "^6.0.0"

yallist@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
16 changes: 16 additions & 0 deletions dependency_range_tests/scripts/vertexai/test-with-latest-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/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%
27 changes: 27 additions & 0 deletions dependency_range_tests/scripts/vertexai/test-with-lowest-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/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%
Loading