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 .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@

python_basics/integration_tests
starpls/integration_tests
# Should be run from its own directory (separate Module)
bazel/rules/rules_score/test
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ common --registry=https://bcr.bazel.build

common --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux

# libclang toolchain for the C/C++ parser used by the score rules. Registered
# only for score_tooling's own build (its LLVM is a dev dependency); integrating
# repositories register their own libclang toolchain instead.
common --extra_toolchains=//cpp/libclang:score_tooling_libclang_toolchain

build --java_language_version=17
build --tool_java_language_version=17
build --java_runtime_version=remotejdk_17
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.3.1
8.5.1
102 changes: 81 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,36 @@ name: Run Python Basics Integration and Unit Tests
on:
pull_request:
types: [opened, reopened, synchronize]
concurrency:
group: tests-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
ANDROID_HOME: ""
ANDROID_SDK_ROOT: ""
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
code:
runs-on: ubuntu-latest
root_workspace_tests:
runs-on: ubuntu-24.04
permissions:
contents: read
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@v7.0.0
- name: Install Missing Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcairo2-dev
- name: Run python_basics integration tests
run: |
cd python_basics/integration_tests
bazel test //...
- name: Run starpls integration tests
run: |
cd starpls/integration_tests
bazel test //...
- name: Run cr_checker unit tests
run: |
cd cr_checker/tests
bazel test //...
- name: Free Disk Space (Ubuntu)
uses: eclipse-score/more-disk-space@v1
with:
level: 4
- uses: castler/setup-bazel@cache-optimized
with:
bazelisk-cache: true
disk-cache: root_workspace_tests
repository-cache: true
cache-optimized: true
cache-save: ${{ github.ref == 'refs/heads/main' }}
- name: Run coverage module tests
run: |
bazel test //coverage/tests:all
- name: Run rules_score tests
run: |
bazel test //bazel/rules/rules_score/...
- name: Run Plantuml Tooling clippy
run: |
bazel build //plantuml/... --config=clippy
Expand All @@ -63,3 +65,61 @@ jobs:
- name: Run Libclang Parser Tooling tests
run: |
bazel test //cpp/libclang/...
integration_tests:
runs-on: ubuntu-24.04
permissions:
contents: read
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@v7.0.0
- name: Free Disk Space (Ubuntu)
uses: eclipse-score/more-disk-space@v1
with:
level: 4
- uses: castler/setup-bazel@cache-optimized
with:
bazelisk-cache: true
disk-cache: integration_tests
repository-cache: true
cache-optimized: true
cache-save: ${{ github.ref == 'refs/heads/main' }}
- name: Run python_basics integration tests
run: |
cd python_basics/integration_tests
bazel test //...
- name: Run starpls integration tests
run: |
cd starpls/integration_tests
bazel test //...
- name: Run cr_checker unit tests
run: |
cd cr_checker/tests
bazel test //...
rules_score_tests:
runs-on: ubuntu-24.04
permissions:
contents: read
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@v7.0.0
- name: Free Disk Space (Ubuntu)
uses: eclipse-score/more-disk-space@v1
with:
level: 4
- uses: castler/setup-bazel@cache-optimized
with:
bazelisk-cache: true
disk-cache: rules_score_tests
repository-cache: true
cache-optimized: true
cache-save: ${{ github.ref == 'refs/heads/main' }}
- name: Install Missing Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcairo2-dev
- name: Run rules_score tests
run: |
cd bazel/rules/rules_score/test
bazel test //...
6 changes: 0 additions & 6 deletions bazel/rules/rules_score/private/sphinx_module.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,6 @@ def sphinx_module(
extension will not be available).
visibility: Bazel visibility
"""
if graphviz == None:
graphviz = select({
"//bazel/rules/rules_score:linux_x86_64": "@graphviz_deb//:all",
"//conditions:default": None,
})

_score_needs(
name = name + "_needs",
srcs = srcs,
Expand Down
7 changes: 2 additions & 5 deletions bazel/rules/rules_score/private/unit.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ load("@rules_cc//cc:find_cc_toolchain.bzl", "use_cc_toolchain")
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_rust//rust:defs.bzl", "rust_common")
load("//bazel/rules/rules_score:providers.bzl", "CcDependencyInfo", "CertifiedScope", "SphinxSourcesInfo", "UnitDesignInfo", "UnitInfo")
load("//cpp/libclang:cpp_parser.bzl", "cpp_parser_action_internal_attrs", "cpp_parser_target_aspects", "has_cpp_parser_inputs", "run_cpp_parser_action")
load("//cpp/libclang:cpp_parser.bzl", "cpp_parser_action_internal_attrs", "cpp_parser_action_toolchains", "cpp_parser_target_aspects", "has_cpp_parser_inputs", "run_cpp_parser_action")
load(":cc_dependency_aspect.bzl", "cc_dependencies_aspect")

def _run_implementation_cpp_parser(ctx, impl, output_prefix):
Expand All @@ -34,9 +34,6 @@ def _run_implementation_cpp_parser(ctx, impl, output_prefix):
target = impl,
output_prefix = output_prefix,
tool = ctx.attr._tool,
libclang = ctx.file._libclang,
llvm_cxx_builtin_include = ctx.attr._llvm_cxx_builtin_include,
llvm_extra_config_site = ctx.attr._llvm_extra_config_site,
log_level = ctx.attr._log_level[BuildSettingInfo].value,
)

Expand Down Expand Up @@ -167,7 +164,7 @@ _unit = rule(
doc = "Defines a software unit with design, implementation, and tests for S-CORE process compliance",
subrules = [subrule_gtest_report],
attrs = _unit_attrs,
toolchains = use_cc_toolchain(),
toolchains = cpp_parser_action_toolchains() + use_cc_toolchain(),
fragments = ["cpp"],
)

Expand Down
2 changes: 1 addition & 1 deletion bazel/rules/rules_score/private/verbosity.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
# Merge into a rule's attrs dict with ``**VERBOSITY_ATTR``.
VERBOSITY_ATTR = {
"_verbosity": attr.label(
default = Label("//bazel/rules/rules_score:verbosity"),
default = Label("@score_tooling//bazel/rules/rules_score:verbosity"),
doc = "Verbosity level build setting (warn/info/debug).",
),
}
Expand Down
2 changes: 1 addition & 1 deletion bazel/rules/rules_score/test/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.3.1
8.5.1
107 changes: 64 additions & 43 deletions bazel/rules/rules_score/test/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@aspect_rules_py//py:defs.bzl", "py_binary")

# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
Expand Down Expand Up @@ -26,6 +28,8 @@ load(
"unit",
"unit_design",
)
load("@score_tooling//bazel/rules/rules_score:sphinx_toolchain.bzl", "sphinx_toolchain")
load("@score_tooling//cpp/libclang:libclang_toolchain.bzl", "libclang_toolchain")
load("@trlc//:trlc.bzl", "trlc_requirements", "trlc_requirements_test")
load(
":html_generation_test.bzl",
Expand Down Expand Up @@ -93,6 +97,56 @@ load(

package(default_visibility = ["//visibility:public"])

# ============================================================================
# Sphinx Toolchain — uses score_docs_as_code so score_metamodel is importable
# ============================================================================

exports_files(["template/conf.template.py"])

py_binary(
name = "score_build",
srcs = ["@score_tooling//bazel/rules/rules_score:src/sphinx_wrapper.py"],
main = "@score_tooling//bazel/rules/rules_score:src/sphinx_wrapper.py",
package_collisions = "warning",
visibility = ["//visibility:public"],
deps = [
"@score_docs_as_code//src:plantuml_for_python",
"@score_docs_as_code//src/extensions/score_sphinx_bundle",
"@score_tooling//bazel/rules/rules_score:bazel_sphinx_needs",
"@score_tooling//bazel/rules/rules_score:sphinx_module_ext",
],
)

sphinx_toolchain(
name = "score_sphinx_toolchain",
conf_template = "//:template/conf.template.py",
html_merge_tool = "@score_tooling//bazel/rules/rules_score:sphinx_html_merge",
sphinx = ":score_build",
)

toolchain(
name = "score_toolchain",
toolchain = ":score_sphinx_toolchain",
toolchain_type = "@score_tooling//bazel/rules/rules_score:toolchain_type",
)

# ============================================================================
# libclang Toolchain — this integrating repo supplies its own libclang/C++
# toolchain for the score libclang-based C/C++ parser.
# ============================================================================
libclang_toolchain(
name = "test_libclang",
cxx_builtin_include = "@llvm_toolchain_llvm//:cxx_builtin_include",
extra_config_site = "@llvm_toolchain_llvm//:extra_config_site",
libclang = "@llvm_toolchain_llvm//:lib/libclang.so",
)

toolchain(
name = "test_libclang_toolchain",
toolchain = ":test_libclang",
toolchain_type = "@score_tooling//cpp/libclang:libclang_toolchain_type",
)

# ============================================================================
# Test Fixtures - Module Definitions
# ============================================================================
Expand Down Expand Up @@ -126,15 +180,6 @@ sphinx_module(
],
)

# Test 2: Graphviz Rendering
# Tests hermetic graphviz support via sphinx.ext.graphviz directive
sphinx_module(
name = "graphviz_test_lib",
srcs = glob(["fixtures/graphviz_test/*.rst"]),
index = "fixtures/graphviz_test/index.rst",
sphinx = "@score_tooling//bazel/rules/rules_score:score_build",
)

# Test 3: SEooC (Safety Element out of Context) Module
# Tests the score_component macro with S-CORE process artifacts

Expand Down Expand Up @@ -283,7 +328,7 @@ unit_design(
unit(
name = "test_unit",
testonly = True,
scope = ["//bazel/rules/rules_score/test:mock_lib1"],
scope = ["//:mock_lib1"],
tests = [":test_unit_tests"],
unit_design = [":test_unit_design"],
implementation = [
Expand Down Expand Up @@ -709,26 +754,11 @@ aous_rst_sphinx_test(
requirements_rst_test_suite(name = "requirements_rst_tests")

# ============================================================================
# Image srcs Tests
# Image srcs Tests (defined in sub-package to avoid workspace-root edge case)
# ============================================================================

# Fixture: feature_requirements with image_srcs
feature_requirements(
name = "feat_req_with_image",
srcs = ["fixtures/seooc_test/feature_requirements.trlc"],
image_srcs = [
"fixtures/image_srcs/diagrams/arch.svg",
"fixtures/image_srcs/diagrams/arch.png",
],
deps = [":asr_trlc"],
)

image_srcs_sphinx_sources_test(
name = "image_srcs_sphinx_sources_test",
target_under_test = ":feat_req_with_image",
)

requirements_image_test_suite(name = "requirements_image_tests")
# feat_req_with_image and image_srcs_sphinx_sources_test live in
# //fixtures/image_srcs so that ctx.label.package is non-empty and
# subrule_trlc_image_stage can strip the prefix correctly.

# ============================================================================
# Combined Test Suite
Expand All @@ -745,7 +775,7 @@ requirements_image_test_suite(name = "requirements_image_tests")
trlc_requirements(
name = "safety_measures_fixtures",
srcs = ["fixtures/seooc_test/safety_measures_fixtures.trlc"],
spec = ["//bazel/rules/rules_score/trlc/config:score_requirements_model"],
spec = ["@score_tooling//bazel/rules/rules_score/trlc/config:score_requirements_model"],
)

trlc_requirements_test(
Expand All @@ -757,22 +787,22 @@ py_test(
name = "test_safety_analysis_tools",
size = "small",
srcs = ["test_safety_analysis_tools.py"],
deps = ["//bazel/rules/rules_score:safety_analysis_tools"],
deps = ["@score_tooling//bazel/rules/rules_score:safety_analysis_tools"],
)

py_test(
name = "test_aou_forwarding_to_lobster",
size = "small",
srcs = ["test_aou_forwarding_to_lobster.py"],
deps = ["//bazel/rules/rules_score:aou_forwarding_to_lobster"],
deps = ["@score_tooling//bazel/rules/rules_score:aou_forwarding_to_lobster"],
)

py_test(
name = "test_rst_to_trlc",
size = "small",
srcs = ["rst_to_trlc_test.py"],
main = "rst_to_trlc_test.py",
deps = ["//bazel/rules/rules_score:rst_to_trlc_lib"],
deps = ["@score_tooling//bazel/rules/rules_score:rst_to_trlc_lib"],
)

py_test(
Expand All @@ -787,27 +817,18 @@ py_test(
deps = ["@trlc//tools/trlc_rst:trlc_rst_lib"],
)

py_test(
name = "test_graphviz_rendering",
size = "small",
srcs = ["graphviz_render_test.py"],
data = [":graphviz_test_lib"],
main = "graphviz_render_test.py",
)

# Combined test suite for all tests
test_suite(
name = "all_tests",
tests = [
":requirements_image_tests",
":requirements_rst_tests",
":seooc_tests",
":sphinx_module_tests",
":test_aou_forwarding_to_lobster",
":test_graphviz_rendering",
":test_rst_to_trlc",
":test_safety_analysis_tools",
":test_trlc_rst_image_rendering",
":unit_component_tests",
"//fixtures/image_srcs:requirements_image_tests",
],
)
Loading
Loading