Skip to content

Commit

Permalink
merge upstream/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoguilhermeS committed Jun 23, 2024
1 parent 378488a commit b5fc296
Show file tree
Hide file tree
Showing 938 changed files with 56,865 additions and 38,075 deletions.
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,8 @@ LANGFLOW_STORE_ENVIRONMENT_VARIABLES=

# LIKE_WEBHOOK_URL
#
# LANGFLOW_LIKE_WEBHOOK_URL=
# LANGFLOW_LIKE_WEBHOOK_URL=

# Value must finish with slash /
#BACKEND_URL=http://localhost:7860/
BACKEND_URL=
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ Dockerfile text
*.mp4 binary
*.svg binary
*.csv binary

9 changes: 7 additions & 2 deletions .github/actions/poetry_caching/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,15 @@ runs:
if: steps.cache-bin-poetry.outputs.cache-hit != 'true'
shell: bash
env:
POETRY_VERSION: ${{ inputs.poetry-version }}
POETRY_VERSION: ${{ inputs.poetry-version || env.POETRY_VERSION }}
PYTHON_VERSION: ${{ inputs.python-version }}
# Install poetry using the python version installed by setup-python step.
run: pipx install "poetry==$POETRY_VERSION" --python '${{ steps.setup-python.outputs.python-path }}' --verbose
run: |
pipx install "poetry==$POETRY_VERSION" --python '${{ steps.setup-python.outputs.python-path }}' --verbose
pipx ensurepath
# Ensure the poetry binary is available in the PATH.
# Test that the poetry binary is available.
poetry --version
- name: Restore pip and poetry cached dependencies
uses: actions/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry==$POETRY_VERSION
run: pipx install poetry==${{ env.POETRY_VERSION }}
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
Expand Down
107 changes: 90 additions & 17 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,109 @@ on:
options:
- base
- main
env:
POETRY_VERSION: "1.8.2"
TEST_TAG: "langflowai/langflow:test"

jobs:
docker_build:
name: Build Docker Image
setup:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.set-vars.outputs.tags }}
file: ${{ steps.set-vars.outputs.file }}
steps:
- uses: actions/checkout@v4
- name: Set Dockerfile and Tags
id: set-vars
run: |
if [[ "${{ inputs.release_type }}" == "base" ]]; then
echo "tags=langflowai/langflow:base-${{ inputs.version }}" >> $GITHUB_OUTPUT
echo "file=./docker/build_and_push_base.Dockerfile" >> $GITHUB_OUTPUT
else
echo "tags=langflowai/langflow:${{ inputs.version }},langflowai/langflow:1.0-alpha" >> $GITHUB_OUTPUT
echo "file=./docker/build_and_push.Dockerfile" >> $GITHUB_OUTPUT
fi
build:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set Dockerfile and Tags
id: set-vars
run: |
if [ "${{ inputs.release_type }}" == "base" ]; then
echo "DOCKERFILE=./docker/build_and_push_base.Dockerfile" >> $GITHUB_ENV
echo "TAGS=langflowai/langflow:base-${{ inputs.version }}" >> $GITHUB_ENV
else
echo "DOCKERFILE=./docker/build_and_push.Dockerfile" >> $GITHUB_ENV
echo "TAGS=langflowai/langflow:${{ inputs.version }},langflowai/langflow:1.0-alpha" >> $GITHUB_ENV
fi
- name: Build and push
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ${{ needs.setup.outputs.file }}
tags: ${{ needs.setup.outputs.tags }}
# provenance: false will result in a single manifest for all platforms which makes the image pullable from arm64 machines via the emulation (e.g. Apple Silicon machines)
provenance: false

build_components:
if: ${{ inputs.release_type == 'main' }}
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
component: [backend, frontend]
include:
- component: backend
dockerfile: ./docker/build_and_push_backend.Dockerfile
tags: langflowai/langflow-backend:${{ inputs.version }},langflowai/langflow-backend:1.0-alpha
- component: frontend
dockerfile: ./docker/frontend/build_and_push_frontend.Dockerfile
tags: langflowai/langflow-frontend:${{ inputs.version }},langflowai/langflow-frontend:1.0-alpha
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Wait for Docker Hub to propagate (for backend)
run: sleep 120
- name: Build and push ${{ matrix.component }}
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ${{ env.DOCKERFILE }}
tags: ${{ env.TAGS }}
build-args: |
LANGFLOW_IMAGE=langflowai/langflow:${{ inputs.version }}
file: ${{ matrix.dockerfile }}
tags: ${{ matrix.tags }}
# provenance: false will result in a single manifest for all platforms which makes the image pullable from arm64 machines via the emulation (e.g. Apple Silicon machines)
provenance: false

restart-space:
name: Restart HuggingFace Spaces
if: ${{ inputs.release_type == 'main' }}
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
python-version:
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_caching"
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Python dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install
- name: Restart HuggingFace Spaces Build
run: |
poetry run python ./scripts/factory_restart_space.py --space "Langflow/Langflow-Preview" --token ${{ secrets.HUGGINGFACE_API_TOKEN }}
64 changes: 64 additions & 0 deletions .github/workflows/docker_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Test Docker images

on:
push:
branches: [main]
paths:
- "docker/**"
- "poetry.lock"
- "pyproject.toml"
- "src/backend/**"
- ".github/workflows/docker_test.yml"
pull_request:
branches: [dev]
paths:
- "docker/**"
- "poetry.lock"
- "pyproject.toml"
- "src/**"
- ".github/workflows/docker_test.yml"

env:
POETRY_VERSION: "1.8.2"

jobs:
test-docker:
runs-on: ubuntu-latest
name: Test docker images
steps:
- uses: actions/checkout@v4
- name: Build image
run: |
docker build -t langflowai/langflow:latest-dev \
-f docker/build_and_push.Dockerfile \
.
- name: Test image
run: |
expected_version=$(cat pyproject.toml | grep version | head -n 1 | cut -d '"' -f 2)
version=$(docker run --rm --entrypoint bash langflowai/langflow:latest-dev -c 'python -c "from langflow.version import __version__ as langflow_version; print(langflow_version)"')
if [ "$expected_version" != "$version" ]; then
echo "Expected version: $expected_version"
echo "Actual version: $version"
exit 1
fi
- name: Build backend image
run: |
docker build -t langflowai/langflow-backend:latest-dev \
--build-arg LANGFLOW_IMAGE=langflowai/langflow:latest-dev \
-f docker/build_and_push_backend.Dockerfile \
.
- name: Test backend image
run: |
expected_version=$(cat pyproject.toml | grep version | head -n 1 | cut -d '"' -f 2)
version=$(docker run --rm --entrypoint bash langflowai/langflow-backend:latest-dev -c 'python -c "from langflow.version import __version__ as langflow_version; print(langflow_version)"')
if [ "$expected_version" != "$version" ]; then
echo "Expected version: $expected_version"
echo "Actual version: $version"
exit 1
fi
- name: Build frontend image
run: |
docker build -t langflowai/langflow-frontend:latest-dev \
-f docker/frontend/build_and_push_frontend.Dockerfile \
.
52 changes: 52 additions & 0 deletions .github/workflows/lint-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Lint Frontend

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

env:
NODE_VERSION: "21"

jobs:
run-linters:
name: Run Prettier
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Cache Node.js dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('src/frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Node.js dependencies
run: |
cd src/frontend
npm install
if: ${{ steps.setup-node.outputs.cache-hit != 'true' }}

- name: Run Prettier
run: |
cd src/frontend
npm run format
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply Prettier formatting
branch: ${{ github.head_ref }}

21 changes: 4 additions & 17 deletions .github/workflows/lint.yml → .github/workflows/lint-py.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
name: lint
name: Lint Python

on:
push:
branches: [main]
paths:
- "poetry.lock"
- "pyproject.toml"
- "src/backend/**"
pull_request:
paths:
- "poetry.lock"
- "pyproject.toml"
- "src/backend/**"
- "tests/**"

env:
POETRY_VERSION: "1.8.2"
Expand All @@ -37,14 +32,6 @@ jobs:
run: |
poetry env use ${{ matrix.python-version }}
poetry install
- name: Get .mypy_cache to speed up mypy
uses: actions/cache@v4
env:
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "2"
with:
path: |
./.mypy_cache
key: ${{ runner.os }}-mypy-${{ hashFiles('**/pyproject.toml') }}
- name: Lint check
run: |
make lint
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
14 changes: 14 additions & 0 deletions .github/workflows/matchers/ruff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"problemMatcher": [
{
"owner": "ruff",
"pattern": [
{
"regexp": "^(Would reformat): (.+)$",
"message": 1,
"file": 2
}
]
}
]
}
26 changes: 26 additions & 0 deletions .github/workflows/pr-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PR checker

on:
pull_request:
types: [opened, edited, labeled, unlabeled, synchronize]

jobs:
pr-checker:
name: Check PR description
runs-on: [ubuntu-latest]
steps:
- name: Run PR title check
uses: transferwise/actions-pr-checker@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_TITLE_CONTAINS_PATTERN: ".{15,}" # Require at least 10 characters in the title
PR_COMMENT: |
Please provide a more meaningful PR title with at least 15 characters.
- name: Run PR description check
uses: transferwise/actions-pr-checker@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_CONTAINS_PATTERN: ".{25,}" # Require at least 10 characters in the description
PR_COMMENT: |
Please provide a more meaningful PR description with at least 25 characters.
5 changes: 4 additions & 1 deletion .github/workflows/pre-release-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry==$POETRY_VERSION
run: pipx install poetry==${{ env.POETRY_VERSION }}
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -60,6 +60,7 @@ jobs:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
id: qemu
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
Expand All @@ -75,3 +76,5 @@ jobs:
file: ./docker/build_and_push_base.Dockerfile
tags: |
langflowai/langflow:base-${{ needs.release.outputs.version }}
# provenance: false will result in a single manifest for all platforms which makes the image pullable from arm64 machines via the emulation (e.g. Apple Silicon machines)
provenance: false
Loading

0 comments on commit b5fc296

Please sign in to comment.