Skip to content

Commit

Permalink
ci[patch]: Focus yarn install (langchain-ai#6284)
Browse files Browse the repository at this point in the history
* ci[patch]: Focus yarn install

* add back format, dont run ci in some cases

* cr

* cr

* cr

* cr

* cr

* cr

* cr

* cr
  • Loading branch information
bracesproul authored Jul 30, 2024
1 parent 58e211d commit 39229f9
Show file tree
Hide file tree
Showing 46 changed files with 138 additions and 57 deletions.
31 changes: 5 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
name: CI

on:
push:
branches: ["main"]
pull_request:
# Do not run this workflow if only docs changed.
paths-ignore:
paths_ignore:
- 'docs/**'
- 'dependency_range_tests/**'
- 'environment_tests/**'
- '.github/**'
- '!.github/workflows/ci.yml'
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI


Expand Down Expand Up @@ -38,25 +39,3 @@ jobs:
run: yarn install --immutable --mode=skip-build
- name: Check linting
run: yarn run lint

test-exports:
uses:
./.github/workflows/test-exports.yml
secrets: inherit

platform-compatibility:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-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: Install dependencies
run: yarn install --immutable
- name: Build `@langchain/core`
run: yarn build --filter=@langchain/core
9 changes: 5 additions & 4 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ on:
push:
branches: ["main"]
pull_request:
# Do not run this workflow if only docs/examples changed.
paths-ignore:
- 'docs/**'
- 'examples/**'
# Only run this workflow if the following directories have changed.
paths:
- 'langchain/**'
- 'langchain-core/**'
- 'libs/**'
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI

# If another push to the same PR or branch happens while this workflow is still running,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
name: Format

on:
push:
branches: ["main"]
pull_request:
paths_ignore:
- '.github/**'
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI


Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/platform-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Platform Compatibility

on:
pull_request:
# Only run this workflow if the following directories have changed.
paths:
- 'langchain/**'
- 'langchain-core/**'
- 'libs/**'
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI


# If another push to the same PR or branch happens while this workflow is still running,
# cancel the earlier run in favor of the next run.
#
# There's no point in testing an outdated version of the code. GitHub only allows
# a limited number of job runners to be active at the same time, so it's better to cancel
# pointless jobs early so that more useful jobs can run sooner.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
platform-compatibility:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-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: Install dependencies
run: cd ./langchain-core && yarn workspaces focus
- name: Build @langchain/scripts
run: cd ./libs/langchain-scripts && yarn build:internal
- name: Build `@langchain/core`
run: cd ./langchain-core && yarn build:internal
2 changes: 0 additions & 2 deletions .github/workflows/test-exports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ on:
- 'libs/langchain-anthropic/**'
- 'libs/langchain-community/**'
- 'libs/langchain-openai/**'
- 'examples/**'
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI
workflow_call: # Allows triggering the workflow from another workflow

# If another push to the same PR or branch happens while this workflow is still running,
# cancel the earlier run in favor of the next run.
Expand Down
28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

supportedArchitectures:
cpu:
Expand Down
1 change: 1 addition & 0 deletions langchain-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@langchain/scripts": "~0.0.20",
"@swc/core": "^1.3.90",
"@swc/jest": "^0.2.29",
"@types/decamelize": "^1.2.0",
"@types/mustache": "^4",
"dpdm": "^3.12.0",
"eslint": "^8.33.0",
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/caches/tests/in_memory_cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from "@jest/globals";
import { MessageContentComplex } from "../../messages/base.js";
import { InMemoryCache } from "../base.js";

Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/callbacks/tests/manager.int.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-process-env */
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";

import { PromptTemplate } from "../../prompts/prompt.js";
import { FakeLLM } from "../../utils/testing/index.js";
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/callbacks/tests/run_collector.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { v4 as uuidv4, validate } from "uuid";
import { Run } from "langsmith/schemas";
import { describe, it, expect } from "@jest/globals";
import {
ChatPromptTemplate,
HumanMessagePromptTemplate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-promise-executor-return */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { z } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
import { FakeChatModel, FakeListChatModel } from "../../utils/testing/index.js";
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/language_models/tests/llms.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-promise-executor-return */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { FakeLLM, FakeStreamingLLM } from "../../utils/testing/index.js";
import { HumanMessagePromptTemplate } from "../../prompts/chat.js";

Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/messages/tests/message_utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { it, expect } from "@jest/globals";
import { it, describe, test, expect } from "@jest/globals";
import {
filterMessages,
mergeMessageRuns,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { z } from "zod";
import { JsonOutputKeyToolsParser } from "../json_output_tools_parsers.js";
import { AIMessage } from "../../../messages/index.js";
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/output_parsers/tests/json.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from "@jest/globals";
import { ChatPromptTemplate } from "../../prompts/chat.js";
import { RunnableSequence } from "../../runnables/base.js";
import { RunnablePassthrough } from "../../runnables/passthrough.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-loop-func */
/* eslint-disable no-promise-executor-return */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { FakeStreamingLLM } from "../../utils/testing/index.js";
import { BytesOutputParser } from "../bytes.js";
import {
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/output_parsers/tests/string.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe } from "@jest/globals";
import { describe, test, expect } from "@jest/globals";
import { StringOutputParser } from "../string.js";
import {
AIMessage,
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/output_parsers/tests/xml.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from "@jest/globals";
import { FakeStreamingLLM } from "../../utils/testing/index.js";
import { XMLOutputParser } from "../xml.js";

Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/prompts/tests/few_shot.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from "@jest/globals";
import { expect, describe, test } from "@jest/globals";
import {
FewShotChatMessagePromptTemplate,
FewShotPromptTemplate,
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/prompts/tests/structured.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { ZodType, ZodTypeDef } from "zod";
import { test, expect } from "@jest/globals";
import {
StructuredOutputMethodParams,
StructuredOutputMethodOptions,
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/runnables/tests/runnable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { Run } from "langsmith";
import { v4 as uuidv4 } from "uuid";
import { jest } from "@jest/globals";
import { jest, test, expect, describe } from "@jest/globals";
import { createChatMessageChunkEncoderStream } from "../../language_models/chat_models.js";
import { BaseMessage, HumanMessage } from "../../messages/index.js";
import { OutputParserException } from "../../output_parsers/base.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { StringOutputParser } from "../../output_parsers/string.js";
import { FakeChatModel, FakeStreamingLLM } from "../../utils/testing/index.js";

Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/runnables/tests/runnable_branch.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { RunnableBranch } from "../branch.js";
import { ChatPromptTemplate } from "../../prompts/chat.js";
import { FakeStreamingLLM } from "../../utils/testing/index.js";
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/runnables/tests/runnable_graph.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { test, expect } from "@jest/globals";
import { StringOutputParser } from "../../output_parsers/string.js";
import { FakeLLM } from "../../utils/testing/index.js";
import { PromptTemplate } from "../../prompts/prompt.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from "@jest/globals";
import {
AIMessage,
AIMessageChunk,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test, expect } from "@jest/globals";
import { StringOutputParser } from "../../output_parsers/string.js";
import { PromptTemplate } from "../../prompts/prompt.js";
import { RunnableSequence } from "../base.js";
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/runnables/tests/runnable_map.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test, expect } from "@jest/globals";
import { StringOutputParser } from "../../output_parsers/string.js";
import {
ChatPromptTemplate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from "@jest/globals";
import { PromptTemplate } from "../../prompts/prompt.js";
import { FakeChatModel } from "../../utils/testing/index.js";
import { RunnablePassthrough } from "../passthrough.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from "@jest/globals";
import { HumanMessage } from "../../messages/index.js";
import { applyPatch } from "../../utils/json_patch.js";
import { RemoteRunnable } from "../remote.js";
Expand Down
9 changes: 8 additions & 1 deletion langchain-core/src/runnables/tests/runnable_remote.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { jest, test } from "@jest/globals";
import {
jest,
test,
expect,
describe,
beforeEach,
afterEach,
} from "@jest/globals";
import {
AIMessage,
AIMessageChunk,
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/runnables/tests/runnable_retry.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { RunnableLambda } from "../base.js";

test("RunnableRetry invoke", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable no-process-env */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test } from "@jest/globals";
import { test, expect, afterEach } from "@jest/globals";
import { z } from "zod";
import {
RunnableLambda,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable no-process-env */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test } from "@jest/globals";
import { test, expect, afterEach } from "@jest/globals";
import { z } from "zod";
import {
RunnableLambda,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import {
ChatPromptTemplate,
HumanMessagePromptTemplate,
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/runnables/tests/runnable_tools.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { z } from "zod";
import { test, expect } from "@jest/globals";
import { RunnableLambda, RunnableToolLike } from "../base.js";
import { FakeRetriever } from "../../utils/testing/index.js";
import { Document } from "../../documents/document.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Client } from "langsmith";
import { test } from "@jest/globals";
import { LangChainTracer } from "../../tracers/tracer_langchain.js";
import {
BaseOutputParser,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { FakeLLM } from "../../utils/testing/index.js";

test("RunnableWithFallbacks", async () => {
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/structured_query/tests/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-process-env */
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { castValue, isFloat, isInt, isString } from "../utils.js";

test("Casting values correctly", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-process-env */
import * as uuid from "uuid";
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";

import { LangChainTracer, Run } from "../tracer_langchain.js";
import { Serialized } from "../../load/serializable.js";
Expand Down
9 changes: 8 additions & 1 deletion langchain-core/src/tracers/tests/langsmith_interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
/* eslint-disable no-process-env */
/* eslint-disable no-promise-executor-return */

import { jest } from "@jest/globals";
import {
jest,
test,
beforeEach,
afterEach,
afterAll,
expect,
} from "@jest/globals";
import { traceable } from "langsmith/traceable";

import { RunnableLambda } from "../../runnables/base.js";
Expand Down
Loading

0 comments on commit 39229f9

Please sign in to comment.