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
2 changes: 2 additions & 0 deletions .github/workflows/downstream_compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
"persistency and remote",
"process_description and local",
"process_description and remote",
"reference_integration and local",
"reference_integration and remote",
"score and local",
"score and remote",
"time and remote",
Expand Down
1 change: 1 addition & 0 deletions src/tests/downstream_compatibility/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Filters which repositories to test.
- [module_template](https://github.com/eclipse-score/module_template)
- [persistency](https://github.com/eclipse-score/persistency)
- [process_description](https://github.com/eclipse-score/process_description)
- [reference_integration](https://github.com/eclipse-score/reference_integration)
- [score](https://github.com/eclipse-score/score)
- [time](https://github.com/eclipse-score/time)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ class ConsumerRepo:
name: str
git_url: str
commands: list[str]
module_file: str

def __init__(
self, name: str, git_url: str | None = None, commands: list[str] | None = None
self,
name: str,
git_url: str | None = None,
commands: list[str] | None = None,
module_file: str = "MODULE.bazel",
) -> None:
self.name = name

Expand All @@ -68,6 +73,7 @@ def __init__(
# The minimum is to ensure that the repo can build against the current score_docs_as_code branch.
# If docs works, then usually docs_check and needs_json will work as well.
self.commands = ["bazel run //:docs"]
self.module_file = module_file


REPOS_TO_TEST: list[ConsumerRepo] = [
Expand Down Expand Up @@ -99,6 +105,10 @@ def __init__(
"bazel build //:needs_json",
],
),
ConsumerRepo(
name="reference_integration",
module_file="bazel_common/score_modules_tooling.MODULE.bazel",
),
ConsumerRepo(
name="score",
commands=[
Expand Down Expand Up @@ -157,10 +167,15 @@ def _strip_score_docs_overrides(content: str) -> str:


def _write_module_bazel(
repo_path: Path, override_type: str, commit: str, remote: str
repo_path: Path,
override_type: str,
commit: str,
remote: str,
module_file: str = "MODULE.bazel",
) -> None:
"""Overwrite MODULE.bazel with the requested override type applied."""
original = (repo_path / "MODULE.bazel").read_text(encoding="utf-8")
"""Overwrite the selected module file with the requested override applied."""
module_path = repo_path / module_file
original = module_path.read_text(encoding="utf-8")
base = _strip_score_docs_overrides(original)

if override_type == "local":
Expand All @@ -177,7 +192,7 @@ def _write_module_bazel(
commit = "{commit}"
)"""

(repo_path / "MODULE.bazel").write_text(
module_path.write_text(
re.sub(_BAZEL_DEP_PATTERN, replacement, base, flags=re.MULTILINE),
encoding="utf-8",
)
Expand Down Expand Up @@ -402,6 +417,12 @@ def test_consumer_repo(

repo_path = repos_base_dir / repo.name
_ensure_repo(repo_path, repo.git_url, use_cache)
_write_module_bazel(repo_path, override_type, current_hash, gh_url)
_write_module_bazel(
repo_path,
override_type,
current_hash,
gh_url,
module_file=repo.module_file,
)
_cleanup_before_cmd(repo_path, cmd)
_run_bazel_cmd(cmd, repo.name, repo_path)