Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain support for runners that cannot execute Node 24 actions

actions/setup-java@v5 moved its runtime to Node 24 and requires Actions Runner v2.327.1 or newer, so otherwise-valid self-hosted and GitHub Enterprise Server jobs on older runners now fail at this step before CodeBoarding starts, including reviews of non-Java repositories. setup-java@v4 can install Temurin 21 without imposing this new runner requirement, so use that major unless dropping older runners is intentional and documented.

Useful? React with 👍 / 👎.

with:
distribution: temurin
java-version: '21'
Comment on lines +168 to +170

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve existing Maven settings when selecting the JDK

When a workflow configures ~/.m2/settings.xml for private dependencies before invoking this composite action, actions/setup-java defaults overwrite-settings to true and replaces that file with its generated GitHub Packages configuration. This can make CodeBoarding's Java dependency resolution incomplete and also breaks later Maven steps in the caller's job; set overwrite-settings: false because this step only needs to select the JDK.

Useful? React with 👍 / 👎.


- name: Install CodeBoarding
if: steps.guard.outputs.skip != 'true'
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion scripts/diff_to_mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down
6 changes: 3 additions & 3 deletions tests/test_action_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_diff_to_mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
Loading