From b20f3c0f3104aea0c5a25bb2a3a27fe708b91a81 Mon Sep 17 00:00:00 2001 From: truetype Date: Tue, 7 Jul 2026 17:15:54 +0000 Subject: [PATCH] ci(actions): add Gitea Actions ci+release workflows + fix ruff findings - .gitea/workflows/ci.yml: ruff + matrix pytest on 3.10/3.11/3.12 on push and PR to main; concurrency cancels superseded runs - .gitea/workflows/release.yml: gate (ruff + pytest) + build sdist/wheel on tag 'v*', uploads via actions/upload-artifact@v4 - README.md: add ci and version badges right under H1 - src/viandante/cli.py: drop unused prompt_toolkit.patch_stdout import - tests/test_deadsouls.py: add missing RoomBlock import (F821) - tests/test_logger.py: drop unused local 'raw' in unicode test - tests/test_mapper.py: rename unused locals to _a/_b/_c (F841) to preserve intent (B has 's' back-edge; C is orphan) --- .gitea/workflows/ci.yml | 58 +++++++++++++++++++++++++++++ .gitea/workflows/release.yml | 71 ++++++++++++++++++++++++++++++++++++ README.md | 3 ++ src/viandante/cli.py | 1 - tests/test_deadsouls.py | 1 + tests/test_logger.py | 1 - tests/test_mapper.py | 6 +-- 7 files changed, 136 insertions(+), 5 deletions(-) create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..eb39581 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,58 @@ +name: ci + +"on": + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + ruff: + name: lint (ruff) + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python 3.12 (for ruff) + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dev extras (pulls ruff from pyproject) + run: | + python -m pip install -U pip + python -m pip install -e ".[dev]" + + - name: Run ruff + run: python -m ruff check src tests + + pytest: + name: pytest (py${{ matrix.python-version }}) + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install dev extras + run: | + python -m pip install -U pip + python -m pip install -e ".[dev]" + + - name: Run pytest + run: python -m pytest -q diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..f609c79 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,71 @@ +name: release + +"on": + push: + tags: + - "v*" + +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: false + +jobs: + gate: + name: gate (ruff + pytest) + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install dev extras + run: | + python -m pip install -U pip + python -m pip install -e ".[dev]" + + - name: Ruff + run: python -m ruff check src tests + + - name: Pytest + run: python -m pytest -q + + build: + name: build (sdist + wheel) + needs: gate + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install build + dev extras + run: | + python -m pip install -U pip + python -m pip install build + python -m pip install -e ".[dev]" + + - name: Build sdist and wheel + run: python -m build + + - name: Inspect artifacts + run: ls -la dist/ + + - name: Upload distributions as artifact + uses: actions/upload-artifact@v4 + with: + name: viandante-dist + path: dist/* + if-no-files-found: error + retention-days: 90 diff --git a/README.md b/README.md index 257205f..c1ab27f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # viandante +[![ci](http://192.168.0.183:8085/truetype/viandante/badges/ci/main.svg)](http://192.168.0.183:8085/truetype/viandante/actions?workflow=ci) +[![version](https://img.shields.io/badge/version-v0.2.0-blue)](http://192.168.0.183:8085/truetype/viandante/releases/tag/v0.2.0) + `viandante` ospita un **client MUD CLI** pensato per collegarsi a un MUD LP‑MUD basato sul driver **FluffOS** (per esempio **Dead Souls**, libreria 3.8.6). Il client parla telnet con estensioni standard: `ECHO`, `NAWS`, diff --git a/src/viandante/cli.py b/src/viandante/cli.py index 5eb029d..90353c8 100644 --- a/src/viandante/cli.py +++ b/src/viandante/cli.py @@ -24,7 +24,6 @@ from dataclasses import dataclass, field from prompt_toolkit import PromptSession, print_formatted_text from prompt_toolkit.formatted_text import ANSI, FormattedText -from prompt_toolkit.patch_stdout import patch_stdout from prompt_toolkit.shortcuts import clear from prompt_toolkit.styles import Style diff --git a/tests/test_deadsouls.py b/tests/test_deadsouls.py index 61595fd..54eeb2d 100644 --- a/tests/test_deadsouls.py +++ b/tests/test_deadsouls.py @@ -4,6 +4,7 @@ from __future__ import annotations from viandante.deadsouls import ( EXIT_ALIASES, RollingRoomParser, + RoomBlock, parse_exits, parse_room_block, ) diff --git a/tests/test_logger.py b/tests/test_logger.py index 46e7c65..f32d2a9 100644 --- a/tests/test_logger.py +++ b/tests/test_logger.py @@ -262,7 +262,6 @@ def test_json_sink_preserves_unicode(tmp_path: Path) -> None: log = EventLogger(json_path=str(out)) log.text("ilà ★") log.close() - raw = out.read_text(encoding="utf-8") events = _read_jsonl(out) assert events[0]["data"]["raw"] == "ilà ★" diff --git a/tests/test_mapper.py b/tests/test_mapper.py index b4c99b1..f60df42 100644 --- a/tests/test_mapper.py +++ b/tests/test_mapper.py @@ -55,8 +55,8 @@ def test_backtracking_visits_are_connected() -> None: B's exits include the back-edge to A. """ m = Mapper() - a = m.visit("A", "", ["n"]) - b = m.visit("B", "", ["s"]) + _a = m.visit("A", "", ["n"]) + _b = m.visit("B", "", ["s"]) # No link_rooms() — but B has 's' which would point to A. out = m.render(max_cols=20, max_rows=20) assert "A" in out @@ -93,7 +93,7 @@ def test_multi_source_render_does_not_split_obviously_connected_rooms() -> None: a = m.visit("A", "", ["n", "s"]) b = m.visit("B", "", ["s"]) m.link_rooms(a, "n", b) - c = m.visit("C", "", []) + _c = m.visit("C", "", []) # orphan: no exits out = m.render(max_cols=10, max_rows=10) assert "A" in out assert "B" in out