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
22 changes: 12 additions & 10 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ build --tool_java_runtime_version=remotejdk_17
build --@score_baselibs//score/json:base_library=nlohmann
build --@score_baselibs//score/mw/log/flags:KRemote_Logging=False

common --extra_toolchains=@gcc_toolchain//:host_gcc_12

# Clippy linting (enabled by default)
build --aspects=@score_rust_policies//clippy:linters.bzl%clippy_strict
build --output_groups=+rules_lint_human
Expand All @@ -48,25 +46,23 @@ build:per_shared --host_platform=@score_bazel_platforms//:x86_64-linux
# Config dedicated to host platform CPU:x86_64 and OS:Linux
# -------------------------------------------------------------------------------
build:per-x86_64-linux --config=per_shared
build:per-x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux
build:per-x86_64-linux --extra_toolchains=@gcc_toolchain//:host_gcc_12
build:per-x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix
build:per-x86_64-linux --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0-posix
build:per-x86_64-linux --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu
# -------------------------------------------------------------------------------
# Config dedicated to target platform CPU:x86_64 and OS:QNX
# -------------------------------------------------------------------------------
build:per-x86_64-qnx --config=per_shared
build:per-x86_64-qnx --platforms=@score_toolchains_qnx//platforms:x86_64-qnx
build:per-x86_64-qnx --extra_toolchains=@toolchains_qnx_qcc//:qcc_x86_64
build:per-x86_64-qnx --extra_toolchains=@toolchains_qnx_ifs//:ifs_x86_64
build:per-x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix
build:per-x86_64-qnx --extra_toolchains=@score_qcc_x86_64_toolchain//:x86_64-qnx-sdp_8.0.0-posix
build:per-x86_64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_pc_nto_qnx800

# -------------------------------------------------------------------------------
# Config dedicated to target platform CPU:arm64 and OS:QNX
# -------------------------------------------------------------------------------
build:per-arm64-qnx --config=per_shared
build:per-arm64-qnx --platforms=@score_toolchains_qnx//platforms:aarch64-qnx8_0
build:per-arm64-qnx --extra_toolchains=@toolchains_qnx_qcc//:qcc_aarch64
build:per-arm64-qnx --extra_toolchains=@toolchains_qnx_ifs//:ifs_aarch64
build:per-arm64-qnx --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-posix
build:per-arm64-qnx --extra_toolchains=@score_qcc_aarch64_toolchain//:aarch64-qnx-sdp_8.0.0-posix
build:per-arm64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_nto_qnx800


Expand All @@ -88,3 +84,9 @@ test:ferrocene-coverage --run_under=@score_tooling//coverage:llvm_profile_wrappe
# Import local user workspace file, if exists
# -------------------------------------------------------------------------------
try-import %workspace%/user.bazelrc


# Coverage configuration for C++
coverage --features=coverage
coverage --combined_report=lcov
coverage --cache_test_results=no
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:
SCORE_QNX_PASSWORD: ${{ secrets.SCORE_QNX_PASSWORD }}
run: |
bazel build \
--config=per-arm64-qnx \
//src/rust/rust_kvs:rust_kvs \
//src/rust/rust_kvs_tool:kvs_tool \
--platforms=@score_toolchains_rust//platforms:aarch64-unknown-qnx8_0 \
--features=-dependency_file \
--credential_helper=*.qnx.com=${{ github.workspace }}/tools/qnx_credential_helper.py

Expand Down
56 changes: 15 additions & 41 deletions .github/workflows/check.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the parts with rust coverage should be deleted, as we have dedicated ferrocene workflow for that in .github/workflows/rust_coverage.yml

Original file line number Diff line number Diff line change
Expand Up @@ -95,34 +95,13 @@ jobs:
- name: Bazel Build
run: |
bazel build \
--config=per-x86_64-linux \
//src/rust/rust_kvs:rust_kvs \
//src/rust/rust_kvs_tool:kvs_tool

- name: Bazel Unit Tests
run: |
bazel test //src/rust/rust_kvs:tests

- name: Bazel Unit Test with Coverage
run: |
bazel coverage //src/rust/rust_kvs:tests \
--collect_code_coverage \
--combined_report=lcov \
--experimental_generate_llvm_lcov \
--nocache_test_results \
--nostamp

- name: Install lcov
run: |
sudo apt-get update
sudo apt-get install -y lcov

- name: Extract Coverage for Rust Files
run: |
REPORT=$(find "$(bazel info output_path)" -type f -path '*/rust/*/coverage.dat' | head -n1)
lcov \
--rc branch_coverage=1 \
--extract "$REPORT" '*.rs' -o "${REPORT}.rs" \
--output-file kvs_coverage.info
bazel test --config=per-x86_64-linux //src/rust/rust_kvs:tests

cpp-bazel:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -156,24 +135,19 @@ jobs:

- name: Extract Coverage for CPP Files
run: |
# ToDo: should work out of the box with bazel coverage (https://github.com/eclipse-score/toolchains_gcc/issues/21)
# run test binary to generate coverage data (*.gcda files). Manually
# since it is build already with the correct flags and the gcda ends
# up in a proper location
./bazel-bin/src/cpp/tests/test_kvs_cpp

# define some variables for easier usage
BASE_DIR="$(pwd)"
GCOV_TOOL="./bazel-persistency/external/score_toolchains_gcc++gcc+gcc_toolchain_gcc/bin/x86_64-unknown-linux-gnu-gcov"
BIN_DIR="./bazel-bin/src/cpp/"
OUT_FILE="lcov_coverage.info"
# capture coverage info
lcov --capture --directory "$BIN_DIR" --output-file "$OUT_FILE" --gcov-tool "$GCOV_TOOL" --base-directory "$BASE_DIR" --branch-coverage --ignore-errors mismatch --exclude "*/external/*"
# display summary
lcov --summary --rc branch_coverage=1 "$OUT_FILE"
# generate html report (for local inspection if needed)
# genhtml "$OUT_FILE" -o coverage_html --show-details --legend --function-coverage --branch-coverage
rm ${OUT_FILE}
genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" \
-o=cpp_coverage \
--show-details \
--legend \
--function-coverage \
--branch-coverage
shell: bash
- name: Upload Coverage Artifacts
uses: actions/upload-artifact@v6
with:
name: ${{ github.event.repository.name }}_cpp_coverage_report
path: cpp_coverage/
retention-days: 10

- name: Bazel Benchmark
run: bazel run --config=per-x86_64-linux -c opt //:bm_kvs_cpp
4 changes: 2 additions & 2 deletions .github/workflows/component_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:

- name: Build Rust test scenarios with Bazel
run: |
bazel build //tests/test_scenarios/rust:test_scenarios
bazel build --config=per-x86_64-linux //tests/test_scenarios/rust:test_scenarios

- name: Set up Python 3
uses: actions/setup-python@v5
Expand All @@ -79,7 +79,7 @@ jobs:

- name: Run Python tests with bazel
run: |
bazel test //tests/test_cases:cit
bazel test --config=per-x86_64-linux //tests/test_cases:cit

- name: Prepare test reports
if: always()
Expand Down
73 changes: 52 additions & 21 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,22 @@ pip.parse(
use_repo(pip, "pip_score_venv_test")

# rust
bazel_dep(name = "rules_rust", version = "0.61.0")
bazel_dep(name = "rules_rust", version = "0.67.0")
git_override(
module_name = "rules_rust",
commit = "2b171a7376e69cb1207eced1f66904ce4ae0c819",
remote = "https://github.com/pawelrutkaq/rules_rust.git", # To be fixed once rule_rust is in score bazel registry
)

# Shared Rust policies (Clippy config, etc.), overridden locally during development.
bazel_dep(name = "score_rust_policies", version = "0.0.4", dev_dependency = True)

# bazel cc rules
bazel_dep(name = "rules_cc", version = "0.1.2")

#score gcc toolchain
bazel_dep(name = "score_toolchains_gcc", version = "0.5", dev_dependency = True)

gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency = True)
gcc.toolchain(
sha256 = "8fa85c2a93a6bef1cf866fa658495a2416dfeec692e4246063b791abf18da083",
strip_prefix = "x86_64-unknown-linux-gnu",
url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/v0.0.3/x86_64-unknown-linux-gnu_gcc12.tar.gz",
)
use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc")
# Toolchains and extensions
bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.2.2", dev_dependency = True)
bazel_dep(name = "score_toolchains_rust", version = "0.7.0", dev_dependency = True)

# score qnx (qcc) toolchain.
bazel_dep(name = "score_toolchains_qnx", version = "0.0.5", dev_dependency = True)
Expand All @@ -80,17 +78,12 @@ bazel_dep(name = "platforms", version = "1.0.0")

## S-CORE bazel registry
bazel_dep(name = "score_baselibs", version = "0.1.2")
bazel_dep(name = "score_bazel_platforms", version = "0.0.3")
bazel_dep(name = "score_bazel_platforms", version = "0.0.4")

bazel_dep(name = "score_docs_as_code", version = "3.0.0", dev_dependency = True)
bazel_dep(name = "score_docs_as_code", version = "2.3.0", dev_dependency = True)
bazel_dep(name = "score_platform", version = "0.5.2", dev_dependency = True)
git_override(
module_name = "score_platform",
commit = "7d252e75b733b09225f1a383bb00d5d7d79fa5ae", # override with main until next release
remote = "https://github.com/eclipse-score/score.git",
)
bazel_dep(name = "score_process", version = "1.4.0", dev_dependency = True)

bazel_dep(name = "score_process", version = "1.4.3")
bazel_dep(name = "score_python_basics", version = "0.3.4")
bazel_dep(name = "score_tooling", version = "1.1.0")

Expand All @@ -116,7 +109,6 @@ git_override(
remote = "https://github.com/eclipse-score/baselibs.git",
)

bazel_dep(name = "score_toolchains_rust", version = "0.4.0", dev_dependency = True)
bazel_dep(name = "custom_qemu", version = "1.0.0", dev_dependency = True)
archive_override(
module_name = "custom_qemu",
Expand All @@ -127,5 +119,44 @@ archive_override(
],
)

gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc", dev_dependency = True)
gcc.toolchain(
name = "score_gcc_x86_64_toolchain",
target_cpu = "x86_64",
target_os = "linux",
use_default_package = True,
version = "12.2.0",
)
gcc.toolchain(
name = "score_gcc_aarch64_toolchain",
target_cpu = "aarch64",
target_os = "linux",
use_default_package = True,
version = "12.2.0",
)
gcc.toolchain(
name = "score_qcc_x86_64_toolchain",
sdp_version = "8.0.0",
target_cpu = "x86_64",
target_os = "qnx",
use_default_package = True,
version = "12.2.0",
)
gcc.toolchain(
name = "score_qcc_aarch64_toolchain",
sdp_version = "8.0.0",
target_cpu = "aarch64",
target_os = "qnx",
use_default_package = True,
version = "12.2.0",
)
use_repo(
gcc,
"score_gcc_aarch64_toolchain",
"score_gcc_x86_64_toolchain",
"score_qcc_aarch64_toolchain",
"score_qcc_x86_64_toolchain",
)

# S-CORE crates
bazel_dep(name = "score_crates", version = "0.0.6")
bazel_dep(name = "score_crates", version = "0.0.7")
Loading