diff --git a/.github/workflows/RELEASE.yml b/.github/workflows/RELEASE.yml index 41d067b..08f64ab 100644 --- a/.github/workflows/RELEASE.yml +++ b/.github/workflows/RELEASE.yml @@ -48,7 +48,15 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install poetry python-semantic-release + # GitPython 3.1.60 removed `Actor.name_email_regex`, which + # python-semantic-release reads unconditionally while loading its + # configuration. python-semantic-release only asks for + # `gitpython~=3.0`, so an unpinned install picks the broken one and + # every release aborts before it does anything: + # ::ERROR:: type object 'Actor' has no attribute 'name_email_regex' + # Cap GitPython below that release rather than pinning + # python-semantic-release, so this picks up the upstream fix. + pip install poetry python-semantic-release "gitpython<3.1.60" - name: Semantic Release id: semantic-release @@ -97,7 +105,7 @@ jobs: # 3. Update UI sidebar version (full semver) SIDEBAR="flowyml/ui/frontend/src/components/sidebar/Sidebar.jsx" if [ -f "$SIDEBAR" ]; then - sed -i "s/FlowyML v[0-9]*\.[0-9]*\.[0-9]*/FlowyML v${VERSION}/" "$SIDEBAR" + sed -i "s/^const VERSION = \"[0-9]*\.[0-9]*\.[0-9]*\";/const VERSION = \"${VERSION}\";/" "$SIDEBAR" echo "✓ Updated UI sidebar → FlowyML v${VERSION}" fi diff --git a/flowyml/ui/frontend/src/components/sidebar/Sidebar.jsx b/flowyml/ui/frontend/src/components/sidebar/Sidebar.jsx index 6266cd4..6cbfa76 100644 --- a/flowyml/ui/frontend/src/components/sidebar/Sidebar.jsx +++ b/flowyml/ui/frontend/src/components/sidebar/Sidebar.jsx @@ -21,6 +21,12 @@ import { } from 'lucide-react'; import { motion, AnimatePresence } from 'framer-motion'; +// Bumped by semantic-release via [tool.semantic_release].version_variables, +// which rewrites assignments only. The entry used to point at the version +// printed inline in the JSX below, which it cannot match, so every release +// silently left the sidebar showing the previous version. +const VERSION = "2.2.0"; + const NAV_GROUPS = [ { title: 'Workspace', @@ -171,7 +177,7 @@ export function Sidebar({ collapsed, setCollapsed, isMobile = false, mobileOpen <>
FlowyML v2.2.0
+FlowyML v{VERSION}
Made with ❤️ by UnicoLab
diff --git a/pyproject.toml b/pyproject.toml
index b1040b8..8b8412e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -203,7 +203,7 @@ markers = [
version_toml = ["pyproject.toml:tool.poetry.version"]
version_variables = [
"flowyml/__init__.py:__version__",
- "flowyml/ui/frontend/src/components/sidebar/Sidebar.jsx:FlowyML v",
+ "flowyml/ui/frontend/src/components/sidebar/Sidebar.jsx:VERSION",
]
branch = "main"
upload_to_pypi = false
diff --git a/tests/test_ci_workflow_config.py b/tests/test_ci_workflow_config.py
index 1b7adc9..dc7a2b1 100644
--- a/tests/test_ci_workflow_config.py
+++ b/tests/test_ci_workflow_config.py
@@ -83,3 +83,32 @@ def test_titles_the_project_already_uses_are_accepted(title):
def test_malformed_titles_are_still_rejected(title):
"""The check has to keep checking something."""
assert not re.match(_pr_title_pattern(), title), f"{title!r} should not pass the PR-title check"
+
+
+RELEASE_WORKFLOW = REPO_ROOT / ".github" / "workflows" / "RELEASE.yml"
+
+
+@pytest.mark.skipif(not RELEASE_WORKFLOW.exists(), reason="release workflow not present")
+def test_the_release_workflow_constrains_gitpython():
+ """An unpinned install of the release tooling breaks the release.
+
+ GitPython 3.1.60 removed ``Actor.name_email_regex``, which
+ python-semantic-release reads while loading its configuration.
+ python-semantic-release asks only for ``gitpython~=3.0``, so pip resolves
+ the broken pair and ``semantic-release version`` aborts on the first step
+ of the release with::
+
+ ::ERROR:: type object 'Actor' has no attribute 'name_email_regex'
+
+ Nothing else in the pipeline runs, so the release produces no tag, no
+ PyPI upload and no docs deploy.
+ """
+ workflow = yaml.safe_load(RELEASE_WORKFLOW.read_text(encoding="utf-8"))
+ steps = workflow["jobs"]["SEMANTIC_RELEASE"]["steps"]
+ install = next(s for s in steps if s.get("name") == "Install dependencies")["run"]
+
+ assert "python-semantic-release" in install
+ assert "gitpython" in install.lower(), (
+ "The release workflow installs python-semantic-release without "
+ "constraining GitPython; pip will resolve a version that breaks it."
+ )
diff --git a/tests/test_version_consistency.py b/tests/test_version_consistency.py
index 17e0f0b..20175e1 100644
--- a/tests/test_version_consistency.py
+++ b/tests/test_version_consistency.py
@@ -85,15 +85,57 @@ def test_server_info_reports_the_package_version(self, client):
assert client.get("/api/execution/info").json()["version"] == flowyml.__version__
+SIDEBAR = REPO_ROOT / "flowyml" / "ui" / "frontend" / "src" / "components" / "sidebar" / "Sidebar.jsx"
+
+
def test_the_frontend_sidebar_shows_the_current_version(declared_version):
- """The sidebar literal is updated by semantic-release; verify it kept up."""
- sidebar = REPO_ROOT / "flowyml" / "ui" / "frontend" / "src" / "components" / "sidebar"
- sidebar_file = sidebar / "Sidebar.jsx"
- if not sidebar_file.exists():
+ """The sidebar constant is bumped by semantic-release; verify it kept up."""
+ if not SIDEBAR.exists():
pytest.skip("frontend sources not present")
- text = sidebar_file.read_text(encoding="utf-8")
- versions = re.findall(r"FlowyML v(\d+\.\d+\.\d+)", text)
+ versions = re.findall(r'^const VERSION = "(\d+\.\d+\.\d+)";', SIDEBAR.read_text(encoding="utf-8"), re.M)
- assert versions, "no 'FlowyML v