Skip to content

Commit

Permalink
Add lockfile creation to new releases
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Chin <[email protected]>
  • Loading branch information
akchinSTC committed Jan 11, 2023
1 parent 099095c commit e856629
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.PHONY: lint-dependencies lint-server black-format prettier-check-ui eslint-check-ui prettier-ui eslint-ui lint-ui lint
.PHONY: dev-link dev-unlink
.PHONY: build-dependencies dev-dependencies yarn-install build-ui package-ui package-ui-dev
.PHONY: build-server install-server-package install-server
.PHONY: build-server buiid-lockfile install-server-package install-server
.PHONY: install install-all install-dev install-examples install-gitlab-dependency check-install watch release
.PHONY: test-dependencies pytest test-server test-ui-unit test-integration test-integration-debug test-ui test
.PHONY: docs-dependencies docs
Expand Down Expand Up @@ -61,7 +61,7 @@ help:
## Clean targets

purge:
rm -rf build *.egg-info yarn-error.log
rm -rf build *.egg-info requirements.txt yarn-error.log
rm -rf node_modules lib dist
rm -rf $$(find packages -name node_modules -type d -maxdepth 2)
rm -rf $$(find packages -name dist -type d)
Expand Down Expand Up @@ -173,6 +173,9 @@ package-ui-dev: dev-dependencies yarn-install dev-link lint-ui build-ui
build-server: # Build backend
$(PYTHON) -m build

build-lockfile: # Build requirements.txt
pip-compile --generate-hashes pyproject.toml

uninstall-server-package:
@$(PYTHON_PIP) uninstall elyra -y

Expand Down Expand Up @@ -206,7 +209,6 @@ watch: ## Watch packages. For use alongside jupyter lab --watch

release: yarn-install build-ui build-server ## Build wheel file for release


elyra-image-env: ## Creates a conda env consisting of the dependencies used in images
conda env remove -y -n $(ELYRA_IMAGE_ENV)
conda create -y -n $(ELYRA_IMAGE_ENV) python=$(PYTHON_VERSION) --channel conda-forge
Expand Down
2 changes: 1 addition & 1 deletion build_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
jupyterlab>=3.4.6,<4.0
jupyter-packaging>=0.10
build
pip-tools
27 changes: 23 additions & 4 deletions create-release.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def validate_dependencies() -> None:
raise DependencyException("Please install yarn https://classic.yarnpkg.com/")
if not dependency_exists("twine"):
raise DependencyException("Please install twine https://twine.readthedocs.io/en/latest/#installation")
if not dependency_exists("pip-compile"):
raise DependencyException("Please install pip-tools https://pypi.org/project/pip-tools/")


def validate_environment() -> None:
Expand All @@ -102,6 +104,8 @@ def validate_environment() -> None:
def update_version_to_release() -> None:
global config

print(f"Updating documentation to Release v{config.new_version}")

old_version = config.old_version
old_npm_version = config.old_npm_version
new_version = config.new_version
Expand Down Expand Up @@ -258,6 +262,8 @@ def update_version_to_release() -> None:
)
check_run(["yarn", "version", "--new-version", new_npm_version, "--no-git-tag-version"], cwd=config.source_dir)

print(f"Finished updating documentation to Release v{config.new_version}")

except Exception as ex:
raise UpdateVersionException from ex

Expand Down Expand Up @@ -500,6 +506,14 @@ def build_server():
print("")


def create_requirements_lockfile():
print("-----------------------------------------------------------------")
print("--------------------- Creating Lockfile -------------------------")
print("-----------------------------------------------------------------")
check_run(["pip-compile", "--generate-hashes", "pyproject.toml"], cwd=config.source_dir, capture_output=False)
check_run(["git", "add", "requirements.txt"], cwd=config.source_dir, capture_output=False)


def show_release_artifacts():
global config
dist_dir = os.path.join(config.source_dir, "dist")
Expand Down Expand Up @@ -734,7 +748,7 @@ def prepare_changelog() -> None:
generate_changelog()
# commit
check_run(
["git", "commit", "-a", "-m", f"Update changelog for release {config.new_version}"], cwd=config.source_dir
["git", "commit", "-a", "-s", "-m", f"Update changelog for release {config.new_version}"], cwd=config.source_dir
)


Expand All @@ -750,11 +764,16 @@ def prepare_release() -> None:
checkout_code()
# generate changelog with new release list of commits
prepare_changelog()
# create requirements lock file
create_requirements_lockfile()
# Update to new release version
update_version_to_release()
# commit and tag
check_run(["git", "commit", "-a", "-m", f"Release v{config.new_version}"], cwd=config.source_dir)
check_run(["git", "tag", config.tag], cwd=config.source_dir)
print(f"Committing changes for release v{config.new_version}")
check_run(["git", "commit", "-a", "-s", "-m", f"Release v{config.new_version}"], cwd=config.source_dir)
# Ensure you have tags.gpgSign set to True and user.signingkey configured via git config
print(f"Creating tag for release v{config.new_version}")
check_run(["git", "tag", config.tag, "-m", f"Release v{config.new_version}"], cwd=config.source_dir)
# server-only wheel
build_server()
# build release wheel and npm artifacts
Expand All @@ -764,7 +783,7 @@ def prepare_release() -> None:
# back to development
update_version_to_dev()
# commit
check_run(["git", "commit", "-a", "-m", f"Prepare for next development iteration"], cwd=config.source_dir)
check_run(["git", "commit", "-a", "-s", "-m", f"Prepare for next development iteration"], cwd=config.source_dir)
# prepare extensions
prepare_extensions_release()
# prepare runtime extsnsions
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ maintainers = [
readme = "README.md"
requires-python = ">=3.7"
dependencies = [
"autopep8>=1.5.0",
"autopep8>=1.5.0,<1.7.0", # Cap from python-lsp-server
"click>=8", # elyra-ai/elyra#2579
"colorama",
"deprecation",
Expand Down

0 comments on commit e856629

Please sign in to comment.