diff --git a/.github/workflows/coverage_report.yml b/.github/workflows/coverage_report.yml index 4526af2..521429e 100644 --- a/.github/workflows/coverage_report.yml +++ b/.github/workflows/coverage_report.yml @@ -44,9 +44,13 @@ jobs: unique-cache-name: ${{ github.workflow }}-${{ github.job }} - name: Run Bazel Coverage run: | - readarray -t TARGETS < <(python3 -c \ - "import json; [print(t) for t in json.load(open('score/config_management/deps_acceptlist.json'))['test_targets']]") - bazel coverage --config=host_gcc "${TARGETS[@]}" + bazel coverage \ + --config=host_gcc \ + --test_tag_filters=-mw_com \ + //score/config_management/... \ + -- \ + -//score/config_management/config_provider/... \ + -//score/config_management/dependability/... - name: Generate HTML Coverage Report run: | genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" \ diff --git a/.github/workflows/deps-acceptlist-check.yml b/.github/workflows/deps-acceptlist-check.yml deleted file mode 100644 index c7d50d7..0000000 --- a/.github/workflows/deps-acceptlist-check.yml +++ /dev/null @@ -1,96 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -# Builds the CfgD & CfgP targets listed in the acceptlist -# (score/config_management/deps_acceptlist.json) and fails if any previously -# known-good target no longer builds — detecting regressions in the CI setup. - -name: Build Acceptlist Check - -on: - pull_request: - types: [opened, reopened, synchronize] - paths: - - "score/**" - - "MODULE.bazel" - - "score/config_management/deps_acceptlist.json" - - ".github/workflows/deps-acceptlist-check.yml" - push: - branches: - - main - paths: - - "score/**" - - "MODULE.bazel" - - "score/config_management/deps_acceptlist.json" - merge_group: - types: [checks_requested] - -permissions: - contents: read - pull-requests: read - -jobs: - build-acceptlist-check: - name: Build acceptlisted CfgD & CfgP targets - runs-on: ubuntu-24.04 - env: - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Bazel - uses: bazel-contrib/setup-bazel@0.18.0 - with: - bazelisk-cache: true - disk-cache: true - repository-cache: true - cache-save: ${{ github.event_name == 'push' }} - - - name: Build all acceptlisted targets - run: | - python3 - <<'EOF' - import json, subprocess, sys - - ACCEPTLIST = "score/config_management/deps_acceptlist.json" - - with open(ACCEPTLIST) as f: - targets = json.load(f)["buildable_targets"] - - failures = [] - for target in targets: - try: - result = subprocess.run( - ["bazel", "build", target], - capture_output=True, text=True, - timeout=600, - ) - except subprocess.TimeoutExpired: - failures.append(target) - print(f" TIMEOUT {target}") - continue - if result.returncode == 0: - print(f" OK {target}") - else: - failures.append(target) - print(f" FAIL {target}") - print(result.stderr[-2000:]) - - print(f"\n{len(targets) - len(failures)}/{len(targets)} targets built successfully.") - - if failures: - print("\nRegression detected — the following targets no longer build:") - for t in failures: - print(f" {t}") - sys.exit(1) - EOF diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 44d3838..fa7227c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -48,11 +48,14 @@ jobs: # the bazel-target depends on your repo specific docs_targets configuration (e.g. "suffix") # --define=LOBSTER_SOURCE_ROOT sets the GitHub blob URL prefix for source links in the LOBSTER traceability report # TEMPORARY WORKAROUND (patch): score/config_management/** is synced from an internal source and cannot be - # edited directly from OSS, so the LOBSTER unit() wiring lives only in bazel/patches/wire_unit_test_to_lobster.patch. + # edited directly from OSS, so this fix lives only as a patch applied here: + # - bazel/patches/wire_unit_test_to_lobster.patch: the LOBSTER unit() wiring (config_daemon_app_unit / + # config_provider_details_unit) that score/config_management/dependability/BUILD's component() targets + # reference. # The reusable docs workflow exposes no pre-build hook, so we apply the patch as a side effect of a # command substitution (redirected to stderr so it contributes nothing to the bazel command line) before - # `bazel run` executes, purely so the generated report reflects the intended wiring. The --check guard - # makes this a no-op (skips silently) once the real change lands via sync, so it never fails the build. - # Remove this workaround once the patch's content is synced into score/config_management/ for real. + # `bazel run` executes. The --check guard makes this a no-op (skips silently) once the real change lands + # via sync, so it never fails the build. Remove this workaround once the patch's content is synced into + # score/config_management/ for real. bazel-target: "$(git apply --check bazel/patches/wire_unit_test_to_lobster.patch 2>/dev/null && git apply bazel/patches/wire_unit_test_to_lobster.patch 1>&2) //:docs --define=LOBSTER_SOURCE_ROOT=https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/blob/main/ -- --github_user=${{ github.repository_owner }} --github_repo=${{ github.event.repository.name }}" retention-days: 3 diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 6e3f1f8..c901243 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -42,40 +42,8 @@ jobs: repository-cache: true cache-save: ${{ github.event_name == 'push' }} - - name: Run clang-tidy checks from deps_acceptlist.json + - name: Run clang-tidy checks run: | - python3 - <<'PYEOF' - import json, subprocess, sys - - ACCEPTLIST = "score/config_management/deps_acceptlist.json" - - with open(ACCEPTLIST) as f: - targets = json.load(f)["clang_tidy_targets"] - - failures = [] - for target in targets: - try: - result = subprocess.run( - ["bazel", "build", target], - capture_output=True, text=True, - timeout=600, - ) - except subprocess.TimeoutExpired: - failures.append(target) - print(f" TIMEOUT {target}") - continue - if result.returncode == 0: - print(f" OK {target}") - else: - failures.append(target) - print(f" FAIL {target}") - print(result.stderr[-2000:]) - - print(f"\n{len(targets) - len(failures)}/{len(targets)} clang-tidy targets passed.") - - if failures: - print("\nStatic analysis failed for the following targets:") - for t in failures: - print(f" {t}") - sys.exit(1) - PYEOF + bazel build \ + //score/config_management/config_daemon:clang_tidy_extra_checks \ + //score/config_management/config_provider:clang_tidy_extra_checks diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f41a6a2..ca1c5ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,50 +42,12 @@ jobs: repository-cache: true cache-save: ${{ github.event_name == 'push' }} - - name: Pre-warm Bazel cache (build test targets before running them) + - name: Run all unit tests run: | - python3 - <<'PYEOF' - import json, subprocess, sys - with open("score/config_management/deps_acceptlist.json") as f: - targets = json.load(f)["test_targets"] - result = subprocess.run(["bazel", "build"] + targets) - sys.exit(result.returncode) - PYEOF - - - name: Run tests from deps_acceptlist.json - run: | - python3 - <<'PYEOF' - import json, subprocess, sys - - ACCEPTLIST = "score/config_management/deps_acceptlist.json" - - with open(ACCEPTLIST) as f: - targets = json.load(f)["test_targets"] - - failures = [] - for target in targets: - try: - result = subprocess.run( - ["bazel", "test", target], - capture_output=True, text=True, - timeout=600, - ) - except subprocess.TimeoutExpired: - failures.append(target) - print(f" TIMEOUT {target}") - continue - if result.returncode == 0: - print(f" PASS {target}") - else: - failures.append(target) - print(f" FAIL {target}") - print(result.stderr[-2000:]) - - print(f"\n{len(targets) - len(failures)}/{len(targets)} tests passed.") - - if failures: - print("\nTests failed for the following targets:") - for t in failures: - print(f" {t}") - sys.exit(1) - PYEOF + bazel test \ + --config=host_gcc \ + --test_tag_filters=-mw_com \ + //score/config_management/... \ + -- \ + -//score/config_management/config_provider/... \ + -//score/config_management/dependability/... diff --git a/score/config_management/deps_acceptlist.json b/score/config_management/deps_acceptlist.json deleted file mode 100644 index b9cf5e3..0000000 --- a/score/config_management/deps_acceptlist.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "test_targets": [ - "//score/config_management/config_daemon/code/data_model:unit_tests_host", - "//score/config_management/config_daemon/code/data_model/parameter_set_storage:unit_tests_host", - "//score/config_management/config_daemon/code/fault_event_reporter:unit_tests_host", - "//score/config_management/config_daemon/code/plugins/demo_json:unit_tests_host", - "//score/config_management/config_daemon/code/plugins/plugin_collector:unit_tests_host", - "//score/config_management/config_daemon/code/services:unit_tests_host", - "//score/config_management/config_provider/code/config_provider/error:unit_test", - "//score/config_management/config_provider/code/parameter_set:unit_test", - "//score/config_management/config_provider/code/persistency:unit_tests_host", - "//tests/cpp:cpp_test_main" - ], - "clang_tidy_targets": [ - "//score/config_management/config_daemon:clang_tidy_extra_checks", - "//score/config_management/config_provider:clang_tidy_extra_checks" - ], - "buildable_targets": [ - "//score/config_management/config_daemon/code/app:interface", - "//score/config_management/config_daemon/code/app:mock", - "//score/config_management/config_daemon/code/data_model/details:parameterset_collection_impl", - "//score/config_management/config_daemon/code/data_model/details:unit_test", - "//score/config_management/config_daemon/code/data_model/error:error", - "//score/config_management/config_daemon/code/data_model/error:unit_test", - "//score/config_management/config_daemon/code/data_model:parameter_set_qualifier", - "//score/config_management/config_daemon/code/data_model:parameterset_collection", - "//score/config_management/config_daemon/code/data_model:parameterset_collection_mock", - "//score/config_management/config_daemon/code/data_model/parameterset_collection_interfaces:read_only_parameterset_collection", - "//score/config_management/config_daemon/code/data_model/parameterset_collection_interfaces:read_only_parameterset_collection_mock", - "//score/config_management/config_daemon/code/fault_event_reporter/details:details_score_impl", - "//score/config_management/config_daemon/code/fault_event_reporter/details:details_score_impl_for_test", - "//score/config_management/config_daemon/code/fault_event_reporter:fault_event_reporter", - "//score/config_management/config_daemon/code/fault_event_reporter:fault_event_score_types", - "//score/config_management/config_daemon/code/fault_event_reporter:mock", - "//score/config_management/config_daemon/code:is_score_variant", - "//score/config_management/config_daemon/code/json_helper/details:details", - "//score/config_management/config_daemon/code/json_helper:json_helper", - "//score/config_management/config_daemon/code/json_helper:mock", - "//score/config_management/config_daemon/code/plugins/plugin_collector:mock", - "//score/config_management/config_daemon/code/plugins:plugin_creator", - "//score/config_management/config_daemon/code/plugins:plugin_creator_mock", - "//score/config_management/config_daemon/code:score_variant", - "//score/config_management/config_daemon/code/services:internal_config_provider_reactor", - "//score/config_management/config_daemon/code/services:internal_config_provider_reactor_mock", - "//score/config_management/config_daemon/code/types/initial_qualifier_state:initial_qualifier_state", - "//score/config_management/config_provider/code/config_provider/error:error", - "//score/config_management/config_provider/code/config_provider/error:unit_test", - "//score/config_management/config_provider/code/config_provider/factory:test_mw_com_config", - "//score/config_management/config_provider/code/parameter_set:parameter_set", - "//score/config_management/config_provider/code/persistency/error:error", - "//score/config_management/config_provider/code/proxies/details:test_mw_com_config" - ] -}