From 1c9844452226b803461f5219f7059712e0d9029d Mon Sep 17 00:00:00 2001 From: Amp Date: Wed, 26 Aug 2026 23:05:54 +0000 Subject: [PATCH] fix(action): restore Core runtime compatibility Amp-Thread-ID: https://ampcode.com/threads/T-01a04035-16e0-717f-8cce-97041e26e175 Co-authored-by: Ivan Milev --- .github/workflows/test.yml | 28 ++++++++++++++++++++++++++++ action.yml | 7 +++++++ scripts/diff_to_mermaid.py | 2 +- tests/test_action_sync.py | 6 +++--- tests/test_diff_to_mermaid.py | 6 +++--- 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8526da..7c8219e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,34 @@ jobs: - name: Run unit tests (stdlib only) run: python -m unittest discover -s tests -v + core-compatibility: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install pinned CodeBoarding release + shell: bash + run: | + set -euo pipefail + requirement="$(sed -n "s/.*'\(codeboarding==[^']*\)'.*/\1/p" action.yml)" + if [ -z "$requirement" ]; then + echo "Could not resolve the CodeBoarding requirement from action.yml" >&2 + exit 1 + fi + python -m pip install --disable-pip-version-check "$requirement" + - name: Render with the installed CodeBoarding release + run: >- + python scripts/diff_to_mermaid.py + --base .codeboarding/analysis.json + --head .codeboarding/analysis.json + --out "${RUNNER_TEMP}/diagram.md" + --direction LR + --render-depth 1 + lint: runs-on: ubuntu-latest steps: diff --git a/action.yml b/action.yml index 3afe86c..220246e 100644 --- a/action.yml +++ b/action.yml @@ -162,6 +162,13 @@ runs: with: python-version: '3.12' + - name: Setup Java for CodeBoarding + if: steps.guard.outputs.skip != 'true' + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: '21' + - name: Install CodeBoarding if: steps.guard.outputs.skip != 'true' shell: bash diff --git a/scripts/diff_to_mermaid.py b/scripts/diff_to_mermaid.py index e5bf48d..835cbcf 100644 --- a/scripts/diff_to_mermaid.py +++ b/scripts/diff_to_mermaid.py @@ -87,8 +87,8 @@ def read_analysis_json(path: Path) -> dict: def load_analysis(path: Path) -> dict: data = read_analysis_json(path) try: - from codeboarding_workflows.rendering import project_relations_to_level from diagram_analysis.analysis_json import build_id_to_name_map, parse_unified_analysis + from output_generators.rendering import project_relations_to_level except ImportError as exc: sys.exit(f"::error::Could not load the installed CodeBoarding analysis reader: {exc}") diff --git a/tests/test_action_sync.py b/tests/test_action_sync.py index b88e39f..b0b87aa 100644 --- a/tests/test_action_sync.py +++ b/tests/test_action_sync.py @@ -292,9 +292,9 @@ def test_empty_review_is_successful(self) -> None: with tempfile.TemporaryDirectory() as tmp: root = Path(tmp) fake_core = root / "core" - (fake_core / "codeboarding_workflows").mkdir(parents=True) - (fake_core / "diagram_analysis").mkdir() - (fake_core / "codeboarding_workflows" / "rendering.py").write_text( + (fake_core / "diagram_analysis").mkdir(parents=True) + (fake_core / "output_generators").mkdir(parents=True) + (fake_core / "output_generators" / "rendering.py").write_text( "def project_relations_to_level(*args): return []\n", encoding="utf-8" ) (fake_core / "diagram_analysis" / "analysis_json.py").write_text( diff --git a/tests/test_diff_to_mermaid.py b/tests/test_diff_to_mermaid.py index 2565c8e..beec89d 100644 --- a/tests/test_diff_to_mermaid.py +++ b/tests/test_diff_to_mermaid.py @@ -76,16 +76,16 @@ def project_relations_to_level(relations, level_ids, id_to_name): ) return projected - rendering = ModuleType("codeboarding_workflows.rendering") + rendering = ModuleType("output_generators.rendering") rendering.project_relations_to_level = project_relations_to_level analysis_json = ModuleType("diagram_analysis.analysis_json") analysis_json.parse_unified_analysis = parse_unified_analysis analysis_json.build_id_to_name_map = build_id_to_name_map modules = { - "codeboarding_workflows": ModuleType("codeboarding_workflows"), - "codeboarding_workflows.rendering": rendering, "diagram_analysis": ModuleType("diagram_analysis"), "diagram_analysis.analysis_json": analysis_json, + "output_generators": ModuleType("output_generators"), + "output_generators.rendering": rendering, } analysis = { "components": [