langflow/.github/workflows/release.yml
Cristhian Zanforlin Lousa 989cefd0ac
tests: organize playwright tests by feature suites and optimize CI runtime (#4687)
* starting realocating components FE

* tagging tests

* 📝 (.github/workflows/typescript_test.yml): remove unnecessary comment before the Playwright test execution step to improve readability and maintainability

* 📝 (.github/changes-filter.yaml): Update paths in changes-filter.yaml to categorize different sections of the project for testing purposes
🔧 (.github/workflows/typescript_test.yml): Refactor workflow to use paths-filter action for determining test suites based on changes in different project sections

*  (changes-filter.yaml): reorganize and update paths for test categories, starter projects, components, workspace, api, and database
 (components): add new components for GradientWrapper, pageLayout, and paginatorComponent
🔧 (MainPage): update import path for PageLayout component
🔧 (SettingsPage): update import path for PageLayout component
🔧 (StorePage): update import path for PageLayout component

*  (frontend): Update import paths for components to use common directory instead of core directory for better organization and consistency
🔧 (frontend): Remove duplicate import of PaginatorComponent in various files and import it from the common directory to reduce redundancy and improve maintainability

* 🔧 (changes-filter.yaml): remove unnecessary release section from changes-filter.yaml
🔧 (typescript_test.yml): refactor workflow to support input suites and release flag for test runs

* 📝 (changes-filter.yaml): remove unnecessary entries from components section and add missing entries to workspace section for better organization and filtering of changes
🔧 (changes-filter.yaml): update changes-filter.yaml to include missing utils files in the frontend/src/utils directory
🔧 (typescript_test.yml): remove redundant code block that sets SUITES variable to default values as it is no longer needed due to changes in the changes-filter.yaml file

*  (actionsMainPage-shard-1.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity
📝 (store-shard-2.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity
📝 (generalBugs-shard-4.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity
📝 (generalBugs-shard-9.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity
📝 (deleteComponents.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity
📝 (deleteFlows.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity

 (dragAndDrop.spec.ts): Refactor drag and drop test to improve readability and maintainability
 (flowPage.spec.ts): Refactor save test in Flow Page to improve readability and maintainability
 (store-shard-0.spec.ts): Refactor Store test to improve readability and maintainability
 (store-shard-1.spec.ts): Refactor Store test to improve readability and maintainability

 (store-shard-3.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency
 (userSettings.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency
 (general-bugs-shard-3909.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency

📝 (frontend): Update test tags in regression tests to remove unnecessary tags for better organization and clarity
📝 (frontend): Update test file paths in tsconfig.json to match the new file structure for consistency and maintainability

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

* Update paths-filter action to v3 and adjust filter configuration file

* Add logging to matrix setup in TypeScript test workflow

* Refactor decisionFlow.spec.ts to improve test setup and execution flow

* Refactor import paths for genericIconComponent and shadTooltipComponent in PlaygroundButton component

* feat: add release input to CI workflows for enhanced deployment control

* Fix: Correct 'release' input type in CI workflow configuration

* [autofix.ci] apply automated fixes

* Refactor Blog Writer test: streamline setup and interaction steps

* Refactor test cases to improve modal handling and streamline API key input logic

* Add test grep pattern to GitHub Actions workflow for targeted test execution

- Introduced `test_grep` output in the `determine-test-suite` job to generate a grep pattern based on changed files or input suites.
- Updated Playwright test execution to use the generated grep pattern, allowing for more targeted test runs.
- Enhanced the `Set Matrix` step to include tag processing for test filtering.

* Enhance tag filtering in test workflow with regex lookaheads

* Fix syntax for default suite input in GitHub Actions workflow

* Update GitHub Actions to handle empty suite input for release builds

* Escape regex lookaheads and quotes for GitHub Actions in test workflow

* Update regex pattern and quote escaping in TypeScript test workflow

* Use single quotes for echo command in GitHub Actions script

* Refactor tag handling in GitHub Actions to use OR logic for grep patterns

* 🔧 (FlowPage/index.tsx): Remove unnecessary empty line to improve code readability and consistency

* 📝 (FlowPage/index.tsx): add missing line break for better code readability

* Refactor import path and reorder CSS classes for consistency in UpdateAllComponents component

* [autofix.ci] apply automated fixes

* Update import path for PaginatorComponent in AdminPage index.tsx

*  (logs.spec.ts): introduce a new variable 'modalCount' to keep track of the number of modals opened in the test suite

* 📝 (filterSidebar.spec.ts): remove unnecessary test steps related to filter removal and sidebar interactions to simplify and improve test focus on main functionality

*  (logs.spec.ts): add tests to ensure proper interaction with logs feature in the frontend application

*  (similarity.spec.ts): add a test tag for release and components to categorize the test case
💡 (similarity.spec.ts): add a comment to explain the purpose of the test case and the condition for skipping the test

*  (decisionFlow.spec.ts): add missing newline before async function declaration to improve code readability

*  (textInputOutput.spec.ts): skip the test for TextInputOutputComponent to exclude it from the test suite temporarily

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-25 20:55:03 +00:00

243 lines
8.7 KiB
YAML

name: Langflow Release
run-name: Langflow Release by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
release_package_base:
description: "Release Langflow Base"
required: true
type: boolean
default: false
release_package_main:
description: "Release Langflow"
required: true
type: boolean
default: false
build_docker_base:
description: "Build Docker Image for Langflow Base"
required: true
type: boolean
default: false
build_docker_main:
description: "Build Docker Image for Langflow"
required: true
type: boolean
default: false
build_docker_ep:
description: "Build Docker Image for Langflow with Entrypoint"
required: false
type: boolean
default: false
pre_release:
description: "Pre-release"
required: false
type: boolean
default: false
create_release:
description: "Whether to create a gh release"
required: false
type: boolean
default: true
jobs:
ci:
if: ${{ github.event.inputs.release_package_base == 'true' || github.event.inputs.release_package_main == 'true' }}
name: CI
uses: ./.github/workflows/ci.yml
with:
python-versions: "['3.10', '3.11', '3.12']"
frontend-tests-folder: "tests"
release: true
release-base:
name: Release Langflow Base
needs: [ci]
if: inputs.release_package_base == true
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check-version.outputs.version }}
skipped: ${{ steps.check-version.outputs.skipped }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-uv
- name: Install the project
run: uv sync --dev
- name: Check Version
id: check-version
run: |
version=$(uv tree | grep 'langflow-base' | awk '{print $3}' | sed 's/^v//')
last_released_version=$(curl -s "https://pypi.org/pypi/langflow-base/json" | jq -r '.releases | keys | .[]' | sort -V | tail -n 1)
if [ "$version" = "$last_released_version" ]; then
echo "Version $version is already released. Skipping release."
echo skipped=true >> $GITHUB_OUTPUT
exit 0
else
echo version=$version >> $GITHUB_OUTPUT
echo skipped=false >> $GITHUB_OUTPUT
fi
- name: Build project for distribution
if: steps.check-version.outputs.skipped == 'false'
run: make build base=true args="--wheel"
- name: Test CLI
if: steps.check-version.outputs.skipped == 'false'
run: |
# TODO: Unsure why the whl is not built in src/backend/base/dist
mkdir src/backend/base/dist
mv dist/*.whl src/backend/base/dist
uv pip install src/backend/base/dist/*.whl
uv run python -m langflow run --host 127.0.0.1 --port 7860 --backend-only &
SERVER_PID=$!
# Wait for the server to start
timeout 120 bash -c 'until curl -f http://127.0.0.1:7860/api/v1/auto_login; do sleep 2; 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 20 # 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 0
else
echo "Server terminated successfully"
fi
- name: Publish to PyPI
if: steps.check-version.outputs.skipped == 'false'
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
make publish base=true
- name: Upload Artifact
if: steps.check-version.outputs.skipped == 'false'
uses: actions/upload-artifact@v4
with:
name: dist-base
path: src/backend/base/dist
release-main:
name: Release Langflow Main
if: inputs.release_package_main == true
needs: [release-base]
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check-version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-uv
- name: Install the project
run: uv sync --dev
# If pre-release is true, we need to check if ["a", "b", "rc", "dev", "post"] is in the version string
# if the version string is incorrect, we need to exit the workflow
- name: Check if pre-release
if: inputs.pre_release == 'true'
run: |
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
if [[ "${version}" =~ ^([0-9]+\.)?([0-9]+\.)?[0-9]+((a|b|rc|dev|post)([0-9]+))$ ]]; then
echo "Pre-release version detected. Continuing with the release."
else
echo "Invalid pre-release version detected. Exiting the workflow."
exit 1
fi
- name: Check Version
id: check-version
run: |
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
last_released_version=$(curl -s "https://pypi.org/pypi/langflow/json" | jq -r '.releases | keys | .[]' | sort -V | tail -n 1)
if [ "$version" = "$last_released_version" ]; then
echo "Version $version is already released. Skipping release."
exit 1
else
echo version=$version >> $GITHUB_OUTPUT
fi
- name: Wait for PyPI Propagation
if: needs.release-base.outputs.skipped == 'false'
run: sleep 300 # wait for 5 minutes to ensure PyPI propagation
- name: Build project for distribution
run: make build main=true args="--no-sources --wheel"
- name: Test CLI
run: |
uv pip install dist/*.whl
uv run python -m langflow run --host 127.0.0.1 --port 7860 --backend-only &
SERVER_PID=$!
# Wait for the server to start
timeout 120 bash -c 'until curl -f http://127.0.0.1:7860/health_check; do sleep 2; 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 20 # 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 0
else
echo "Server terminated successfully"
fi
- name: Publish to PyPI
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
make publish main=true
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: dist-main
path: dist
call_docker_build_base:
name: Call Docker Build Workflow for Langflow Base
if: inputs.build_docker_base == true
needs: [release-base, release-main]
uses: ./.github/workflows/docker-build.yml
with:
base_version: ${{ needs.release-base.outputs.version }}
main_version: ${{ needs.release-main.outputs.version }}
release_type: base
pre_release: ${{ inputs.pre_release }}
secrets: inherit
call_docker_build_main:
name: Call Docker Build Workflow for Langflow
if: inputs.build_docker_main == true
needs: [release-main]
uses: ./.github/workflows/docker-build.yml
with:
main_version: ${{ needs.release-main.outputs.version }}
release_type: main
pre_release: ${{ inputs.pre_release }}
secrets: inherit
call_docker_build_main_ep:
name: Call Docker Build Workflow for Langflow with Entrypoint
if: inputs.build_docker_ep == true
needs: [release-main]
uses: ./.github/workflows/docker-build.yml
with:
main_version: ${{ needs.release-main.outputs.version }}
release_type: main-ep
pre_release: False
secrets: inherit
create_release:
name: Create Release
runs-on: ubuntu-latest
needs: release-main
steps:
- uses: actions/download-artifact@v4
with:
name: dist-main
path: dist
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
generateReleaseNotes: true
prerelease: ${{ inputs.pre_release }}
tag: ${{ needs.release-main.outputs.version }}
commit: ${{ github.ref }}