Skip to content

Commit

Permalink
ci[minor]: Add more packages to lowest/latest deps ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Jun 7, 2024
1 parent 6535861 commit 616e075
Show file tree
Hide file tree
Showing 12 changed files with 157 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,27 @@ jobs:
cache: "yarn"
- name: Test LangChain with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-langchain-with-lowest-deps

test-community-with-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/community` with latest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-community-with-latest-deps

test-community-with-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/community` with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run test-community-with-lowest-deps
27 changes: 25 additions & 2 deletions dependency_range_tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
volumes:
- ../langchain:/langchain
- ./scripts:/scripts
command: bash /scripts/test-langchain-with-latest-deps.sh
command: bash /scripts/langchain/test-with-latest-deps.sh
test-langchain-with-lowest-deps:
image: node:18
environment:
Expand All @@ -21,7 +21,30 @@ services:
volumes:
- ../langchain:/langchain
- ./scripts:/scripts
command: bash /scripts/test-langchain-with-lowest-deps.sh
command: bash /scripts/langchain/test-with-lowest-deps.sh

test-community-with-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:
- ../libs/langchain-community:/libs/langchain-community
- ./scripts:/scripts
command: bash /scripts/community/test-with-latest-deps.sh
test-community-with-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:
- ../libs/langchain-community:/libs/langchain-community
- ./scripts:/scripts
command: bash /scripts/community/test-with-lowest-deps.sh
success:
image: alpine:3.14
command: echo "Success"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const fs = require("fs");
const semver = require("semver");

const currentPackageJson = JSON.parse(fs.readFileSync("./package.json"));

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

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

fs.writeFileSync("./package.json", JSON.stringify(currentPackageJson, null, 2));
16 changes: 16 additions & 0 deletions dependency_range_tests/scripts/community/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-community/!(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/community/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-community/!(node_modules|dist|dist-cjs|dist-esm|build|.next|.turbo) ./

mkdir -p /updater_script
cp -r /scripts/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%
9 changes: 9 additions & 0 deletions dependency_range_tests/scripts/langchain/node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "dependency-range-tests",
"version": "0.0.0",
"private": true,
"description": "Tests dependency ranges for LangChain.",
"dependencies": {
"semver": "^7.5.4"
}
}
22 changes: 22 additions & 0 deletions dependency_range_tests/scripts/langchain/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==

0 comments on commit 616e075

Please sign in to comment.