Skip to content
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

add/fix support for bazel coverage #151

Merged
merged 5 commits into from
Oct 11, 2023
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
11 changes: 11 additions & 0 deletions .github/workflows/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ jobs:
bazel test --config ci --config ${{ matrix.sanitizer }} //tests/sanitizers:${{ matrix.sanitizer }}_test
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
coverage:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: bazelbuild/setup-bazelisk@v2
- name: Test Coverage
run: |
./.github/workflows/configurebb.sh
bazel coverage --config ci //examples/hello_world_cpp:hello_world_cpp_test
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
rbe:
if: (github.ref == 'refs/heads/main' || contains(github.head_ref, 'rbe'))
strategy:
Expand Down
6 changes: 6 additions & 0 deletions examples/hello_world_cpp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ cc_binary(
data = ["names.txt"],
)

cc_test(
name = "hello_world_cpp_test",
srcs = ["main.cpp"],
data = ["names.txt"],
)

platform_transition_filegroup(
name = "hello_world_cpp_linux_aarch64",
srcs = [":hello_world_cpp"],
Expand Down
22 changes: 22 additions & 0 deletions toolchain/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,12 @@ filegroup(
visibility = ["//visibility:public"],
)

filegroup(
name = "coverage_files",
srcs = [":gcov"],
visibility = ["//visibility:public"],
)

[
filegroup(
name = bin,
Expand All @@ -516,6 +522,7 @@ filegroup(
for bin in [
"ar",
"as",
"gcov",
"ld",
"ld.bfd",
"nm",
Expand Down Expand Up @@ -575,6 +582,7 @@ cc_toolchain(
linker_files = ":linker_files",
objcopy_files = ":objcopy_files",
strip_files = ":strip_files",
coverage_files = ":coverage_files",
supports_param_files = 0,
toolchain_config = ":cc_toolchain_config",
toolchain_identifier = "gcc-toolchain",
Expand All @@ -598,6 +606,7 @@ filegroup(
":ar_files",
":as_files",
":compiler_files",
":coverage_files",
":dwp_files",
":linker_files",
":objcopy_files",
Expand Down Expand Up @@ -662,6 +671,14 @@ filegroup(
],
)

filegroup(
name = "coverage_files",
srcs = [
"@{toolchain_files_repository_name}//:coverage_files",
":gcov",
],
)

filegroup(
name = "gcc",
srcs = [
Expand All @@ -671,6 +688,11 @@ filegroup(
],
)

filegroup(
name = "gcov",
srcs = ["bin/gcov"],
)

filegroup(
name = "gfortran",
srcs = ["bin/gfortran"],
Expand Down