-
Notifications
You must be signed in to change notification settings - Fork 10
Add C++ coverage configuration and workflow #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9904755
e08aa69
f260808
d99f76c
29c4fb1
10dcabb
8fab87b
8ef9469
fc1fa92
dfe07a9
34bbd76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # ******************************************************************************* | ||
| # 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 | ||
| # ******************************************************************************* | ||
|
|
||
| name: Code Coverage | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a copy-paste from baselibs. I'm actually considering to have it reusable via cicd_workflows, but I'm not sure this workflow is in the right shape to push it there. Ideally, if it's to be reusable, it should support not only C++, but also Rust and maybe Python. |
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
| push: | ||
| branches: | ||
| - main | ||
| merge_group: | ||
| types: [checks_requested] | ||
|
|
||
| jobs: | ||
| coverage-report: | ||
| runs-on: ubuntu-22.04 | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Install lcov | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y lcov | ||
| - name: Setup Bazel | ||
|
Comment on lines
+38
to
+39
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please use consistent new line formatting |
||
| uses: bazel-contrib/setup-bazel@0.18.0 | ||
| with: | ||
| bazelisk-cache: true | ||
| disk-cache: ${{ github.workflow }} | ||
| repository-cache: true | ||
| cache-save: ${{ github.event_name != 'pull_request' }} | ||
|
|
||
| - name: Run Bazel Coverage | ||
| run: | | ||
| bazel coverage --config=blcov-x86_64-linux -- //score/... //tests/... | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why run |
||
| - name: Generate HTML Coverage Report | ||
| run: | | ||
| 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 }}_coverage_report | ||
| path: cpp_coverage/ | ||
| retention-days: 30 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ bazel_dep(name = "buildifier_prebuilt", version = "7.3.1") | |
| bazel_dep(name = "platforms", version = "1.0.0") | ||
|
|
||
| # S-CORE process rules | ||
| 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 = "2.2.0") | ||
| bazel_dep(name = "score_tooling", version = "1.0.4") | ||
| bazel_dep(name = "score_rust_policies", version = "0.0.3") | ||
|
|
@@ -35,6 +35,7 @@ bazel_dep(name = "score_process", version = "1.4.0", dev_dependency = True) | |
| bazel_dep(name = "score_platform", version = "0.5.1", dev_dependency = True) # This is main score repo | ||
|
|
||
| # Toolchains and extensions | ||
| bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.2.0", dev_dependency = True) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you use this, you should kick out |
||
| bazel_dep(name = "score_toolchains_gcc", version = "0.5", dev_dependency = True) | ||
| bazel_dep(name = "score_toolchains_qnx", version = "0.0.6", dev_dependency = True) | ||
| bazel_dep(name = "rust_qnx8_toolchain", version = "1.2.0", dev_dependency = True) | ||
|
|
@@ -66,12 +67,23 @@ archive_override( | |
|
|
||
| # Extensions | ||
|
|
||
| gcc_cpp = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc", dev_dependency = True) | ||
| gcc_cpp.toolchain( | ||
| name = "score_gcc_x86_64_toolchain", | ||
| target_cpu = "x86_64", | ||
| target_os = "linux", | ||
| use_default_package = True, | ||
| version = "12.2.0", | ||
| ) | ||
| use_repo(gcc_cpp, "score_gcc_x86_64_toolchain") | ||
|
|
||
| gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency = True) | ||
| gcc.toolchain( | ||
| sha256 = "457f5f20f57528033cb840d708b507050d711ae93e009388847e113b11bf3600", | ||
| strip_prefix = "x86_64-unknown-linux-gnu", | ||
| url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/0.0.1/x86_64-unknown-linux-gnu_gcc12.tar.gz", | ||
| ) | ||
| use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc") | ||
|
Comment on lines
+70
to
+86
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think those 2 shouldn't coexist or only one common config should be used for build, test and coverage for x86 linux |
||
|
|
||
| # TRLC dependency for requirements traceability | ||
| bazel_dep(name = "trlc", version = "0.0.0", dev_dependency = True) | ||
|
|
@@ -81,8 +93,6 @@ git_override( | |
| remote = "https://github.com/bmw-software-engineering/trlc.git", | ||
| ) | ||
|
|
||
| use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc") | ||
|
|
||
| toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency = True) | ||
| toolchains_qnx.sdp( | ||
| sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blstands for baselibs