Compare commits

..
10 Commits
Author SHA1 Message Date
devx-ci-bot 40a94df029 release: v0.35.7 [skip ci] 2026-07-06 13:22:27 +00:00
emilandDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> f50c4c1e00 DEVX-118: fix: use Gitea wiki dash-marker filename convention
Post-merge / detect-type (push) Successful in 10s
Post-merge / validate-commit-msg (push) Successful in 11s
Post-merge / vikunja (push) Successful in 24s
Post-merge / configure-repo (push) Successful in 16s
Post-merge / sync-wiki (push) Successful in 35s
Post-merge / release (push) Successful in 44s
Post-merge / publish (push) Successful in 22s
Post-merge / badges (push) Failing after 30s
Gitea appends a ".-" suffix before ".md" for wiki page titles that
contain dashes, to distinguish literal dashes from space-to-dash
conversions. For example, "Getting-Started" becomes
"Getting-Started.-.md", while "Architecture" becomes "Architecture.md".

Previously the code wrote "Getting-Started.md" which Gitea couldn't
recognize as a valid wiki page, causing verification to fail with
"page not found" for 15 of 21 pages.

Also force-push to handle concurrent CI runs that may have pushed to
the wiki repo between our clone and push.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-06 15:21:22 +02:00
devx-ci-bot bbb264efc9 release: v0.35.6 [skip ci] 2026-07-06 13:00:59 +00:00
emilandDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> c97b249935 DEVX-118: fix: add delay before wiki verification to avoid race condition
Post-merge / detect-type (push) Successful in 10s
Post-merge / validate-commit-msg (push) Successful in 9s
Post-merge / configure-repo (push) Successful in 15s
Post-merge / vikunja (push) Successful in 20s
Post-merge / sync-wiki (push) Successful in 29s
Post-merge / release (push) Successful in 39s
Post-merge / publish (push) Successful in 25s
Post-merge / badges (push) Failing after 38s
Gitea needs a few seconds to process pushed wiki commits before a
re-clone will see them. Add a 5s sleep after a successful push before
verification re-clones the wiki.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-06 15:00:02 +02:00
devx-ci-bot 32b9a53151 release: v0.35.5 [skip ci] 2026-07-06 09:46:57 +00:00
emilandDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> ae68df63f1 DEVX-118: fix: embed token in wiki clone URL for push auth
Post-merge / detect-type (push) Successful in 9s
Post-merge / validate-commit-msg (push) Successful in 9s
Post-merge / vikunja (push) Successful in 19s
Post-merge / sync-wiki (push) Successful in 24s
Post-merge / configure-repo (push) Successful in 14s
Post-merge / release (push) Successful in 34s
Post-merge / publish (push) Successful in 19s
Post-merge / badges (push) Failing after 29s
The wiki Git push failed with "could not read Username" because the
clone URL didn't include credentials. Use token@host URL format so
both clone and push authenticate properly.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-06 11:46:05 +02:00
devx-ci-bot 6402f31345 release: v0.35.4 [skip ci] 2026-07-06 09:42:49 +00:00
emilandDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> f017fec8f5 DEVX-118: fix: configure git identity before commit in sync_wiki
Post-merge / detect-type (push) Successful in 16s
Post-merge / validate-commit-msg (push) Successful in 11s
Post-merge / configure-repo (push) Successful in 17s
Post-merge / vikunja (push) Successful in 21s
Post-merge / sync-wiki (push) Failing after 24s
Post-merge / release (push) Successful in 37s
Post-merge / publish (push) Successful in 21s
Post-merge / badges (push) Failing after 31s
CI environments may lack git user.email/user.name config, causing
git commit to fail with exit code 128. Set identity explicitly before
committing wiki changes.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-06 11:41:36 +02:00
devx-ci-bot add02273b6 release: v0.35.3 [skip ci] 2026-07-06 09:40:19 +00:00
emilandDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> e489fdb206 DEVX-118: fix: replace --strict with --verify for sync_wiki
Post-merge / detect-type (push) Successful in 12s
Post-merge / validate-commit-msg (push) Successful in 25s
Post-merge / vikunja (push) Successful in 33s
Post-merge / configure-repo (push) Successful in 28s
Post-merge / sync-wiki (push) Failing after 37s
Post-merge / release (push) Successful in 52s
Post-merge / publish (push) Successful in 29s
Post-merge / badges (push) Failing after 38s
The rewritten sync_wiki.py removed the --strict flag. The new git-based
approach is strict by default; --verify adds post-sync page verification.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-06 11:36:30 +02:00
8 changed files with 120 additions and 20 deletions
+1 -1
View File
@@ -190,7 +190,7 @@ jobs:
PYTHONPATH: src
run: |
. .venv/bin/activate 2>/dev/null || true
python3 -m devx.ci.sync_wiki --repo "${{ github.repository }}" --strict
python3 -m devx.ci.sync_wiki --repo "${{ github.repository }}" --verify
- name: Notify on failure
if: failure()
env:
+30
View File
@@ -2,6 +2,36 @@
All notable changes to this project will be documented in this file.
## [0.35.7] - 2026-07-06
### Bug Fixes
- Use Gitea wiki dash-marker filename convention
## [0.35.6] - 2026-07-06
### Bug Fixes
- Add delay before wiki verification to avoid race condition
## [0.35.5] - 2026-07-06
### Bug Fixes
- Embed token in wiki clone URL for push auth
## [0.35.4] - 2026-07-06
### Bug Fixes
- Configure git identity before commit in sync_wiki
## [0.35.3] - 2026-07-06
### Bug Fixes
- Replace --strict with --verify for sync_wiki
## [0.35.2] - 2026-07-06
### Bug Fixes
+3 -3
View File
@@ -87,7 +87,7 @@ extra index and list devx in your dependencies:
```toml
[project]
dependencies = [
"devx>=0.35.2",
"devx>=0.35.7",
]
[tool.pip]
@@ -101,8 +101,8 @@ pip install -e .
```
> **Note:** If your project requires a specific devx version, pin it in
> `dependencies` (for example, `"devx==0.35.2"`) or use a version constraint
> (for example, `"devx>=0.35.2,<0.36"`).
> `dependencies` (for example, `"devx==0.35.7"`) or use a version constraint
> (for example, `"devx>=0.35.7,<0.36"`).
### Optional extras
+2 -2
View File
@@ -74,14 +74,14 @@ Add devx to your `pyproject.toml` dependencies and configure the registry:
```toml
[project]
dependencies = [
"devx>=0.35.2",
"devx>=0.35.7",
]
[tool.pip]
extra-index-url = "https://git.oblachno.oblachno.fyi/api/packages/oblachno-oss/pypi/simple"
```
Pin a specific version if needed: `"devx==0.35.2"` or `"devx>=0.35.2,<0.36"`.
Pin a specific version if needed: `"devx==0.35.7"` or `"devx>=0.35.7,<0.36"`.
### Optional extras
+2 -2
View File
@@ -48,12 +48,12 @@ Add devx to your `pyproject.toml`:
```toml
[project]
dependencies = [
"devx>=0.35.2",
"devx>=0.35.7",
]
[project.optional-dependencies]
dev = [
"devx>=0.35.2",
"devx>=0.35.7",
]
```
+1 -1
View File
@@ -1,3 +1,3 @@
"""devx — reusable development and CI/CD tools for oblachno-oss projects."""
__version__ = "0.35.2"
__version__ = "0.35.7"
+47 -11
View File
@@ -31,7 +31,9 @@ import os
import re
import subprocess # nosec B404
import tempfile
import time
from pathlib import Path
from urllib.parse import quote, urlparse
import click
from dotenv import load_dotenv # pyright: ignore[reportMissingImports,reportUnknownVariableType]
@@ -48,6 +50,23 @@ MAPPING_FILE = DOCS_DIR / "mapping.json"
_LINK_RE = re.compile(r"\[([^\]]*)\]\(([^)]+)\)")
def wiki_filename(page_title: str) -> str:
"""Convert a wiki page title to its Gitea wiki filename.
Gitea uses a "dash marker" (``.-``) suffix to distinguish literal dashes
from space-to-dash conversions. See Gitea's ``services/wiki/wiki_path.go``.
- "Architecture" (no dashes) → ``Architecture.md``
- "Getting-Started" (has dashes) → ``Getting-Started.-.md``
- "Home" (no dashes) → ``Home.md``
"""
name = page_title.replace(" ", "-")
if "-" in name:
name += ".-"
name += ".md"
return quote(name, safe="")
def load_mapping() -> dict[str, str]:
"""Load the file-to-wiki-page mapping from mapping.json."""
with open(MAPPING_FILE, encoding="utf-8") as f:
@@ -102,7 +121,10 @@ def get_wiki_clone_url(owner: str, repo: str, token: str) -> str:
# Gitea wiki repos are at {clone_url}.wiki.git
# Extract base URL from API URL
base = GITEA_API_URL.rsplit("/api/v1", 1)[0]
return f"{base}/{owner}/{repo}.wiki.git"
# Embed token in URL for both clone and push auth
# Format: https://token@host/owner/repo.wiki.git
parsed = urlparse(base)
return f"{parsed.scheme}://{token}@{parsed.hostname}/{owner}/{repo}.wiki.git"
def clone_wiki(wiki_url: str, dest: Path) -> bool:
@@ -166,16 +188,15 @@ def sync_files(
# Transform links
transformed = transform_links(content)
# Wiki filename: use the page title with spaces → underscores
# Gitea wiki uses the page title as filename (spaces become dashes)
wiki_filename = page_title.replace(" ", "-") + ".md"
expected_files.add(wiki_filename)
# Wiki filename: Gitea uses a dash-marker convention for titles with dashes
fname = wiki_filename(page_title)
expected_files.add(fname)
if not dry_run:
dest = wiki_dir / wiki_filename
dest = wiki_dir / fname
dest.write_text(transformed, encoding="utf-8")
synced += 1
click.echo(_(" Synced: {title}{file}", title=page_title, file=wiki_filename))
click.echo(_(" Synced: {title}{file}", title=page_title, file=fname))
# Prune stale pages (in wiki but not in mapping)
pruned = 0
@@ -208,7 +229,19 @@ def commit_and_push(wiki_dir: Path, wiki_url: str, dry_run: bool) -> bool:
click.echo(_("No changes to sync — wiki is up to date."))
return False
# Commit
# Commit — ensure git identity is configured (CI environments may lack it)
subprocess.run( # nosec
["git", "config", "user.email", "devin-ai-integration[bot]@users.noreply.github.com"],
cwd=wiki_dir,
capture_output=True,
check=True,
)
subprocess.run( # nosec
["git", "config", "user.name", "Devin CI"],
cwd=wiki_dir,
capture_output=True,
check=True,
)
subprocess.run( # nosec
["git", "commit", "-m", "Sync wiki from docs/ [skip ci]"],
cwd=wiki_dir,
@@ -218,7 +251,7 @@ def commit_and_push(wiki_dir: Path, wiki_url: str, dry_run: bool) -> bool:
# Push
result = subprocess.run( # nosec
["git", "push", wiki_url, "HEAD:master"],
["git", "push", "--force", wiki_url, "HEAD:master"],
cwd=wiki_dir,
capture_output=True,
text=True,
@@ -293,6 +326,9 @@ def main(dry_run: bool, repo: str | None, verify: bool) -> None:
# Verification
if verify and not dry_run:
if pushed:
click.echo(_("Waiting 5s for Gitea to process pushed commits..."))
time.sleep(5)
click.echo(_("\nVerifying wiki pages..."))
# Re-clone to verify
verify_dir = Path(tmpdir) / "verify"
@@ -301,8 +337,8 @@ def main(dry_run: bool, repo: str | None, verify: bool) -> None:
raise click.ClickException(_("Wiki verification failed — could not clone wiki"))
failures = 0
for _file_path, page_title in sorted(mapping.items()):
wiki_filename = page_title.replace(" ", "-") + ".md"
if (verify_dir / wiki_filename).exists():
fname = wiki_filename(page_title)
if (verify_dir / fname).exists():
click.echo(_(" OK: {title}", title=page_title))
else:
click.echo(_(" FAIL: {title} — page not found in wiki!", title=page_title))
+34
View File
@@ -19,6 +19,7 @@ from devx.ci.sync_wiki import (
main,
sync_files,
transform_links,
wiki_filename,
)
@@ -96,6 +97,29 @@ class TestGetWikiCloneUrl:
assert "owner/repo.wiki.git" in url
class TestWikiFilename:
def test_no_dashes(self) -> None:
assert wiki_filename("Home") == "Home.md"
def test_single_word(self) -> None:
assert wiki_filename("Architecture") == "Architecture.md"
def test_with_dashes_adds_marker(self) -> None:
assert wiki_filename("Getting-Started") == "Getting-Started.-.md"
def test_spaces_become_dashes_with_marker(self) -> None:
# "Getting Started" → "Getting-Started" (has dash) → marker added
assert wiki_filename("Getting Started") == "Getting-Started.-.md"
def test_spaces_no_dashes_no_marker(self) -> None:
# "Foo Bar" → "Foo-Bar" (has dash) → marker added
assert wiki_filename("Foo Bar") == "Foo-Bar.-.md"
def test_single_word_with_spaces_no_dash(self) -> None:
# No dash at all after conversion → no marker
assert wiki_filename("HelloWorld") == "HelloWorld.md"
class TestCloneWiki:
@patch("devx.ci.sync_wiki.subprocess.run")
def test_clone_success(self, mock_run: MagicMock, tmp_path: Path) -> None:
@@ -208,6 +232,8 @@ class TestCommitAndPush:
mock_run.side_effect = [
MagicMock(returncode=0), # git add
MagicMock(returncode=1), # git diff --cached --quiet (has changes)
MagicMock(returncode=0), # git config user.email
MagicMock(returncode=0), # git config user.name
MagicMock(returncode=0), # git commit
MagicMock(returncode=0, stdout="", stderr=""), # git push
]
@@ -219,6 +245,8 @@ class TestCommitAndPush:
mock_run.side_effect = [
MagicMock(returncode=0), # git add
MagicMock(returncode=1), # git diff --cached --quiet (has changes)
MagicMock(returncode=0), # git config user.email
MagicMock(returncode=0), # git config user.name
MagicMock(returncode=0), # git commit
MagicMock(returncode=1, stdout="", stderr="push failed"), # git push
]
@@ -319,6 +347,7 @@ class TestMain:
assert result.exit_code == 0
mock_init.assert_called_once()
@patch("devx.ci.sync_wiki.time.sleep")
@patch("devx.ci.sync_wiki.clone_wiki")
@patch("devx.ci.sync_wiki.commit_and_push", return_value=True)
@patch("devx.ci.sync_wiki.sync_files", return_value=(1, 0))
@@ -327,6 +356,7 @@ class TestMain:
mock_sync: MagicMock,
mock_push: MagicMock,
mock_clone: MagicMock,
mock_sleep: MagicMock,
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
@@ -376,6 +406,7 @@ class TestMain:
assert result.exit_code == 0
assert "No push needed" in result.output
@patch("devx.ci.sync_wiki.time.sleep")
@patch("devx.ci.sync_wiki.clone_wiki", side_effect=[True, False])
@patch("devx.ci.sync_wiki.commit_and_push", return_value=True)
@patch("devx.ci.sync_wiki.sync_files", return_value=(1, 0))
@@ -384,6 +415,7 @@ class TestMain:
mock_sync: MagicMock,
mock_push: MagicMock,
mock_clone: MagicMock,
mock_sleep: MagicMock,
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
@@ -400,6 +432,7 @@ class TestMain:
assert result.exit_code != 0
assert "could not clone" in result.output
@patch("devx.ci.sync_wiki.time.sleep")
@patch("devx.ci.sync_wiki.clone_wiki")
@patch("devx.ci.sync_wiki.commit_and_push", return_value=True)
@patch("devx.ci.sync_wiki.sync_files", return_value=(1, 0))
@@ -408,6 +441,7 @@ class TestMain:
mock_sync: MagicMock,
mock_push: MagicMock,
mock_clone: MagicMock,
mock_sleep: MagicMock,
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None: