From cd3becf7cbe1e781add7562f80fee43d268b9bbe Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Wed, 3 Jul 2024 16:51:07 -0300 Subject: [PATCH 1/7] bugfix: add env import to spec files correctly --- .../tests/end-to-end/Basic Prompting.spec.ts | 6 ++++++ .../tests/end-to-end/Blog Writer.spec.ts | 5 +++++ .../tests/end-to-end/Document QA.spec.ts | 5 +++++ .../tests/end-to-end/Memory Chatbot.spec.ts | 5 +++++ .../chatInputOutputUser-shard-0.spec.ts | 7 ++++--- .../chatInputOutputUser-shard-1.spec.ts | 7 ++++--- .../chatInputOutputUser-shard-2.spec.ts | 7 ++++--- .../tests/end-to-end/decisionFlow.spec.ts | 7 +++++++ .../tests/end-to-end/deleteComponents.spec.ts | 7 +++++++ .../tests/end-to-end/deleteFlows.spec.ts | 6 ++++++ .../tests/end-to-end/generalBugs-shard-0.spec.ts | 7 ++++--- .../tests/end-to-end/generalBugs-shard-1.spec.ts | 4 +++- .../tests/end-to-end/generalBugs-shard-2.spec.ts | 6 +++++- .../tests/end-to-end/generalBugs-shard-3.spec.ts | 16 +++++++++++----- src/frontend/tests/end-to-end/logs.spec.ts | 6 ++++++ .../tests/end-to-end/store-shard-1.spec.ts | 12 ++++++++++++ .../tests/end-to-end/store-shard-2.spec.ts | 12 ++++++++++++ .../tests/end-to-end/store-shard-3.spec.ts | 12 ++++++++++++ .../tests/end-to-end/textInputOutput.spec.ts | 7 ++++--- 19 files changed, 122 insertions(+), 22 deletions(-) diff --git a/src/frontend/tests/end-to-end/Basic Prompting.spec.ts b/src/frontend/tests/end-to-end/Basic Prompting.spec.ts index 47b2aff23732..f4837d22c962 100644 --- a/src/frontend/tests/end-to-end/Basic Prompting.spec.ts +++ b/src/frontend/tests/end-to-end/Basic Prompting.spec.ts @@ -1,4 +1,6 @@ import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; test("Basic Prompting (Hello, World)", async ({ page }) => { test.skip( @@ -6,6 +8,10 @@ test("Basic Prompting (Hello, World)", async ({ page }) => { "OPENAI_API_KEY required to run this test", ); + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(2000); diff --git a/src/frontend/tests/end-to-end/Blog Writer.spec.ts b/src/frontend/tests/end-to-end/Blog Writer.spec.ts index b0cbfbec1257..4c9b26cccd4c 100644 --- a/src/frontend/tests/end-to-end/Blog Writer.spec.ts +++ b/src/frontend/tests/end-to-end/Blog Writer.spec.ts @@ -1,4 +1,5 @@ import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; import path from "path"; test("Blog Writer", async ({ page }) => { @@ -7,6 +8,10 @@ test("Blog Writer", async ({ page }) => { "OPENAI_API_KEY required to run this test", ); + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(2000); diff --git a/src/frontend/tests/end-to-end/Document QA.spec.ts b/src/frontend/tests/end-to-end/Document QA.spec.ts index 682c71d6eb71..a9e733b2d001 100644 --- a/src/frontend/tests/end-to-end/Document QA.spec.ts +++ b/src/frontend/tests/end-to-end/Document QA.spec.ts @@ -1,4 +1,5 @@ import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; import path from "path"; test("Document QA", async ({ page }) => { @@ -7,6 +8,10 @@ test("Document QA", async ({ page }) => { "OPENAI_API_KEY required to run this test", ); + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(2000); diff --git a/src/frontend/tests/end-to-end/Memory Chatbot.spec.ts b/src/frontend/tests/end-to-end/Memory Chatbot.spec.ts index 86103469de3f..8f07f0ba6009 100644 --- a/src/frontend/tests/end-to-end/Memory Chatbot.spec.ts +++ b/src/frontend/tests/end-to-end/Memory Chatbot.spec.ts @@ -1,4 +1,5 @@ import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; import path from "path"; test("Memory Chatbot", async ({ page }) => { @@ -7,6 +8,10 @@ test("Memory Chatbot", async ({ page }) => { "OPENAI_API_KEY required to run this test", ); + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(2000); diff --git a/src/frontend/tests/end-to-end/chatInputOutputUser-shard-0.spec.ts b/src/frontend/tests/end-to-end/chatInputOutputUser-shard-0.spec.ts index 5475e2f8d272..598a4caf2a7b 100644 --- a/src/frontend/tests/end-to-end/chatInputOutputUser-shard-0.spec.ts +++ b/src/frontend/tests/end-to-end/chatInputOutputUser-shard-0.spec.ts @@ -4,14 +4,15 @@ import { readFileSync } from "fs"; import path from "path"; test("user must be able to send an image on chat", async ({ page }) => { - if (!process.env.CI) { - dotenv.config({ path: path.resolve(__dirname, "../../.env") }); - } test.skip( !process?.env?.OPENAI_API_KEY, "OPENAI_API_KEY required to run this test", ); + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); diff --git a/src/frontend/tests/end-to-end/chatInputOutputUser-shard-1.spec.ts b/src/frontend/tests/end-to-end/chatInputOutputUser-shard-1.spec.ts index d9d6a2933f82..2eefc6985c34 100644 --- a/src/frontend/tests/end-to-end/chatInputOutputUser-shard-1.spec.ts +++ b/src/frontend/tests/end-to-end/chatInputOutputUser-shard-1.spec.ts @@ -4,14 +4,15 @@ import { readFileSync } from "fs"; import path from "path"; test("user must be able to see output inspection", async ({ page }) => { - if (!process.env.CI) { - dotenv.config({ path: path.resolve(__dirname, "../../.env") }); - } test.skip( !process?.env?.OPENAI_API_KEY, "OPENAI_API_KEY required to run this test", ); + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); diff --git a/src/frontend/tests/end-to-end/chatInputOutputUser-shard-2.spec.ts b/src/frontend/tests/end-to-end/chatInputOutputUser-shard-2.spec.ts index 6bcd35dbea9a..9a5232a5fd57 100644 --- a/src/frontend/tests/end-to-end/chatInputOutputUser-shard-2.spec.ts +++ b/src/frontend/tests/end-to-end/chatInputOutputUser-shard-2.spec.ts @@ -4,14 +4,15 @@ import { readFileSync } from "fs"; import path from "path"; test("user must interact with chat with Input/Output", async ({ page }) => { - if (!process.env.CI) { - dotenv.config({ path: path.resolve(__dirname, "../../.env") }); - } test.skip( !process?.env?.OPENAI_API_KEY, "OPENAI_API_KEY required to run this test", ); + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); diff --git a/src/frontend/tests/end-to-end/decisionFlow.spec.ts b/src/frontend/tests/end-to-end/decisionFlow.spec.ts index 83d0c67f1233..30cdd41b9f01 100644 --- a/src/frontend/tests/end-to-end/decisionFlow.spec.ts +++ b/src/frontend/tests/end-to-end/decisionFlow.spec.ts @@ -1,10 +1,17 @@ import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; test("should create a flow with decision", async ({ page }) => { test.skip( !process?.env?.OPENAI_API_KEY, "OPENAI_API_KEY required to run this test", ); + + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.locator("span").filter({ hasText: "My Collection" }).isVisible(); await page.waitForTimeout(2000); diff --git a/src/frontend/tests/end-to-end/deleteComponents.spec.ts b/src/frontend/tests/end-to-end/deleteComponents.spec.ts index 70b09303f3f6..21665016b759 100644 --- a/src/frontend/tests/end-to-end/deleteComponents.spec.ts +++ b/src/frontend/tests/end-to-end/deleteComponents.spec.ts @@ -1,10 +1,17 @@ import { test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; test("should delete a component", async ({ page }) => { test.skip( !process?.env?.STORE_API_KEY, "STORE_API_KEY required to run this test", ); + + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); diff --git a/src/frontend/tests/end-to-end/deleteFlows.spec.ts b/src/frontend/tests/end-to-end/deleteFlows.spec.ts index a5824517d188..7314a92755a4 100644 --- a/src/frontend/tests/end-to-end/deleteFlows.spec.ts +++ b/src/frontend/tests/end-to-end/deleteFlows.spec.ts @@ -1,10 +1,16 @@ import { test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; test("should delete a flow", async ({ page }) => { test.skip( !process?.env?.STORE_API_KEY, "STORE_API_KEY required to run this test", ); + + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } await page.goto("/"); await page.waitForTimeout(1000); diff --git a/src/frontend/tests/end-to-end/generalBugs-shard-0.spec.ts b/src/frontend/tests/end-to-end/generalBugs-shard-0.spec.ts index be387f18b3b4..faa6d322278f 100644 --- a/src/frontend/tests/end-to-end/generalBugs-shard-0.spec.ts +++ b/src/frontend/tests/end-to-end/generalBugs-shard-0.spec.ts @@ -43,14 +43,15 @@ test("should interact with api request", async ({ page }) => { }); test("erase button should clear the chat messages", async ({ page }) => { - if (!process.env.CI) { - dotenv.config({ path: path.resolve(__dirname, "../../.env") }); - } test.skip( !process?.env?.OPENAI_API_KEY, "OPENAI_API_KEY required to run this test", ); + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); diff --git a/src/frontend/tests/end-to-end/generalBugs-shard-1.spec.ts b/src/frontend/tests/end-to-end/generalBugs-shard-1.spec.ts index f2fafcc08501..ed7e6a22ea23 100644 --- a/src/frontend/tests/end-to-end/generalBugs-shard-1.spec.ts +++ b/src/frontend/tests/end-to-end/generalBugs-shard-1.spec.ts @@ -7,7 +7,9 @@ test("should delete rows from table message", async ({ page }) => { !process?.env?.OPENAI_API_KEY, "OPENAI_API_KEY required to run this test", ); - + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } await page.goto("/"); await page.waitForTimeout(2000); diff --git a/src/frontend/tests/end-to-end/generalBugs-shard-2.spec.ts b/src/frontend/tests/end-to-end/generalBugs-shard-2.spec.ts index 4da6c3e30ba0..144c8bba1ca1 100644 --- a/src/frontend/tests/end-to-end/generalBugs-shard-2.spec.ts +++ b/src/frontend/tests/end-to-end/generalBugs-shard-2.spec.ts @@ -1,11 +1,15 @@ import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; test("should use webhook component on API", async ({ page }) => { test.skip( !process?.env?.OPENAI_API_KEY, "OPENAI_API_KEY required to run this test", ); - + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } await page.goto("/"); await page.waitForTimeout(2000); diff --git a/src/frontend/tests/end-to-end/generalBugs-shard-3.spec.ts b/src/frontend/tests/end-to-end/generalBugs-shard-3.spec.ts index cbcd9f671094..579c096e6a81 100644 --- a/src/frontend/tests/end-to-end/generalBugs-shard-3.spec.ts +++ b/src/frontend/tests/end-to-end/generalBugs-shard-3.spec.ts @@ -1,6 +1,17 @@ import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; test("should copy code from playground modal", async ({ page }) => { + test.skip( + !process?.env?.OPENAI_API_KEY, + "OPENAI_API_KEY required to run this test", + ); + + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.locator("span").filter({ hasText: "My Collection" }).isVisible(); await page.waitForTimeout(2000); @@ -80,11 +91,6 @@ test("should copy code from playground modal", async ({ page }) => { await page.getByTitle("zoom out").click(); await page.getByTitle("zoom out").click(); - test.skip( - !process?.env?.OPENAI_API_KEY, - "OPENAI_API_KEY required to run this test", - ); - await page .getByTestId("popover-anchor-input-openai_api_key") .fill(process.env.OPENAI_API_KEY ?? ""); diff --git a/src/frontend/tests/end-to-end/logs.spec.ts b/src/frontend/tests/end-to-end/logs.spec.ts index 3eb697711eb4..8e713cc1ec17 100644 --- a/src/frontend/tests/end-to-end/logs.spec.ts +++ b/src/frontend/tests/end-to-end/logs.spec.ts @@ -1,4 +1,6 @@ import { test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; test("should able to see and interact with logs", async ({ page }) => { test.skip( @@ -6,6 +8,10 @@ test("should able to see and interact with logs", async ({ page }) => { "OPENAI_API_KEY required to run this test", ); + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(2000); diff --git a/src/frontend/tests/end-to-end/store-shard-1.spec.ts b/src/frontend/tests/end-to-end/store-shard-1.spec.ts index 10bef89c7e00..5b1d4e5be685 100644 --- a/src/frontend/tests/end-to-end/store-shard-1.spec.ts +++ b/src/frontend/tests/end-to-end/store-shard-1.spec.ts @@ -1,10 +1,17 @@ import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; test("should like and add components and flows", async ({ page }) => { test.skip( !process?.env?.STORE_API_KEY, "STORE_API_KEY required to run this test", ); + + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); @@ -76,6 +83,11 @@ test("should find a searched Component on Store", async ({ page }) => { !process?.env?.STORE_API_KEY, "STORE_API_KEY required to run this test", ); + + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); diff --git a/src/frontend/tests/end-to-end/store-shard-2.spec.ts b/src/frontend/tests/end-to-end/store-shard-2.spec.ts index d084ef48ab2a..9c017b8219a5 100644 --- a/src/frontend/tests/end-to-end/store-shard-2.spec.ts +++ b/src/frontend/tests/end-to-end/store-shard-2.spec.ts @@ -1,10 +1,17 @@ import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; test("should filter by tag", async ({ page }) => { test.skip( !process?.env?.STORE_API_KEY, "STORE_API_KEY required to run this test", ); + + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); @@ -50,6 +57,11 @@ test("should share component with share button", async ({ page }) => { !process?.env?.STORE_API_KEY, "STORE_API_KEY required to run this test", ); + + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); diff --git a/src/frontend/tests/end-to-end/store-shard-3.spec.ts b/src/frontend/tests/end-to-end/store-shard-3.spec.ts index 5612baf56edf..82d937b92863 100644 --- a/src/frontend/tests/end-to-end/store-shard-3.spec.ts +++ b/src/frontend/tests/end-to-end/store-shard-3.spec.ts @@ -1,10 +1,17 @@ import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; test("should order the visualization", async ({ page }) => { test.skip( !process?.env?.STORE_API_KEY, "STORE_API_KEY required to run this test", ); + + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); @@ -46,6 +53,11 @@ test("should filter by type", async ({ page }) => { !process?.env?.STORE_API_KEY, "STORE_API_KEY required to run this test", ); + + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(1000); diff --git a/src/frontend/tests/end-to-end/textInputOutput.spec.ts b/src/frontend/tests/end-to-end/textInputOutput.spec.ts index f7ca18684d30..1b7b5799610d 100644 --- a/src/frontend/tests/end-to-end/textInputOutput.spec.ts +++ b/src/frontend/tests/end-to-end/textInputOutput.spec.ts @@ -3,14 +3,15 @@ import * as dotenv from "dotenv"; import path from "path"; test("TextInputOutputComponent", async ({ page }) => { - if (!process.env.CI) { - dotenv.config({ path: path.resolve(__dirname, "../../.env") }); - } test.skip( !process?.env?.OPENAI_API_KEY, "OPENAI_API_KEY required to run this test", ); + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + await page.goto("/"); await page.waitForTimeout(2000); From ff5544ea85a4754229525b85de8d9be64d968663 Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Wed, 3 Jul 2024 17:10:26 -0300 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=94=A7=20(ci.yml):=20fix=20indentatio?= =?UTF-8?q?n=20for=20consistency=20and=20readability=20in=20CI=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 150 +++++++++++++++++++-------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca9fd48b1dab..37f50be1de2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,83 +15,83 @@ concurrency: 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/**" + 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-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 + env: + CI: true + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + STORE_API_KEY: ${{ secrets.STORE_API_KEY }} + 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-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 + test-docs-build: + needs: path-filter + if: ${{ needs.path-filter.outputs.docs == 'true' }} + name: Test Docs Build + uses: ./.github/workflows/docs_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 \ No newline at end of file + # 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 From 0524fba28cb18c4dfb8d60e09b7d94b8ab328bcc Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Wed, 3 Jul 2024 17:16:53 -0300 Subject: [PATCH 3/7] ci: add inputs to workflow --- .github/workflows/ci.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37f50be1de2a..ec8107402f97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,14 @@ on: description: "(Optional) Branch to checkout" required: false type: string + openai_api_key: + description: "OpenAI API Key" + required: false + type: string + store_api_key: + description: "Store API Key" + required: false + type: string pull_request: concurrency: @@ -60,9 +68,8 @@ jobs: 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 env: - CI: true - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - STORE_API_KEY: ${{ secrets.STORE_API_KEY }} + OPENAI_API_KEY: ${{ inputs.openai_api_key || secrets.OPENAI_API_KEY }} + STORE_API_KEY: ${{ inputs.store_api_key || secrets.STORE_API_KEY }} lint-backend: needs: path-filter From 37d1f37cd71015aad78217df729526b95cd1414b Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Wed, 3 Jul 2024 17:31:52 -0300 Subject: [PATCH 4/7] bugfix: improve flaky test general bugs to run smoothier on CI --- .../end-to-end/generalBugs-shard-1.spec.ts | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/frontend/tests/end-to-end/generalBugs-shard-1.spec.ts b/src/frontend/tests/end-to-end/generalBugs-shard-1.spec.ts index ed7e6a22ea23..9d5d8682a83a 100644 --- a/src/frontend/tests/end-to-end/generalBugs-shard-1.spec.ts +++ b/src/frontend/tests/end-to-end/generalBugs-shard-1.spec.ts @@ -53,30 +53,9 @@ test("should delete rows from table message", async ({ page }) => { await page.waitForSelector("text=built successfully", { timeout: 30000 }); await page.getByText("built successfully").last().click({ - timeout: 15000, + timeout: 30000, }); - await page.getByText("Playground", { exact: true }).click(); - await page - .getByText("No input message provided.", { exact: true }) - .last() - .isVisible(); - - await page.waitForSelector('[data-testid="input-chat-playground"]', { - timeout: 100000, - }); - - await page - .getByTestId("input-chat-playground") - .last() - .fill("Say hello as a pirate"); - await page.getByTestId("icon-LucideSend").last().click(); - - await page.waitForSelector("text=matey", { - timeout: 100000, - }); - - await page.getByText("Close").last().click(); await page.getByTestId("user-profile-settings").last().click(); await page.getByText("Settings").last().click(); await page.getByText("Messages").last().click(); From da288615d84cbb6a3a84e3e9ab4adfd65196d848 Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Wed, 3 Jul 2024 17:54:20 -0300 Subject: [PATCH 5/7] ci: add more shards to improve tests on CI --- .github/workflows/typescript_test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index b7a48bb02f7c..246ef2567933 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -9,7 +9,6 @@ on: required: false type: string - env: POETRY_VERSION: "1.8.3" NODE_VERSION: "21" @@ -25,8 +24,8 @@ jobs: strategy: fail-fast: false matrix: - shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - shardTotal: [10] + shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] + shardTotal: [14] env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} STORE_API_KEY: ${{ secrets.STORE_API_KEY }} From 161afe55b426775607078cce31b2445320a869b3 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 3 Jul 2024 22:24:55 -0300 Subject: [PATCH 6/7] ci(typescript_test.yml): modify env variables to use inputs if available, fallback to secrets for OPENAI_API_KEY and STORE_API_KEY --- .github/workflows/typescript_test.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 246ef2567933..b7beb96d763d 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -2,6 +2,11 @@ name: Run Frontend Tests on: workflow_call: + secrets: + OPENAI_API_KEY: + required: true + STORE_API_KEY: + required: true workflow_dispatch: inputs: branch: @@ -27,8 +32,8 @@ jobs: shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] shardTotal: [14] env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - STORE_API_KEY: ${{ secrets.STORE_API_KEY }} + OPENAI_API_KEY: ${{ inputs.openai_api_key || secrets.OPENAI_API_KEY }} + STORE_API_KEY: ${{ inputs.store_api_key || secrets.STORE_API_KEY }} steps: - name: Checkout code uses: actions/checkout@v4 From 533cd20de65e741c4d7ee7b9904775bce516661c Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 3 Jul 2024 22:25:20 -0300 Subject: [PATCH 7/7] fix(ci.yml): update job to use secrets instead of inputs for OPENAI_API_KEY and STORE_API_KEY --- .github/workflows/ci.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec8107402f97..f00a30efe10a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,16 +8,18 @@ on: description: "(Optional) Branch to checkout" required: false type: string - openai_api_key: - description: "OpenAI API Key" - required: false - type: string - store_api_key: - description: "Store API Key" - required: false - type: string + openai_api_key: + description: "OpenAI API Key" + required: false + type: string + store_api_key: + description: "Store API Key" + required: false + type: string pull_request: + + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -67,9 +69,9 @@ jobs: 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 - env: - OPENAI_API_KEY: ${{ inputs.openai_api_key || secrets.OPENAI_API_KEY }} - STORE_API_KEY: ${{ inputs.store_api_key || secrets.STORE_API_KEY }} + secrets: + OPENAI_API_KEY: "${{ secrets.OPENAI_API_KEY }}" + STORE_API_KEY: "${{ secrets.STORE_API_KEY }}" lint-backend: needs: path-filter