langflow/.github/workflows/release.yml
Gabriel Luiz Freitas Almeida a3bf1c4502
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>
2024-07-03 08:24:35 -07:00

184 lines
No EOL
6.2 KiB
YAML

name: Langflow Release
run-name: Langflow Release by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
release_package:
description: "Release package"
required: true
type: boolean
default: false
pre_release:
description: "Pre-release"
required: false
type: boolean
default: true
env:
POETRY_VERSION: "1.8.2"
jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
release-base:
name: Release Langflow Base
needs: [ci]
if: inputs.release_package == true
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
- name: Set up Nodejs 20
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Check Version
id: check-version
run: |
version=$(cd src/backend/base && poetry version --short)
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."
exit 1
else
echo version=$version >> $GITHUB_OUTPUT
fi
- name: Build project for distribution
run: make build base=true
- name: Test CLI
run: |
python -m pip install src/backend/base/dist/*.whl
python -m langflow run --host 127.0.0.1 --port 7860 &
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 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 }}
run: make publish base=true
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: dist-base
path: src/backend/base/dist
release-main:
name: Release Langflow Main
if: inputs.release_package == true
needs: [release-base]
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
- name: Set up Nodejs 20
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Check Version
id: check-version
run: |
version=$(poetry version --short)
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
run: sleep 300 # wait for 5 minutes to ensure PyPI propagation
- name: Build project for distribution
run: make build main=true
- name: Test CLI
run: |
python -m pip install dist/*.whl
python -m langflow run --host 127.0.0.1 --port 7860 &
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 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 }}
run: make publish main=true
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: dist-main
path: dist
call_docker_build:
name: Call Docker Build Workflow
needs: [release-base, release-main]
uses: langflow-ai/langflow/.github/workflows/docker-build.yml@main
strategy:
matrix:
release_type:
- base
- main
with:
# version should be needs.release-base.outputs.version if release_type is base
# version should be needs.release-main.outputs.version if release_type is main
version: ${{ matrix.release_type == 'base' && needs.release-base.outputs.version || matrix.release_type == 'main' && needs.release-main.outputs.version }}
release_type: ${{ matrix.release_type }}
pre_release: ${{ inputs.pre_release }}
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: v${{ needs.release-main.outputs.version }}
commit: ${{ github.ref }}