fix: чинит разбор workflow — описание релиза вынесено в скрипт
build / build (push) Successful in 24s
build / build (push) Successful in 24s
Многострочный python3 -c внутри блока run начинался с нулевого отступа
и обрывал YAML-скаляр: Gitea отказывалась читать файл целиком
("line 137: could not find expected ':'").
Генерация markdown уехала в tools/release_notes.py — в CI остался один
вызов без экранирования, а сам рендер покрыт тестами.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
61c0ea3558
commit
60c7141f88
@@ -11,6 +11,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import build
|
||||
import release_notes
|
||||
import sync
|
||||
from build import BuildError, Net, Options, Rule
|
||||
|
||||
@@ -336,6 +337,34 @@ class SyncTest(unittest.TestCase):
|
||||
self.assertTrue(sync.is_generated(Path(tmp) / "new.txt"))
|
||||
|
||||
|
||||
class ReleaseNotesTest(unittest.TestCase):
|
||||
META = {
|
||||
"geosite_dat_sha256": "aa",
|
||||
"geoip_dat_sha256": "bb",
|
||||
"categories": {"discord": 34},
|
||||
"ip_categories": {
|
||||
"discord": {"count": 140},
|
||||
"discord-voice": {"count": 13, "network": ["udp"], "ports": "50000-50099"},
|
||||
},
|
||||
}
|
||||
|
||||
def test_renders_both_tables(self):
|
||||
notes = release_notes.render(self.META, "abc1234")
|
||||
self.assertIn("Собрано из `abc1234`.", notes)
|
||||
self.assertIn("| discord | 34 |", notes)
|
||||
self.assertIn("| discord | 140 | — |", notes)
|
||||
self.assertIn("| discord-voice | 13 | udp 50000-50099 |", notes)
|
||||
self.assertIn("sha256(discord-geoip.dat) = `bb`", notes)
|
||||
|
||||
def test_reads_real_metadata(self):
|
||||
with tempfile.TemporaryDirectory() as out:
|
||||
out_dir = Path(out) / "dist"
|
||||
with data(a="a.com\n", ip={"n": "1.2.3.0/24\n"}):
|
||||
build.build(out_dir, None, None, "proxy")
|
||||
meta = json.loads((out_dir / "metadata.json").read_text(encoding="utf-8"))
|
||||
self.assertIn("| n | 1 | — |", release_notes.render(meta, "abc1234"))
|
||||
|
||||
|
||||
class CheckTest(unittest.TestCase):
|
||||
def test_clean_sources_pass(self):
|
||||
with data(a="a.com\nb.com\n", ip={"a": "1.2.3.0/24\n"}):
|
||||
|
||||
Reference in New Issue
Block a user