merge dev into two_edges

This commit is contained in:
cristhianzl 2024-06-17 10:01:28 -03:00
commit fcf4512210
133 changed files with 2534 additions and 1507 deletions

View file

@ -21,12 +21,14 @@ on:
- main
env:
POETRY_VERSION: "1.8.2"
TEST_TAG: "langflowai/langflow:test"
jobs:
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
@ -34,16 +36,22 @@ jobs:
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_base:
build:
runs-on: ubuntu-latest
needs: setup
strategy:
matrix:
platform: [linux/amd64, linux/arm64/v8]
file: [./docker/build_and_push.Dockerfile, ./docker/build_and_push_base.Dockerfile]
file:
[
./docker/build_and_push.Dockerfile,
./docker/build_and_push_base.Dockerfile
]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
@ -53,19 +61,39 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Base Image
# - name: Build Docker Image
# uses: docker/build-push-action@v5
# id: docker_build
# with:
# context: .
# push: false # Do not push yet
# platforms: "linux/amd64,linux/arm64/v8"
# load: true
# file: ${{ matrix.file }}
# tags: ${{ env.TEST_TAG }}
# - name: Run Container
# run: |
# docker run -d --name test_container -p 8000:8000 ${{ needs.setup.outputs.tags }}
# - name: Wait for Container to Start and Check Health
# run: |
# timeout 40 bash -c 'until curl -f http://127.0.0.1:8000/health; do sleep 1; done' || (echo "Server did not start in time" && docker logs test_container && docker stop test_container && docker rm test_container && exit 1)
# - name: Stop and Remove Container
# run: |
# docker stop test_container
# docker rm test_container
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: ${{ matrix.platform }}
file: ${{ matrix.file }}
platforms: "linux/amd64,linux/arm64/v8"
file: ${{ needs.setup.outputs.file }}
tags: ${{ needs.setup.outputs.tags }}
build_components:
if: ${{ inputs.release_type == 'main' }}
runs-on: ubuntu-latest
needs: build_base
needs: build
strategy:
matrix:
component: [backend, frontend]
@ -85,6 +113,8 @@ jobs:
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:
@ -100,7 +130,7 @@ jobs:
name: Restart HuggingFace Spaces
if: ${{ inputs.release_type == 'main' }}
runs-on: ubuntu-latest
needs: build_base
needs: build
strategy:
matrix:
python-version:

View file

@ -35,7 +35,7 @@ jobs:
- name: Install Node.js dependencies
run: |
cd src/frontend
npm ci
npm install
if: ${{ steps.setup-node.outputs.cache-hit != 'true' }}
- name: Run linters
@ -45,7 +45,9 @@ jobs:
auto_fix: true
git_email: "gabriel@langflow.org"
# Enable linters
eslint: true
# eslint: true
# eslint_auto_fix: true
prettier: true
prettier_auto_fix: true
prettier_args: '--write \"{tests,src}/**/*.{js,jsx,ts,tsx,json,md}\" --ignore-path .prettierignore'

View file

@ -62,6 +62,27 @@ jobs:
else
make build main=true
fi
- name: Test CLI
run: |
if [ "${{ inputs.release_type }}" == "base" ]; then
python -m pip install src/backend/base/dist/*.whl
else
python -m pip install dist/*.whl
fi
python -m langflow run --host 127.0.0.1 --port 7860 &
SERVER_PID=$!
# Wait for the server to start
timeout 40 bash -c 'until curl -f http://127.0.0.1:7860/health; do sleep 1; done' || (echo "Server did not start in time" && kill $SERVER_PID && exit 1)
# Terminate the server
kill $SERVER_PID || (echo "Failed to terminate the server" && exit 1)
sleep 10 # give the server some time to terminate
# Check if the server is still running
if kill -0 $SERVER_PID 2>/dev/null; then
echo "Failed to terminate the server"
exit 1
else
echo "Server terminated successfully"
fi
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}

View file

@ -42,4 +42,4 @@ jobs:
poetry install
- name: Run unit tests
run: |
make tests args="-n auto"
make unit_tests args="-n auto"

View file

@ -13,6 +13,7 @@ env:
jobs:
lint:
name: Ruff Style Check
runs-on: ubuntu-latest
strategy:
matrix: