Skip to content

Commit

Permalink
Run coverage for the min Bazel version CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Jun 13, 2023
1 parent f2bd260 commit aed87d0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
29 changes: 25 additions & 4 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@ crate_universe_vendor_example_targets: &crate_universe_vendor_example_targets
crate_universe_unnamed_vendor_example_targets: &crate_universe_unnamed_vendor_example_targets
- "//vendor_remote_manifests:crates_vendor"
- "//vendor_remote_pkgs:crates_vendor"
coverage_validation_post_shell_commands: &coverage_validation_post_shell_commands
- |
grep -q '^SF:.\.rs$' bazel-out/_coverage/_coverage_report.dat \
|| { 1>&2 echo "Failed to find any Rust coverage" \
; 1>&2 cat bazel-out/_coverage/_coverage_report.dat \
; exit 1 \
; }
tasks:
ubuntu2004:
build_targets: *default_linux_targets
test_targets: *default_linux_targets
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
rbe_ubuntu1604:
shell_commands:
- sed -i 's/^# load("@bazelci_rules/load("@bazelci_rules/' WORKSPACE.bazel
Expand All @@ -57,6 +65,7 @@ tasks:
build_targets: *default_macos_targets
test_targets: *default_macos_targets
coverage_targets: *default_macos_targets
post_shell_commands: *coverage_validation_post_shell_commands
windows:
build_targets: *default_windows_targets
test_targets: *default_windows_targets
Expand Down Expand Up @@ -90,9 +99,11 @@ tasks:
ubuntu2004_with_aspects:
name: With Aspects
platform: ubuntu2004
build_flags: *aspects_flags
build_targets: *default_linux_targets
test_targets: *default_linux_targets
build_flags: *aspects_flags
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
rbe_ubuntu1604_with_aspects:
name: With Aspects
platform: rbe_ubuntu1604
Expand Down Expand Up @@ -126,15 +137,19 @@ tasks:
macos_with_aspects:
name: With Aspects
platform: macos
build_flags: *aspects_flags
build_targets: *default_macos_targets
test_targets: *default_macos_targets
build_flags: *aspects_flags
coverage_targets: *default_macos_targets
post_shell_commands: *coverage_validation_post_shell_commands
macos_rolling_with_aspects:
name: "Macos Rolling Bazel Version With Aspects"
platform: macos
build_flags: *aspects_flags
build_targets: *default_macos_targets
test_targets: *default_macos_targets
build_flags: *aspects_flags
coverage_targets: *default_macos_targets
post_shell_commands: *coverage_validation_post_shell_commands
soft_fail: yes
bazel: "rolling"
windows_with_aspects:
Expand Down Expand Up @@ -194,13 +209,17 @@ tasks:
platform: ubuntu1804
build_targets: *default_linux_targets
test_targets: *default_linux_targets
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
ubuntu1804_with_aspects:
name: "Min Bazel Version With Aspects"
bazel: "5.2.0"
platform: ubuntu1804
build_targets: *default_linux_targets
test_targets: *default_linux_targets
build_flags: *aspects_flags
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
ubuntu2004_min_rust_version:
name: "Min Rust Version"
platform: ubuntu2004
Expand Down Expand Up @@ -257,10 +276,12 @@ tasks:
name: "Rolling Bazel Version With Aspects"
bazel: "rolling"
platform: ubuntu2004
build_flags: *aspects_flags
soft_fail: yes
build_targets: *default_linux_targets
test_targets: *default_linux_targets
build_flags: *aspects_flags
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
linux_docs:
name: Docs
platform: ubuntu2004
Expand Down
11 changes: 7 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
## https://bazel.build/docs/best-practices#bazelrc-file
###############################################################################

# https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config
common --enable_platform_specific_config

# https://bazel.build/docs/windows#symlink
startup --windows_enable_symlinks

# Required on windows
common --enable_platform_specific_config
startup:windows --windows_enable_symlinks
build:windows --enable_runfiles

# Enable the only currently supported report type
# https://bazel.build/reference/command-line-reference#flag--combined_report
coverage --combined_report=lcov

###############################################################################
## Unique configuration groups
###############################################################################
Expand Down
3 changes: 3 additions & 0 deletions util/collect_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ readonly profdata_file=$COVERAGE_DIR/coverage.profdata
"$RUNFILES_DIR/$TEST_WORKSPACE/$TEST_BINARY" \
@"$COVERAGE_MANIFEST" \
| sed 's#/proc/self/cwd/##' > "$COVERAGE_DIR/rust_coverage.dat"

# Bazel doesn't support LLVM profdata coverage amongst other coverage formats.
rm "$profdata_file"

0 comments on commit aed87d0

Please sign in to comment.