Skip to content

Commit eb4b42f

Browse files
Merge remote-tracking branch 'upstream/main' into feature/config_mapper-unverified
2 parents 7882e2b + b7b7491 commit eb4b42f

37 files changed

Lines changed: 3322 additions & 579 deletions

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
4747
- name: Build with Bazel
4848
run: |
49-
bazel build --config x86_64-linux //src/... //examples/...
49+
bazel build --lockfile_mode=error --config x86_64-linux //src/... //examples/...

.github/workflows/bzlmod-lock.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
name: Bzlmod Lockfile Check
14+
permissions:
15+
contents: read
16+
on:
17+
pull_request:
18+
types: [opened, reopened, synchronize]
19+
merge_group:
20+
types: [checks_requested]
21+
push:
22+
branches:
23+
- main
24+
jobs:
25+
bzlmod-lock:
26+
uses: eclipse-score/cicd-workflows/.github/workflows/bzlmod-lock-check.yml@main
27+
with:
28+
working-directory: .

.github/workflows/code_coverage.yml

Lines changed: 16 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -24,83 +24,20 @@ on:
2424

2525
jobs:
2626
cpp:
27-
runs-on: ubuntu-22.04
28-
steps:
29-
- name: Checkout Repository
30-
uses: actions/checkout@v6
31-
32-
- name: Install lcov
33-
run: |
34-
sudo apt-get update
35-
sudo apt-get install -y lcov
36-
37-
- name: Setup Bazel
38-
uses: bazel-contrib/setup-bazel@0.18.0
39-
with:
40-
bazelisk-cache: true
41-
disk-cache: ${{ github.workflow }}-${{ github.job }}
42-
repository-cache: true
43-
cache-save: ${{ github.event_name == 'push' }}
44-
45-
- name: Run Bazel Coverage
46-
run: |
47-
bazel coverage \
48-
--test_output=errors \
49-
--nocache_test_results \
50-
--config=x86_64-linux \
51-
//src/...
52-
53-
- name: Generate HTML Coverage Report
54-
shell: bash
55-
run: |
56-
genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" \
57-
-o=cpp_coverage \
58-
--show-details \
59-
--legend \
60-
--function-coverage \
61-
--branch-coverage
62-
63-
- name: Upload Coverage Artifacts
64-
uses: actions/upload-artifact@v6
65-
with:
66-
name: ${{ github.event.repository.name }}_cpp_coverage_report
67-
path: cpp_coverage/
68-
retention-days: 10
27+
uses: eclipse-score/cicd-workflows/.github/workflows/cpp-coverage.yml@main
28+
with:
29+
bazel-target: "//src/..."
30+
bazel-config: "x86_64-linux"
31+
extra-bazel-flags: "--test_output=errors --nocache_test_results --lockfile_mode=error"
32+
artifact-name-suffix: "_cpp"
33+
retention-days: 10
34+
min-coverage: 76
6935
rust:
70-
runs-on: ubuntu-latest
71-
steps:
72-
- name: Checkout Repository
73-
uses: actions/checkout@v6
74-
75-
- name: Setup Bazel
76-
uses: bazel-contrib/setup-bazel@0.18.0
77-
with:
78-
bazelisk-cache: true
79-
disk-cache: ${{ github.workflow }}-${{ github.job }}
80-
repository-cache: true
81-
cache-save: ${{ github.event_name == 'push' }}
82-
83-
- name: Run Rust tests with coverage instrumentation
84-
run: |
85-
set -euo pipefail
86-
bazel test \
87-
--config=x86_64-linux \
88-
--config=ferrocene-coverage \
89-
--nocache_test_results \
90-
$(bazel query 'kind(rust_test, //src/...) except attr("tags", "loom", //src/...)')
91-
92-
- name: Generate Ferrocene coverage reports
93-
run: |
94-
set -euo pipefail
95-
bazel run //:rust_coverage -- --min-line-coverage 66
96-
97-
- name: Locate coverage artifacts
98-
run: |
99-
echo "COVERAGE_DIR=$(bazel info bazel-bin)/coverage/rust-tests" >> "${GITHUB_ENV}"
100-
101-
- name: Upload coverage HTML
102-
uses: actions/upload-artifact@v4
103-
with:
104-
name: ${{ github.event.repository.name }}_rust_coverage_report
105-
path: ${{ env.COVERAGE_DIR }}
106-
retention-days: 10
36+
uses: eclipse-score/cicd-workflows/.github/workflows/rust-coverage.yml@main
37+
with:
38+
bazel-test-targets: "//src/..."
39+
bazel-test-config-flags: "--config=x86_64-linux --config=ferrocene-coverage --lockfile_mode=error"
40+
bazel-test-args: "--test_output=errors --nocache_test_results"
41+
coverage-target: "//:rust_coverage"
42+
coverage-artifact-name: "rust-coverage-html"
43+
min-coverage: 93

.github/workflows/copyright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
copyright-check:
2222
uses: eclipse-score/cicd-workflows/.github/workflows/copyright.yml@main
2323
with:
24-
bazel-target: "run //:copyright.check"
24+
bazel-target: "run --lockfile_mode=error //:copyright.check"

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
formatting-check:
2525
uses: eclipse-score/cicd-workflows/.github/workflows/format.yml@main
2626
with:
27-
bazel-target: "test //:format.check" # optional, this is the default
27+
bazel-target: "test --lockfile_mode=error //:format.check" # optional, this is the default

.github/workflows/license_check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ jobs:
2828
uses: eclipse-score/cicd-workflows/.github/workflows/license-check.yml@main
2929
with:
3030
repo-url: "${{ github.server_url }}/${{ github.repository }}"
31+
bazel-target: "run --lockfile_mode=error //:license-check"
3132
secrets:
3233
dash-api-token: ${{ secrets.ECLIPSE_GITLAB_API_TOKEN }}

.github/workflows/test_and_docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ jobs:
3737
pull-requests: write
3838
contents: read
3939
with:
40-
bazel-docs-verify-target: "//:docs_check"
40+
bazel-docs-verify-target: "--lockfile_mode=error //:docs_check"
4141
run-tests:
4242
uses: eclipse-score/cicd-workflows/.github/workflows/tests.yml@main
4343
permissions:
4444
contents: read
4545
pull-requests: read
4646
with:
47-
bazel-target: 'test //src/... //tests/... --config=x86_64-linux'
47+
bazel-target: 'test --lockfile_mode=error //src/... //tests/... --config=x86_64-linux'
4848
upload-name: 'bazel-testlogs'
4949
packages: 'fakechroot'
5050
build-docs:
@@ -59,6 +59,6 @@ jobs:
5959

6060
with:
6161
# the bazel-target depends on your repo specific docs_targets configuration (e.g. "suffix")
62-
bazel-target: "//:docs -- --github_user=${{ github.repository_owner }} --github_repo=${{ github.event.repository.name }}"
62+
bazel-target: "--lockfile_mode=error //:docs -- --github_user=${{ github.repository_owner }} --github_repo=${{ github.event.repository.name }}"
6363
retention-days: 3
6464
tests-report-artifact: bazel-testlogs

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
# Bazel
3636
bazel-*
37-
MODULE.bazel.lock
3837
user.bazelrc
3938

4039
# Ruff

src/health_monitoring_lib/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ PROC_MACRO_DEPS = [
2828
CC_SOURCES = [
2929
"cpp/common.cpp",
3030
"cpp/deadline_monitor.cpp",
31+
"cpp/heartbeat_monitor.cpp",
3132
"cpp/health_monitor.cpp",
3233
]
3334

3435
CC_HDRS = [
3536
"cpp/include/score/hm/common.h",
3637
"cpp/include/score/hm/tag.h",
3738
"cpp/include/score/hm/deadline/deadline_monitor.h",
39+
"cpp/include/score/hm/heartbeat/heartbeat_monitor.h",
3840
"cpp/include/score/hm/health_monitor.h",
3941
]
4042

src/health_monitoring_lib/cpp/health_monitor.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern "C" {
1818
using namespace score::hm;
1919
using namespace score::hm::internal;
2020
using namespace score::hm::deadline;
21+
using namespace score::hm::heartbeat;
2122

2223
// Functions below must match functions defined in `crate::ffi`.
2324

@@ -30,9 +31,15 @@ FFICode health_monitor_builder_build(FFIHandle health_monitor_builder_handle,
3031
FFICode health_monitor_builder_add_deadline_monitor(FFIHandle health_monitor_builder_handle,
3132
const MonitorTag* monitor_tag,
3233
FFIHandle deadline_monitor_builder_handle);
34+
FFICode health_monitor_builder_add_heartbeat_monitor(FFIHandle health_monitor_builder_handle,
35+
const MonitorTag* monitor_tag,
36+
FFIHandle heartbeat_monitor_builder_handle);
3337
FFICode health_monitor_get_deadline_monitor(FFIHandle health_monitor_handle,
3438
const MonitorTag* monitor_tag,
3539
FFIHandle* deadline_monitor_handle_out);
40+
FFICode health_monitor_get_heartbeat_monitor(FFIHandle health_monitor_handle,
41+
const MonitorTag* monitor_tag,
42+
FFIHandle* heartbeat_monitor_handle_out);
3643
FFICode health_monitor_start(FFIHandle health_monitor_handle);
3744
FFICode health_monitor_destroy(FFIHandle health_monitor_handle);
3845
}
@@ -71,6 +78,20 @@ HealthMonitorBuilder HealthMonitorBuilder::add_deadline_monitor(const MonitorTag
7178
return std::move(*this);
7279
}
7380

81+
HealthMonitorBuilder HealthMonitorBuilder::add_heartbeat_monitor(const MonitorTag& monitor_tag,
82+
HeartbeatMonitorBuilder&& monitor) &&
83+
{
84+
auto monitor_handle = monitor.drop_by_rust();
85+
SCORE_LANGUAGE_FUTURECPP_PRECONDITION(monitor_handle.has_value());
86+
SCORE_LANGUAGE_FUTURECPP_PRECONDITION(health_monitor_builder_handle_.as_rust_handle().has_value());
87+
88+
auto result{health_monitor_builder_add_heartbeat_monitor(
89+
health_monitor_builder_handle_.as_rust_handle().value(), &monitor_tag, monitor_handle.value())};
90+
SCORE_LANGUAGE_FUTURECPP_ASSERT(result == kSuccess);
91+
92+
return std::move(*this);
93+
}
94+
7495
HealthMonitorBuilder HealthMonitorBuilder::with_internal_processing_cycle(std::chrono::milliseconds cycle_duration) &&
7596
{
7697
internal_processing_cycle_duration_ = cycle_duration;
@@ -122,6 +143,18 @@ score::cpp::expected<DeadlineMonitor, Error> HealthMonitor::get_deadline_monitor
122143
return score::cpp::expected<DeadlineMonitor, Error>(DeadlineMonitor{handle});
123144
}
124145

146+
score::cpp::expected<HeartbeatMonitor, Error> HealthMonitor::get_heartbeat_monitor(const MonitorTag& monitor_tag)
147+
{
148+
FFIHandle handle{nullptr};
149+
auto result{health_monitor_get_heartbeat_monitor(health_monitor_, &monitor_tag, &handle)};
150+
if (result != kSuccess)
151+
{
152+
return score::cpp::unexpected(static_cast<Error>(result));
153+
}
154+
155+
return score::cpp::expected<HeartbeatMonitor, Error>(HeartbeatMonitor{handle});
156+
}
157+
125158
void HealthMonitor::start()
126159
{
127160
auto result{health_monitor_start(health_monitor_)};

0 commit comments

Comments
 (0)