ci: create a nightly build workflow (#3553)
* test poetry install * Add nightly builds workflow * remove old comments and fix poetry * remove old debug statement * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
414bfe799e
commit
7b3e51f769
22 changed files with 1770 additions and 1055 deletions
62
scripts/ci/update_lf_base_dependency.py
Executable file
62
scripts/ci/update_lf_base_dependency.py
Executable file
|
|
@ -0,0 +1,62 @@
|
|||
import os
|
||||
import sys
|
||||
import re
|
||||
|
||||
import packaging.version
|
||||
|
||||
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
|
||||
|
||||
def update_base_dep(pyproject_path: str, new_version: str) -> None:
|
||||
"""Update the langflow-base dependency in pyproject.toml."""
|
||||
filepath = os.path.join(BASE_DIR, pyproject_path)
|
||||
with open(filepath, "r") as file:
|
||||
content = file.read()
|
||||
|
||||
# Regex to match the langflow-base dep line under [tool.poetry]
|
||||
# NOTE: this functions similarly to `update_dependencies.py`.
|
||||
# The order of operations for these scripts is more complex than it needs to be;
|
||||
# this is a reminder to revisit this process.
|
||||
# Currently, the process is as follows:
|
||||
# 1. nightly-build workflow updates all names, version, and the langflow-base
|
||||
# dependency in pyproject.toml, and commits the changes and creates a tag.
|
||||
# 2. release-nightly workflow runs, which calls update_dependencies.py to update
|
||||
# the langflow-base dependency in pyproject.toml _again_. This is redundant, but
|
||||
# necessary because the release workflow relies on that script to update the base
|
||||
# dependency.
|
||||
pattern = re.compile(r'langflow-base = \{ path = "\./src/backend/base", develop = true \}')
|
||||
|
||||
if not pattern.search(content):
|
||||
raise Exception(f'langflow-base dependency not found in "{filepath}"')
|
||||
|
||||
replacement = f'langflow-base-nightly = "^{new_version}"'
|
||||
content = pattern.sub(replacement, content)
|
||||
|
||||
with open(filepath, "w") as file:
|
||||
file.write(content)
|
||||
|
||||
|
||||
def verify_pep440(version):
|
||||
"""
|
||||
Verify if version is PEP440 compliant.
|
||||
|
||||
https://github.com/pypa/packaging/blob/16.7/packaging/version.py#L191
|
||||
"""
|
||||
|
||||
try:
|
||||
return packaging.version.Version(version)
|
||||
except packaging.version.InvalidVersion as e:
|
||||
raise e
|
||||
|
||||
|
||||
def main() -> None:
|
||||
if len(sys.argv) != 2:
|
||||
raise Exception("New version not specified")
|
||||
base_version = sys.argv[1]
|
||||
|
||||
verify_pep440(base_version)
|
||||
update_base_dep("pyproject.toml", base_version)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue