Skip to content

Commit

Permalink
Merge branch 'main' into refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
ogabrielluiz authored Jul 3, 2024
2 parents 301494c + a3bf1c4 commit bb06cdb
Show file tree
Hide file tree
Showing 17 changed files with 234 additions and 138 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: CI

on:
workflow_call:
workflow_dispatch:
inputs:
branch:
description: "(Optional) Branch to checkout"
required: false
type: string
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
path-filter:
name: Filter Paths
runs-on: ubuntu-latest
outputs:
python: ${{ steps.filter.outputs.python }}
frontend: ${{ steps.filter.outputs.frontend }}
docs: ${{ steps.filter.outputs.docs }}
tests: ${{ steps.filter.outputs.tests }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch || github.ref }}
- name: Filter Paths
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
python:
- "src/backend/**"
- "src/backend/**.py"
- "pyproject.toml"
- "poetry.lock"
- "**/python_test.yml"
tests:
- "tests/**"
- "src/frontend/tests/**"
frontend:
- "src/frontend/**"
- "**/typescript_test.yml"
docs:
- "docs/**"
test-backend:
needs: path-filter
name: Run Backend Tests
if: ${{ needs.path-filter.outputs.python == 'true' || needs.path-filter.outputs.tests == 'true' }}
uses: ./.github/workflows/python_test.yml



test-frontend:
needs: path-filter
name: Run Frontend Tests
if: ${{ needs.path-filter.outputs.python == 'true' || needs.path-filter.outputs.frontend == 'true' || needs.path-filter.outputs.tests == 'true' }}
uses: ./.github/workflows/typescript_test.yml


lint-backend:
needs: path-filter
if: ${{ needs.path-filter.outputs.python == 'true' || needs.path-filter.outputs.tests == 'true' }}
name: Lint Backend
uses: ./.github/workflows/lint-py.yml
# Run only if there are python files changed

test-docs-build:
needs: path-filter
if: ${{ needs.path-filter.outputs.docs == 'true' }}
name: Test Docs Build
uses: ./.github/workflows/docs_test.yml


# https://github.com/langchain-ai/langchain/blob/master/.github/workflows/check_diffs.yml
ci_success:
name: "CI Success"
needs: [test-backend, test-frontend, lint-backend, test-docs-build]
if: |
always()
runs-on: ubuntu-latest
env:
JOBS_JSON: ${{ toJSON(needs) }}
RESULTS_JSON: ${{ toJSON(needs.*.result) }}
EXIT_CODE: ${{!contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && '0' || '1'}}
steps:
- name: "CI Success"
run: |
echo $JOBS_JSON
echo $RESULTS_JSON
echo "Exiting with $EXIT_CODE"
exit $EXIT_CODE
13 changes: 9 additions & 4 deletions .github/workflows/docs_test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name: Test Docs Build

on:
pull_request:
paths:
- "docs/**"
workflow_call:
workflow_dispatch:
inputs:
branch:
description: "(Optional) Branch to checkout"
required: false
type: string

env:
NODE_VERSION: "21"
Expand All @@ -17,7 +21,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

with:
ref: ${{ inputs.branch || github.ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
id: setup-node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/js_autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: autofix.ci

on:
pull_request:
types: [opened, synchronize, reopened, auto_merge_enabled]
types: [opened, synchronize, reopened]
paths:
- "src/frontend/**"

Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/lint-js.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Lint Frontend

on:
pull_request:
paths:
- "src/frontend/**"
workflow_call:
workflow_dispatch:
inputs:
branch:
description: "(Optional) Branch to checkout"
required: false
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: "21"
Expand All @@ -22,6 +23,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch || github.ref }}

- name: Setup Node.js
uses: actions/setup-node@v4
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/lint-py.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Lint Python

on:
pull_request:
types: [opened, synchronize, reopened, auto_merge_enabled]
workflow_call:
workflow_dispatch:
inputs:
branch:
description: "(Optional) Branch to checkout"
required: false
type: string
env:
POETRY_VERSION: "1.8.2"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
Expand All @@ -22,6 +24,8 @@ jobs:
- "3.10"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch || github.ref }}
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_caching"
with:
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/python_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: Python tests

on:
workflow_call:
pull_request:
types: [opened, synchronize, reopened, auto_merge_enabled]
branches: [main]
workflow_dispatch:
inputs:
branch:
description: "(Optional) Branch to checkout"
required: false
type: string
env:
POETRY_VERSION: "1.8.2"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.workflow, 'Release')}}

jobs:
build:
Expand All @@ -26,6 +26,8 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch || github.ref }}
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_caching"
with:
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@ env:
POETRY_VERSION: "1.8.2"

jobs:
test_frontend:
name: Call Typescript Test Workflow
uses: langflow-ai/langflow/.github/workflows/typescript_test.yml@main

test_backend:
name: Call Python Test Workflow
uses: langflow-ai/langflow/.github/workflows/python_test.yml@main
ci:
name: CI
uses: ./.github/workflows/ci.yml

release-base:
name: Release Langflow Base
needs: [test_backend, test_frontend]
needs: [ci]
if: inputs.release_package == true
runs-on: ubuntu-latest
outputs:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/style-check-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ on:
pull_request:
types: [opened, synchronize, reopened, auto_merge_enabled]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


env:
POETRY_VERSION: "1.8.2"
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/typescript_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ on:
description: "(Optional) Branch to checkout"
required: false
type: string
pull_request:
types: [opened, synchronize, reopened, auto_merge_enabled]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.workflow, 'Release')}}

env:
POETRY_VERSION: "1.8.3"
Expand Down Expand Up @@ -120,7 +115,6 @@ jobs:
merge-reports:
needs: setup-and-test
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion src/backend/base/langflow/graph/graph/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ def get_successors(vertex, recursive=True):
stack.append(successor.id)
else:
excluded.add(successor.id)
all_successors = get_successors(successor)
all_successors = get_successors(successor, recursive=False)
for successor in all_successors:
if is_start:
stack.append(successor.id)
Expand Down
21 changes: 6 additions & 15 deletions src/frontend/tests/end-to-end/deleteComponents.spec.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
import { test } from "@playwright/test";

test("should add API-KEY", async ({ page }) => {
test("should delete a component", async ({ page }) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
await page.goto("/");
await page.waitForTimeout(1000);

await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);

await page.getByTestId("api-key-button-store").click();
await page
.getByPlaceholder("Insert your API Key")
.fill("testtesttesttesttesttest");

await page.getByTestId("api-key-save-button-store").click();

await page.waitForTimeout(2000);
await page.getByText("Success! Your API Key has been saved.").isVisible();

await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");

await page.getByTestId("api-key-save-button-store").click();

await page.waitForTimeout(2000);
await page.getByText("Success! Your API Key has been saved.").isVisible();

await page.waitForTimeout(2000);
await page.getByText("API Key Error").isHidden();
});

test("should delete a component", async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(2000);
await page.getByText("Store").nth(0).click();
await page.getByTestId("install-Basic RAG").click();
Expand Down
23 changes: 6 additions & 17 deletions src/frontend/tests/end-to-end/deleteFlows.spec.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
import { test } from "@playwright/test";

test("should add API-KEY", async ({ page }) => {
test("should delete a flow", async ({ page }) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
await page.goto("/");
await page.waitForTimeout(1000);

await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);

await page.getByTestId("api-key-button-store").click();
await page
.getByPlaceholder("Insert your API Key")
.fill("testtesttesttesttesttest");

await page.getByTestId("api-key-save-button-store").click();

await page.waitForTimeout(2000);
await page.getByText("Success! Your API Key has been saved.").isVisible();

await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");

await page.getByTestId("api-key-save-button-store").click();

await page.waitForTimeout(2000);
await page.getByText("Success! Your API Key has been saved.").isVisible();

await page.waitForTimeout(2000);
await page.getByText("API Key Error").isHidden();
});

test("should delete a flow", async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(2000);

await page.waitForSelector("text=Store", { timeout: 30000 });

await page.getByText("Store").nth(0).click();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { test } from "@playwright/test";

test("should able to see and interact with logs", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);

await page.goto("/");
await page.waitForTimeout(2000);

Expand All @@ -20,7 +25,6 @@ test("should able to see and interact with logs", async ({ page }) => {
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForTimeout(1000);

await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForTimeout(2000);
Expand Down
Loading

0 comments on commit bb06cdb

Please sign in to comment.