ci: update CI workflows and add CI workflow (#2498)

* chore(workflows): update lint-js.yml and lint-py.yml workflows to include support for workflow_call and workflow_dispatch events with optional branch input for checkout

* chore(docs_test.yml): update workflow triggers to include workflow_call and workflow_dispatch events

* ci(python_test.yml): update workflow to trigger on workflow_dispatch event and add support for optional branch input parameter to checkout specific branch for testing

* chore(typescript_test.yml): remove unnecessary pull_request event types to streamline workflow configuration

* feat(ci.yml): add CI workflow for automated testing and linting of backend, frontend, and documentation code

* chore: update release.yml to include CI workflow for automated testing and linting

* chore(typescript_test.yml): remove unnecessary 'if: always()' condition from merge-reports job

* chore(ci): add typescript_test.yml to the list of files included in the frontend job for CI workflow

* chore(ci.yml): fix typo in file path for typescript_test.yml in the frontend job of CI workflow

* chore(ci.yml): update path-filter job in CI workflow to include frontend tests and fix typo in file path for typescript_test.yml

* chore(ci.yml): add concurrency configuration to improve workflow efficiency

fix(ci.yml): include tests output in the filter paths job to run frontend tests when needed

* chore(ci.yml): update CI workflow to remove lint-frontend job

* chore(ci.yml): restructure CI workflow to improve readability and maintainability
feat(ci.yml): add separate jobs for frontend tests, backend linting, and docs build to enhance testing coverage
feat(ci.yml): introduce a final job 'CI Success' to check the status of all previous jobs and provide a summary of the CI pipeline execution

* ci(ci.yml): add dependencies between jobs to ensure proper execution order and avoid unnecessary runs

* chore(ci.yml): reformat YAML file for better readability and consistency in indentation
feat(ci.yml): add support for running backend tests, frontend tests, linting backend code, and testing docs build in CI workflow
feat(ci.yml): introduce a final step 'CI Success' to check the status of all previous jobs and exit with appropriate code based on their results

* chore(ci.yml): Remove concurrency configuration and cancel-in-progress option from lint-js, lint-py, python_test, and style-check-py workflows

* chore(ci.yml): Update pull_request event types in js_autofix.yml workflow to remove auto_merge_enabled

* chore: Remove concurrency configuration and cancel-in-progress option from typescript_test.yml workflow

* refactor: change add store key inside test

* ♻️ (tests): remove hardcoded API key and use environment variable
 (tests): add environment variable check to skip tests if not set

*  (store-shard-2.spec.ts): add test skip condition for STORE_API_KEY
 (store-shard-2.spec.ts): implement test for sharing component with API key

*  (store-shard-2.spec.ts): update navigation step in end-to-end test to click "My Collection" instead of going to home page

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-07-03 12:24:35 -03:00 committed by GitHub
commit a3bf1c4502
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 233 additions and 137 deletions

97
.github/workflows/ci.yml vendored Normal file
View file

@ -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

View file

@ -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"
@ -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

View file

@ -2,7 +2,7 @@ name: autofix.ci
on:
pull_request:
types: [opened, synchronize, reopened, auto_merge_enabled]
types: [opened, synchronize, reopened]
paths:
- "src/frontend/**"

View file

@ -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"
@ -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

View file

@ -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:
@ -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:

View file

@ -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:
@ -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:

View file

@ -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:

View file

@ -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"

View file

@ -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"
@ -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