Skip to content

Commit 39cf86b

Browse files
committed
feat: add release-demo nox session
1 parent e3e4bd3 commit 39cf86b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

noxfile.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
MERGE_DEMO_FEATURE_SCRIPT: Path = SCRIPTS_FOLDER / "merge-demo-feature.py"
7171
MERGE_DEMO_FEATURE_OPTIONS: tuple[str, ...] = GENERATE_DEMO_OPTIONS
7272

73+
RELEASE_DEMO_SCRIPT: Path = SCRIPTS_FOLDER / "release-demo.py"
74+
RELEASE_DEMO_OPTIONS: tuple[str, ...] = GENERATE_DEMO_OPTIONS
75+
7376
BUMP_VERSION_SCRIPT: Path = SCRIPTS_FOLDER / "bump-version.py"
7477
GET_RELEASE_NOTES_SCRIPT: Path = SCRIPTS_FOLDER / "get-release-notes.py"
7578
SETUP_RELEASE_SCRIPT: Path = SCRIPTS_FOLDER / "setup-release.py"
@@ -228,6 +231,24 @@ def merge_demo_feature(session: Session, demo: RepoMetadata) -> None:
228231
session.install_and_run_script(MERGE_DEMO_FEATURE_SCRIPT, *args, env=demo_env)
229232

230233

234+
@nox.parametrize(
235+
arg_names="demo",
236+
arg_values_list=[PYTHON_DEMO, MATURIN_DEMO],
237+
ids=["robust-python-demo", "robust-maturin-demo"]
238+
)
239+
@nox.session(python=DEFAULT_TEMPLATE_PYTHON_VERSION, name="release-demo")
240+
def release_demo(session: Session, demo: RepoMetadata) -> None:
241+
"""Automates the release process for demo projects."""
242+
args: list[str] = [*RELEASE_DEMO_OPTIONS]
243+
if session.posargs:
244+
args = [*session.posargs, *args]
245+
if "maturin" in demo.app_name:
246+
args.append("--add-rust-extension")
247+
248+
demo_env: dict[str, Any] = {f"ROBUST_DEMO__{key.upper()}": value for key, value in asdict(demo).items()}
249+
session.install_and_run_script(RELEASE_DEMO_SCRIPT, *args, env=demo_env)
250+
251+
231252
@nox.session(python=DEFAULT_TEMPLATE_PYTHON_VERSION, name="setup-release")
232253
def setup_release(session: Session) -> None:
233254
"""Prepare a release by creating a release branch and bumping the version.

0 commit comments

Comments
 (0)