9857cc3bda
A board file for the Elecrow CrowPanel 7.0" (DIS08070H, ESP32-S3-WROOM-1-N4R8): 800x480 through mipi_rgb, GT911 on the ESP32-S3's USB pins (elecrow_usb_phy.h frees them, behind a flag only this board sets), the Guition's vertical sizes across a wider page, no rotation. Its 4 MB of flash take the CYD's budget: a partition table of the component's (smart_display: partitions: 4mb_wide_slots, 1,984 KB slots), the icon fonts at 2 bits a pixel and the TLS client only bring the firmware to 1,865,440 bytes, 91.8 % of a slot, with camera images kept. docs/ELECROW.md has the numbers and the trade. The add-on reads a large board's name from the type sensor's value, the editor offers the board under New screen and draws the wide preview, tools/check.sh builds it with the budget, render_topbar and capture_ui take the panel's size. Firmware 0.2.79; the CYD image is unchanged (1,633,760 bytes). This fork builds from gittea.trippedonmy.name/Xandrossian/homeassistant_espscreen: the packages, the fonts, the component and the add-on repository point there instead of GitHub.
73 lines
3.6 KiB
Python
73 lines
3.6 KiB
Python
"""Release lint (app 0.2.78): the version numbers of a release agree, and the packages fetch only fonts that exist.
|
|
|
|
Every push to main is a release (docs/RELEASING.md), so these run with the rest of the suite in tools/check.sh and CI.
|
|
Standard library only.
|
|
"""
|
|
from pathlib import Path
|
|
import re
|
|
import sys
|
|
import unittest
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / 'tools'))
|
|
import profiles # noqa: E402
|
|
sys.path.insert(0, str(ROOT / 'screen_manager/app'))
|
|
from core import FIRMWARE_VERSION # noqa: E402
|
|
|
|
CHANGELOG = ROOT / 'screen_manager/CHANGELOG.md'
|
|
# An app release: "## 0.2.76 (firmware 0.2.63)"; the oldest ones name no firmware. The two "## Firmware 0.2.1x"
|
|
# sections are firmware-only releases between app 0.2.11 and 0.2.12 and carry no app version, so they don't count.
|
|
APP_HEADING = re.compile(r'^## (\d+)\.(\d+)\.(\d+)\b(.*)$', re.M)
|
|
FIRMWARE_IN_HEADING = re.compile(r'\(firmware (\d+\.\d+\.\d+)\)')
|
|
# The published entries (packages/<board>.yaml) point ${FONT_DIR} at the raw GitHub URL of fonts/ on main.
|
|
FONT_URL = re.compile(r'https://gittea\.trippedonmy\.name/Xandrossian/homeassistant_espscreen/raw/branch/[^/\s"\']+/(fonts/[^"\'\s]+)')
|
|
|
|
|
|
def app_headings():
|
|
"""[(version tuple, text after the version)] of the CHANGELOG, top to bottom."""
|
|
return [((int(a), int(b), int(c)), rest) for a, b, c, rest in APP_HEADING.findall(CHANGELOG.read_text())]
|
|
|
|
|
|
def dotted(version):
|
|
return '.'.join(map(str, version))
|
|
|
|
|
|
class ReleaseVersionTests(unittest.TestCase):
|
|
def test_config_version_is_the_newest_changelog_entry(self):
|
|
match = re.search(r'^version:\s*["\']?([^"\'\s]+)["\']?\s*$', (ROOT / 'screen_manager/config.yaml').read_text(), re.M)
|
|
self.assertIsNotNone(match, 'screen_manager/config.yaml has no version line')
|
|
headings = app_headings()
|
|
self.assertTrue(headings, 'screen_manager/CHANGELOG.md has no "## x.y.z" heading')
|
|
self.assertEqual(match.group(1), dotted(headings[0][0]),
|
|
'Home Assistant offers the update by config.yaml: bump it together with a new CHANGELOG entry')
|
|
|
|
def test_newest_entry_names_the_shipped_firmware(self):
|
|
version, rest = app_headings()[0]
|
|
firmware = FIRMWARE_IN_HEADING.search(rest)
|
|
if firmware:
|
|
self.assertEqual(firmware.group(1), FIRMWARE_VERSION,
|
|
f'CHANGELOG {dotted(version)} names firmware {firmware.group(1)}, core.FIRMWARE_VERSION is {FIRMWARE_VERSION}')
|
|
|
|
def test_changelog_versions_are_unique_and_newest_first(self):
|
|
versions = [version for version, _ in app_headings()]
|
|
duplicates = sorted({dotted(v) for v in versions if versions.count(v) > 1})
|
|
self.assertEqual(duplicates, [], 'a CHANGELOG version appears twice')
|
|
for newer, older in zip(versions, versions[1:]):
|
|
self.assertGreater(newer, older, f'CHANGELOG {dotted(newer)} stands above {dotted(older)}')
|
|
|
|
|
|
class PackageFontTests(unittest.TestCase):
|
|
def test_every_font_a_package_fetches_is_in_the_tree(self):
|
|
seen = 0
|
|
for package in profiles.PACKAGES:
|
|
# The shared core names its fonts as ${FONT_DIR}/...; the published entry says where that is (app 0.2.84+).
|
|
for path in FONT_URL.findall(profiles.merged(package)):
|
|
seen += 1
|
|
self.assertTrue((ROOT / path).is_file(), f'{package} fetches {path}, which is not in the tree')
|
|
# A changed URL form must not turn this into a test of nothing.
|
|
self.assertGreater(seen, 0, 'no fonts/... URL found in packages/*.yaml')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|