Skip to content

Commit

Permalink
Merge branch 'zustand/io/migration' into globalVariables
Browse files Browse the repository at this point in the history
  • Loading branch information
ogabrielluiz committed Mar 27, 2024
2 parents 1434081 + 043ec91 commit 75d1c83
Show file tree
Hide file tree
Showing 70 changed files with 1,376 additions and 598 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ jobs:
pipx install poetry==$POETRY_VERSION
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install dependencies
- name: Install Python dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install
if: ${{ steps.setup-python.outputs.cache-hit != 'true' }}
- name: Analysing the code with our lint
run: |
make lint
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ jobs:
run: pipx install poetry==$POETRY_VERSION
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install dependencies
run: poetry install
- name: Install Python dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install
if: ${{ steps.setup-python.outputs.cache-hit != 'true' }}
- name: Run unit tests
run: |
make tests
149 changes: 149 additions & 0 deletions .github/workflows/typescript_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: Run Frontend Tests

on:
pull_request:
paths:
- "src/frontend/**"

env:
POETRY_VERSION: "1.8.2"
NODE_VERSION: "21"
PYTHON_VERSION: "3.10"
# Define the directory where Playwright browsers will be installed.
# Adjust if your project uses a different path.
PLAYWRIGHT_BROWSERS_PATH: "ms-playwright"

jobs:
setup-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
id: setup-node
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"

- name: Install Node.js dependencies
run: |
cd src/frontend
npm ci
if: ${{ steps.setup-node.outputs.cache-hit != 'true' }}

# Attempt to restore the correct Playwright browser binaries based on the
# currently installed version of Playwright (The browser binary versions
# may change with Playwright versions).
# Note: Playwright's cache directory is hard coded because that's what it
# says to do in the docs. There doesn't appear to be a command that prints
# it out for us.
# - uses: actions/cache@v4
# id: playwright-cache
# with:
# path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
# key: "${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package-lock.json') }}"
# # As a fallback, if the Playwright version has changed, try use the
# # most recently cached version. There's a good chance that at least one
# # of the browser binary versions haven't been updated, so Playwright can
# # skip installing that in the next step.
# # Note: When falling back to an old cache, `cache-hit` (used below)
# # will be `false`. This allows us to restore the potentially out of
# # date cache, but still let Playwright decide if it needs to download
# # new binaries or not.
# restore-keys: |
# ${{ runner.os }}-playwright-
- name: Cache playwright binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package-lock.json') }}
- name: Install Frontend dependencies
run: |
cd src/frontend
npm ci
- name: Install Playwright's browser binaries
run: |
cd src/frontend
npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Install Playwright's dependencies
run: |
cd src/frontend
npx playwright install-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'

# If the Playwright browser binaries weren't able to be restored, we tell
# paywright to install everything for us.
# - name: Install Playwright's dependencies
# if: steps.playwright-cache.outputs.cache-hit != 'true'
# run: npx playwright install --with-deps

- name: Install Poetry
run: pipx install "poetry==${{ env.POETRY_VERSION }}"

- name: Set up Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry"

- name: Install Python dependencies
run: |
poetry env use ${{ env.PYTHON_VERSION }}
poetry install
if: ${{ steps.setup-python.outputs.cache-hit != 'true' }}

- name: Run Playwright Tests
run: |
cd src/frontend
npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: Upload blob report to GitHub Actions Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ matrix.shardIndex }}
path: src/frontend/blob-report
retention-days: 1

merge-reports:
needs: setup-and-test
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: all-blob-reports
pattern: blob-report-*
merge-multiple: true

- name: Merge into HTML Report
run: |
npx playwright merge-reports --reporter html ./all-blob-reports
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 14
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,5 @@ src/backend/base/langflow/frontend/
.docker
scratchpad*
chroma*/*
stuff/*
src/frontend/playwright-report/index.html
39 changes: 27 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ setup_poetry:
pipx install poetry
poetry self add poetry-monorepo-dependency-plugin

add:
@echo 'Adding dependencies'
ifdef devel
cd src/backend/base && poetry add --group dev $(devel)
endif

ifdef main
poetry add $(main)
endif

ifdef base
cd src/backend/base && poetry add $(base)
endif

init:
@echo 'Installing backend dependencies'
make install_backend
Expand Down Expand Up @@ -47,9 +61,9 @@ run_frontend:

tests_frontend:
ifeq ($(UI), true)
cd src/frontend && ./run-tests.sh --ui
cd src/frontend && npx playwright test --ui --project=chromium
else
cd src/frontend && ./run-tests.sh
cd src/frontend && npx playwright test --project=chromium
endif

run_cli:
Expand All @@ -59,11 +73,12 @@ run_cli:
@make build_frontend > /dev/null
@echo 'Install backend dependencies'
@make install_backend > /dev/null
ifdef env
poetry run langflow run --path src/frontend/build --host $(host) --port $(port) --env-file $(env)
else
poetry run langflow run --path src/frontend/build --host $(host) --port $(port) --env-file .env
endif
ifdef env
poetry run langflow run --path src/frontend/build --host $(host) --port $(port) --env-file $(env)
else
poetry run langflow run --path src/frontend/build --host $(host) --port $(port) --env-file .env
endif


run_cli_debug:
@echo 'Running the CLI in debug mode'
Expand All @@ -72,11 +87,11 @@ run_cli_debug:
@make build_frontend > /dev/null
@echo 'Install backend dependencies'
@make install_backend > /dev/null
ifdef env
poetry run langflow run --path src/frontend/build --log-level debug --host $(host) --port $(port) --env-file $(env)
else
poetry run langflow run --path src/frontend/build --log-level debug --host $(host) --port $(port) --env-file .env
endif
ifdef env
poetry run langflow run --path src/frontend/build --log-level debug --host $(host) --port $(port) --env-file $(env)
else
poetry run langflow run --path src/frontend/build --log-level debug --host $(host) --port $(port) --env-file .env
endif

setup_devcontainer:
make init
Expand Down

0 comments on commit 75d1c83

Please sign in to comment.