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
11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ jobs:
python -m pip install --disable-pip-version-check "$requirement"
- name: Check the provider table against the installed release
run: python -m unittest tests.test_provider_table_drift -v
- name: Install sync artifacts with the installed CodeBoarding release
shell: bash
env:
ACTION_PATH: ${{ github.workspace }}
ANALYSIS_DIR: ${{ runner.temp }}/sync-analysis
CHECKOUT_DIR: ${{ runner.temp }}/sync-checkout
run: |
mkdir -p "$ANALYSIS_DIR" "$CHECKOUT_DIR"
printf '{"components": []}\n' > "$ANALYSIS_DIR/analysis.json"
scripts/action/install-sync.sh
cmp "$ANALYSIS_DIR/analysis.json" "$CHECKOUT_DIR/.codeboarding/analysis.json"
- name: Render with the installed CodeBoarding release
run: >-
python scripts/diff_to_mermaid.py
Expand Down
4 changes: 2 additions & 2 deletions scripts/action/install-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ fail() { echo "::error::$1" >&2; echo "failure_reason=$1" >> "${GITHUB_OUTPUT:-/
output="$CHECKOUT_DIR/.codeboarding"
mkdir -p "$output"
# Core exposes one canonical manifest. Read from the action's directory, never the
# analyzed repository's, which may have a constants.py of its own.
# analyzed repository's, which may have an infra package of its own.
manifest="$(cd "$ACTION_PATH" && python3 - <<'PY'
from constants import ANALYSIS_FILENAME, PERSISTED_ANALYSIS_ARTIFACT_FILENAMES as artifacts
from infra.constants import ANALYSIS_FILENAME, PERSISTED_ANALYSIS_ARTIFACT_FILENAMES as artifacts
print(ANALYSIS_FILENAME)
print(*artifacts, sep="\n")
PY
Expand Down
11 changes: 7 additions & 4 deletions tests/test_action_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@


def write_core(path: Path) -> None:
"""The part of Core's constants.py (0.14.5) that names the persisted artifacts."""
"""Core 0.15.0's packaged artifact manifest."""
path = path / "infra"
path.mkdir(parents=True, exist_ok=True)
(path / "__init__.py").touch()
(path / "constants.py").write_text(
"ANALYSIS_FILENAME = 'analysis.json'\n"
"PERSISTED_ANALYSIS_ARTIFACT_FILENAMES = (\n"
Expand Down Expand Up @@ -170,9 +172,10 @@ def test_installs_core_manifest_and_preserves_user_configuration(self) -> None:
for directory in (output / "health", analysis):
directory.mkdir(parents=True)

# The analyzed repository's own constants.py must never be what is read.
(checkout / "constants.py").write_text(
"raise RuntimeError('imported target constants')\n", encoding="utf-8"
# The analyzed repository's own infra package must never be imported.
(checkout / "infra").mkdir()
(checkout / "infra" / "__init__.py").write_text(
"raise RuntimeError('imported target infra')\n", encoding="utf-8"
)
write_core(fake_core)
produced = ("analysis.json", "fingerprint.json", "static_analysis.pkl")
Expand Down
Loading